(improvement)(chat) Remove candidateParses in ParseResp (#536)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-12-18 21:10:53 +08:00
committed by GitHub
parent 4c26e0c972
commit d7f1f06daf
8 changed files with 17 additions and 30 deletions

View File

@@ -92,9 +92,9 @@ public class ChatDemoLoader {
ExecuteQueryReq executeReq = ExecuteQueryReq.builder().build();
executeReq.setQueryId(parseResp.getQueryId());
executeReq.setParseId(parseResp.getCandidateParses().get(0).getId());
executeReq.setParseId(parseResp.getSelectedParses().get(0).getId());
executeReq.setQueryText(queryRequest.getQueryText());
executeReq.setParseInfo(parseResp.getCandidateParses().get(0));
executeReq.setParseInfo(parseResp.getSelectedParses().get(0));
executeReq.setChatId(parseResp.getChatId());
executeReq.setUser(queryRequest.getUser());
executeReq.setAgentId(1);

View File

@@ -53,11 +53,11 @@ public class BaseQueryTest {
ExecuteQueryReq request = ExecuteQueryReq.builder()
.queryId(parseResp.getQueryId())
.parseId(parseResp.getCandidateParses().get(0).getId())
.parseId(parseResp.getSelectedParses().get(0).getId())
.chatId(parseResp.getChatId())
.queryText(parseResp.getQueryText())
.user(DataUtils.getUser())
.parseInfo(parseResp.getCandidateParses().get(0))
.parseInfo(parseResp.getSelectedParses().get(0))
.saveAnswer(true)
.build();
@@ -69,11 +69,11 @@ public class BaseQueryTest {
ExecuteQueryReq request = ExecuteQueryReq.builder()
.queryId(parseResp.getQueryId())
.parseId(parseResp.getCandidateParses().get(0).getId())
.parseId(parseResp.getSelectedParses().get(0).getId())
.chatId(parseResp.getChatId())
.queryText(parseResp.getQueryText())
.user(DataUtils.getUser())
.parseInfo(parseResp.getCandidateParses().get(0))
.parseInfo(parseResp.getSelectedParses().get(0))
.saveAnswer(true)
.build();

View File

@@ -54,8 +54,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.getCandidateParses());
List<String> queryModes = parseResp.getCandidateParses().stream()
Assert.assertNotNull(parseResp.getSelectedParses());
List<String> queryModes = parseResp.getSelectedParses().stream()
.map(SemanticParseInfo::getQueryMode).collect(Collectors.toList());
Assert.assertTrue(queryModes.contains("METRIC_FILTER"));
}
@@ -84,7 +84,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.getCandidateParses().stream()
List<String> queryModes = parseResp.getSelectedParses().stream()
.map(SemanticParseInfo::getQueryMode).collect(Collectors.toList());
Assert.assertTrue(queryModes.contains("METRIC_MODEL"));
}

View File

@@ -44,7 +44,7 @@ public class PluginRecognizeTest extends BasePluginTest {
.chatId(parseResp.getChatId())
.queryId(parseResp.getQueryId())
.queryText(parseResp.getQueryText())
.parseInfo(parseResp.getCandidateParses().get(0))
.parseInfo(parseResp.getSelectedParses().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.getCandidateParses().get(0))
.parseInfo(parseResp.getSelectedParses().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.getCandidateParses() != null
&& parseResp.getCandidateParses().size() > 0);
Assert.assertTrue(parseResp.getSelectedParses() != null
&& parseResp.getSelectedParses().size() > 0);
}
}