mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
(improvement)(chat) Remove candidateParses in ParseResp (#536)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user