mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-01-06 17:28:15 +08:00
Feature/Refactor querySelect to queryRanker and fix some errors in integration tests (#369)
* (fix) (chat) fix the context saving failure caused by the loss of default values caused by @builder * (fix) (chat) fix date and metrics result in parse info in integration test * (improvement) (chat) refactor querySelect to queryRanker --------- Co-authored-by: jolunoluo
This commit is contained in:
@@ -68,12 +68,13 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
|
||||
ExecuteQueryReq executeReq = ExecuteQueryReq.builder().build();
|
||||
executeReq.setQueryId(parseResp.getQueryId());
|
||||
executeReq.setParseId(parseResp.getSelectedParses().get(0).getId());
|
||||
executeReq.setParseId(parseResp.getCandidateParses().get(0).getId());
|
||||
executeReq.setQueryText(queryRequest.getQueryText());
|
||||
executeReq.setParseInfo(parseResp.getSelectedParses().get(0));
|
||||
executeReq.setParseInfo(parseResp.getCandidateParses().get(0));
|
||||
executeReq.setChatId(parseResp.getChatId());
|
||||
executeReq.setUser(queryRequest.getUser());
|
||||
executeReq.setAgentId(1);
|
||||
executeReq.setSaveAnswer(true);
|
||||
queryService.performExecution(executeReq);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ com.tencent.supersonic.chat.api.component.SemanticCorrector=\
|
||||
com.tencent.supersonic.chat.api.component.SemanticInterpreter=\
|
||||
com.tencent.supersonic.knowledge.semantic.LocalSemanticInterpreter
|
||||
|
||||
com.tencent.supersonic.chat.query.QuerySelector=\
|
||||
com.tencent.supersonic.chat.query.HeuristicQuerySelector
|
||||
|
||||
com.tencent.supersonic.chat.parser.llm.s2sql.ModelResolver=\
|
||||
com.tencent.supersonic.chat.parser.llm.s2sql.HeuristicModelResolver
|
||||
|
||||
|
||||
@@ -53,11 +53,12 @@ public class BaseQueryTest {
|
||||
|
||||
ExecuteQueryReq request = ExecuteQueryReq.builder()
|
||||
.queryId(parseResp.getQueryId())
|
||||
.parseId(parseResp.getSelectedParses().get(0).getId())
|
||||
.parseId(parseResp.getCandidateParses().get(0).getId())
|
||||
.chatId(parseResp.getChatId())
|
||||
.queryText(parseResp.getQueryText())
|
||||
.user(DataUtils.getUser())
|
||||
.parseInfo(parseResp.getSelectedParses().get(0))
|
||||
.parseInfo(parseResp.getCandidateParses().get(0))
|
||||
.saveAnswer(true)
|
||||
.build();
|
||||
|
||||
return queryService.performExecution(request);
|
||||
@@ -68,11 +69,12 @@ public class BaseQueryTest {
|
||||
|
||||
ExecuteQueryReq request = ExecuteQueryReq.builder()
|
||||
.queryId(parseResp.getQueryId())
|
||||
.parseId(parseResp.getSelectedParses().get(0).getId())
|
||||
.parseId(parseResp.getCandidateParses().get(0).getId())
|
||||
.chatId(parseResp.getChatId())
|
||||
.queryText(parseResp.getQueryText())
|
||||
.user(DataUtils.getUser())
|
||||
.parseInfo(parseResp.getSelectedParses().get(0))
|
||||
.parseInfo(parseResp.getCandidateParses().get(0))
|
||||
.saveAnswer(true)
|
||||
.build();
|
||||
|
||||
QueryResult result = queryService.performExecution(request);
|
||||
|
||||
@@ -57,8 +57,8 @@ public class MetricInterpretTest {
|
||||
.chatId(parseResp.getChatId())
|
||||
.queryId(parseResp.getQueryId())
|
||||
.queryText(parseResp.getQueryText())
|
||||
.parseInfo(parseResp.getSelectedParses().get(0))
|
||||
.parseId(parseResp.getSelectedParses().get(0).getId())
|
||||
.parseInfo(parseResp.getCandidateParses().get(0))
|
||||
.parseId(parseResp.getCandidateParses().get(0).getId())
|
||||
.build();
|
||||
QueryResult queryResult = queryService.performExecution(executeReq);
|
||||
Assert.assertEquals(queryResult.getQueryResults().get(0).get("answer"), lLmAnswerResp.getAssistantMessage());
|
||||
|
||||
@@ -58,8 +58,8 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
//agent only support METRIC_ENTITY, METRIC_FILTER
|
||||
MockConfiguration.mockAgent(agentService);
|
||||
ParseResp parseResp = submitParseWithAgent("alice的访问次数", DataUtils.getAgent().getId());
|
||||
Assert.assertNotNull(parseResp.getSelectedParses());
|
||||
List<String> queryModes = parseResp.getSelectedParses().stream()
|
||||
Assert.assertNotNull(parseResp.getCandidateParses());
|
||||
List<String> queryModes = parseResp.getCandidateParses().stream()
|
||||
.map(SemanticParseInfo::getQueryMode).collect(Collectors.toList());
|
||||
Assert.assertTrue(queryModes.contains("METRIC_FILTER"));
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
//agent only support METRIC_ENTITY, METRIC_FILTER
|
||||
MockConfiguration.mockAgent(agentService);
|
||||
ParseResp parseResp = submitParseWithAgent("超音数的访问次数", DataUtils.getAgent().getId());
|
||||
List<String> queryModes = parseResp.getSelectedParses().stream()
|
||||
List<String> queryModes = parseResp.getCandidateParses().stream()
|
||||
.map(SemanticParseInfo::getQueryMode).collect(Collectors.toList());
|
||||
Assert.assertTrue(queryModes.contains("METRIC_MODEL"));
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
expectedResult.setQueryMode(MetricFilterQuery.QUERY_MODE);
|
||||
expectedParseInfo.setAggType(NONE);
|
||||
|
||||
expectedParseInfo.getDimensions().add(DataUtils.getSchemaElement("用户名"));
|
||||
expectedParseInfo.getMetrics().add(DataUtils.getSchemaElement("访问次数"));
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PluginRecognizeTest extends BasePluginTest {
|
||||
.chatId(parseResp.getChatId())
|
||||
.queryId(parseResp.getQueryId())
|
||||
.queryText(parseResp.getQueryText())
|
||||
.parseInfo(parseResp.getSelectedParses().get(0))
|
||||
.parseInfo(parseResp.getCandidateParses().get(0))
|
||||
.build();
|
||||
QueryResult queryResult = queryService.performExecution(executeReq);
|
||||
|
||||
@@ -69,7 +69,7 @@ public class PluginRecognizeTest extends BasePluginTest {
|
||||
.chatId(parseResp.getChatId())
|
||||
.queryId(parseResp.getQueryId())
|
||||
.queryText(parseResp.getQueryText())
|
||||
.parseInfo(parseResp.getSelectedParses().get(0))
|
||||
.parseInfo(parseResp.getCandidateParses().get(0))
|
||||
.build();
|
||||
QueryResult queryResult = queryService.performExecution(executeReq);
|
||||
|
||||
@@ -84,8 +84,8 @@ public class PluginRecognizeTest extends BasePluginTest {
|
||||
QueryReq queryContextReq = DataUtils.getQueryReqWithAgent(1000, "alice最近的访问情况怎么样",
|
||||
DataUtils.getAgent().getId());
|
||||
ParseResp parseResp = queryService.performParsing(queryContextReq);
|
||||
Assert.assertTrue(parseResp.getSelectedParses() != null
|
||||
&& parseResp.getSelectedParses().size() > 0);
|
||||
Assert.assertTrue(parseResp.getCandidateParses() != null
|
||||
&& parseResp.getCandidateParses().size() > 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@ com.tencent.supersonic.chat.api.component.QueryProcessor=\
|
||||
com.tencent.supersonic.chat.api.component.SemanticInterpreter=\
|
||||
com.tencent.supersonic.knowledge.semantic.LocalSemanticInterpreter
|
||||
|
||||
com.tencent.supersonic.chat.query.QuerySelector=\
|
||||
com.tencent.supersonic.chat.query.HeuristicQuerySelector
|
||||
|
||||
com.tencent.supersonic.chat.application.query.DomainResolver=\
|
||||
com.tencent.supersonic.chat.application.query.HeuristicDomainResolver
|
||||
|
||||
|
||||
Reference in New Issue
Block a user