[improvement][chat]Introduce AppModule to classify chat apps.

This commit is contained in:
jerryjzhang
2024-10-14 14:21:41 +08:00
parent 6a28a49d31
commit 0b71390fde
13 changed files with 50 additions and 19 deletions

View File

@@ -8,6 +8,7 @@ import com.tencent.supersonic.chat.server.agent.AgentToolType;
import com.tencent.supersonic.chat.server.agent.DatasetTool;
import com.tencent.supersonic.chat.server.agent.ToolConfig;
import com.tencent.supersonic.common.pojo.ChatApp;
import com.tencent.supersonic.common.pojo.enums.AppModule;
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
import com.tencent.supersonic.common.util.ChatAppManager;
@@ -182,7 +183,8 @@ public class S2ArtistDemo extends S2BaseDemo {
agent.setToolConfig(JSONObject.toJSONString(toolConfig));
// configure chat apps
Map<String, ChatApp> chatAppConfig = Maps.newHashMap(ChatAppManager.getAllApps());
Map<String, ChatApp> chatAppConfig =
Maps.newHashMap(ChatAppManager.getAllApps(AppModule.CHAT));
chatAppConfig.values().forEach(app -> app.setChatModelId(demoChatModel.getId()));
agent.setChatAppConfig(chatAppConfig);
agentService.createAgent(agent, defaultUser);

View File

@@ -157,10 +157,11 @@ public class S2VisitsDemo extends S2BaseDemo {
datasetTool.setType(AgentToolType.DATASET);
datasetTool.setDataSetIds(Lists.newArrayList(dataSetId));
toolConfig.getTools().add(datasetTool);
agent.setToolConfig(JSONObject.toJSONString(toolConfig));
// configure chat apps
Map<String, ChatApp> chatAppConfig = Maps.newHashMap(ChatAppManager.getAllApps());
Map<String, ChatApp> chatAppConfig =
Maps.newHashMap(ChatAppManager.getAllApps(AppModule.CHAT));
chatAppConfig.values().forEach(app -> app.setChatModelId(demoChatModel.getId()));
agent.setChatAppConfig(chatAppConfig);
Agent agentCreated = agentService.createAgent(agent, defaultUser);