mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[improvement][chat]Only return the parse info of the highest score for one dataset pass.#1847
This commit is contained in:
@@ -119,6 +119,13 @@ public class ChatQueryServiceImpl implements ChatQueryService {
|
|||||||
chatManageService.updateParseCostTime(parseContext.getResponse());
|
chatManageService.updateParseCostTime(parseContext.getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no need for explicit user feedback if there is only one candidate parses
|
||||||
|
if (parseContext.needFeedback() && parseContext.getResponse().getSelectedParses().size() == 1) {
|
||||||
|
chatParseReq.setQueryId(parseContext.getResponse().getQueryId());
|
||||||
|
chatParseReq.setSelectedParse(parseContext.getResponse().getSelectedParses().get(0));
|
||||||
|
return parse(chatParseReq);
|
||||||
|
}
|
||||||
|
|
||||||
return parseContext.getResponse();
|
return parseContext.getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,11 @@ public class ChatQueryContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<SemanticQuery> getCandidateQueries() {
|
public List<SemanticQuery> getCandidateQueries() {
|
||||||
ParserConfig parserConfig = ContextUtils.getBean(ParserConfig.class);
|
|
||||||
int parseShowCount =
|
|
||||||
Integer.parseInt(parserConfig.getParameterValue(ParserConfig.PARSER_SHOW_COUNT));
|
|
||||||
candidateQueries = candidateQueries.stream()
|
candidateQueries = candidateQueries.stream()
|
||||||
.sorted(Comparator.comparing(
|
.sorted(Comparator.comparing(
|
||||||
semanticQuery -> semanticQuery.getParseInfo().getScore(),
|
semanticQuery -> semanticQuery.getParseInfo().getScore(),
|
||||||
Comparator.reverseOrder()))
|
Comparator.reverseOrder()))
|
||||||
.limit(parseShowCount).collect(Collectors.toList());
|
.limit(1).collect(Collectors.toList());
|
||||||
return candidateQueries;
|
return candidateQueries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user