mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[improvement][Headless] Unit tests do not use the LLM parsing tool by default. (#699)
This commit is contained in:
@@ -67,6 +67,9 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
@Value("${demo.enabled:false}")
|
||||
private boolean demoEnabled;
|
||||
|
||||
@Value("${demo.nl2SqlLlm.enabled:true}")
|
||||
private boolean demoEnabledNl2SqlLlm;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
if (!checkEnable()) {
|
||||
@@ -451,12 +454,13 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
ruleQueryTool.setQueryTypes(Lists.newArrayList(QueryType.METRIC.name()));
|
||||
agentConfig.getTools().add(ruleQueryTool);
|
||||
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(-1L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
|
||||
if (demoEnabledNl2SqlLlm) {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(-1L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
agentService.createAgent(agent, User.getFakeUser());
|
||||
}
|
||||
@@ -477,12 +481,13 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
ruleQueryTool.setQueryTypes(Lists.newArrayList(QueryType.TAG.name()));
|
||||
agentConfig.getTools().add(ruleQueryTool);
|
||||
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(-1L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
|
||||
if (demoEnabledNl2SqlLlm) {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(-1L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
agentService.createAgent(agent, User.getFakeUser());
|
||||
}
|
||||
@@ -498,12 +503,13 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
"“孟加拉语”歌曲的平均评分和分辨率是多少?",
|
||||
"找出所有至少有一首“英文”歌曲的艺术家的名字和作品数量。"));
|
||||
AgentConfig agentConfig = new AgentConfig();
|
||||
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(5L, 6L, 7L, 8L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
if (demoEnabledNl2SqlLlm) {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(5L, 6L, 7L, 8L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
agentService.createAgent(agent, User.getFakeUser());
|
||||
@@ -519,11 +525,13 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
agent.setExamples(Lists.newArrayList());
|
||||
AgentConfig agentConfig = new AgentConfig();
|
||||
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(9L, 10L, 11L, 12L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
if (demoEnabledNl2SqlLlm) {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(9L, 10L, 11L, 12L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
agentService.createAgent(agent, User.getFakeUser());
|
||||
|
||||
@@ -14,6 +14,8 @@ spring:
|
||||
|
||||
demo:
|
||||
enabled: true
|
||||
nl2SqlLlm:
|
||||
enabled: false
|
||||
|
||||
server:
|
||||
port: 9080
|
||||
|
||||
Reference in New Issue
Block a user