This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
仍不可构建,等待其它也重写完成
- Loading branch information
Showing
15 changed files
with
211 additions
and
376 deletions.
There are no files selected for viewing
33 changes: 0 additions & 33 deletions
33
src/main/java/catx/feitu/coze_discord_bridge/Discord/Discord.java
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
src/main/java/catx/feitu/coze_discord_bridge/Discord/MessageHandle.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/catx/feitu/coze_discord_bridge/GPTManage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package catx.feitu.coze_discord_bridge; | ||
|
||
import catx.feitu.coze_discord_bridge.api.CozeGPT; | ||
import catx.feitu.coze_discord_bridge.api.CozeGPTConfig; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
public class GPTManage { | ||
private final ConcurrentHashMap<Object, CozeGPT> ResponseMap = new ConcurrentHashMap<>(); | ||
public void newGPT(String botID, CozeGPTConfig config) throws Exception { | ||
ResponseMap.put(botID, new CozeGPT(config, true)); | ||
} | ||
public CozeGPT getGPT(String botID) { | ||
if (!ResponseMap.containsKey(botID)) { | ||
throw new NullPointerException(); | ||
} | ||
return ResponseMap.get(botID); | ||
} | ||
public void deleteGPT(String botID) { | ||
ResponseMap.remove(botID); | ||
} | ||
|
||
} |
154 changes: 0 additions & 154 deletions
154
src/main/java/catx/feitu/coze_discord_bridge/Misc/CacheManager.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
src/main/java/catx/feitu/coze_discord_bridge/Misc/TempFileManger.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
src/main/java/catx/feitu/coze_discord_bridge/api/ConversationManage/ConversationData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package catx.feitu.coze_discord_bridge.api.ConversationManage; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
public class ConversationData { | ||
public ConcurrentHashMap<String, String> conversations = new ConcurrentHashMap<>(); | ||
public ConversationData() { } | ||
public ConversationData(ConcurrentHashMap<String, String> conversations) { | ||
this.conversations = conversations; | ||
} | ||
public void put(String name,String conversationID) { | ||
conversations.put(name, conversationID); | ||
} | ||
|
||
public void remove(String name) { | ||
conversations.remove(name); | ||
} | ||
public String get(String name) { | ||
return conversations.getOrDefault(name, name); // 索引为空那么传入的可能是频道ID 直接返回 | ||
} | ||
public ConcurrentHashMap<String, String> getMap() { | ||
return conversations; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/catx/feitu/coze_discord_bridge/api/ConversationManage/ConversationHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package catx.feitu.coze_discord_bridge.api.ConversationManage; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.TypeReference; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
public class ConversationHelper { | ||
public static String Conversation2JsonString (ConversationData conversation) { | ||
return JSON.toJSONString(conversation.getMap()); | ||
} | ||
public static ConversationData JsonString2Conversation (String jsonString) { | ||
TypeReference<ConcurrentHashMap<String, String>> typeRef = new TypeReference<ConcurrentHashMap<String, String>>() {}; | ||
ConcurrentHashMap<String, String> conversation = JSON.parseObject(jsonString, typeRef); | ||
return new ConversationData(conversation); | ||
} | ||
} |
Oops, something went wrong.