mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
(improvement)(chat) add cspider demo (#262)
This commit is contained in:
@@ -103,4 +103,4 @@ function runPythonService {
|
|||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,8 +150,6 @@ public class QueryServiceImpl implements QueryService {
|
|||||||
.candidateParses(candidateParses)
|
.candidateParses(candidateParses)
|
||||||
.build();
|
.build();
|
||||||
chatParseDOS = chatService.batchAddParse(chatCtx, queryReq, parseResult, candidateParses, selectedParses);
|
chatParseDOS = chatService.batchAddParse(chatCtx, queryReq, parseResult, candidateParses, selectedParses);
|
||||||
saveInfo(timeCostDOList, queryReq.getQueryText(), parseResult.getQueryId(),
|
|
||||||
queryReq.getUser().getName(), queryReq.getChatId().longValue());
|
|
||||||
} else {
|
} else {
|
||||||
parseResult = ParseResp.builder()
|
parseResult = ParseResp.builder()
|
||||||
.chatId(queryReq.getChatId())
|
.chatId(queryReq.getChatId())
|
||||||
@@ -166,7 +164,7 @@ public class QueryServiceImpl implements QueryService {
|
|||||||
.interfaceName(parseResponder.getClass().getSimpleName())
|
.interfaceName(parseResponder.getClass().getSimpleName())
|
||||||
.type(CostType.PARSERRESPONDER.getType()).build());
|
.type(CostType.PARSERRESPONDER.getType()).build());
|
||||||
}
|
}
|
||||||
if (timeCostDOList.size() > 0) {
|
if (Objects.nonNull(parseResult.getQueryId()) && timeCostDOList.size() > 0) {
|
||||||
saveInfo(timeCostDOList, queryReq.getQueryText(), parseResult.getQueryId(),
|
saveInfo(timeCostDOList, queryReq.getQueryText(), parseResult.getQueryId(),
|
||||||
queryReq.getUser().getName(), queryReq.getChatId().longValue());
|
queryReq.getUser().getName(), queryReq.getChatId().longValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,6 +265,28 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
|||||||
agentService.createAgent(agent, User.getFakeUser());
|
agentService.createAgent(agent, User.getFakeUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addAgent3() {
|
||||||
|
Agent agent = new Agent();
|
||||||
|
agent.setId(3);
|
||||||
|
agent.setName("cspider");
|
||||||
|
agent.setDescription("cspider数据集的case展示");
|
||||||
|
agent.setStatus(1);
|
||||||
|
agent.setEnableSearch(1);
|
||||||
|
agent.setExamples(Lists.newArrayList("可用“mp4”格式且分辨率低于1000的歌曲的ID是什么?",
|
||||||
|
"“孟加拉语”歌曲的平均评分和分辨率是多少?",
|
||||||
|
"找出所有至少有一首“英文”歌曲的艺术家的名字和作品数量。"));
|
||||||
|
AgentConfig agentConfig = new AgentConfig();
|
||||||
|
|
||||||
|
LLMParserTool llmParserTool = new LLMParserTool();
|
||||||
|
llmParserTool.setId("1");
|
||||||
|
llmParserTool.setType(AgentToolType.LLM_S2QL);
|
||||||
|
llmParserTool.setModelIds(Lists.newArrayList(3L));
|
||||||
|
agentConfig.getTools().add(llmParserTool);
|
||||||
|
|
||||||
|
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||||
|
agentService.createAgent(agent, User.getFakeUser());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||||
if (!demoEnable) {
|
if (!demoEnable) {
|
||||||
@@ -276,6 +298,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
|||||||
addPlugin_1();
|
addPlugin_1();
|
||||||
addAgent1();
|
addAgent1();
|
||||||
addAgent2();
|
addAgent2();
|
||||||
|
addAgent3();
|
||||||
addSampleChats();
|
addSampleChats();
|
||||||
addSampleChats2();
|
addSampleChats2();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user