mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-18 20:34:19 +08:00
(improvement)(chat) Remove candidateParses in ParseResp (#536)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -3,7 +3,6 @@ package com.tencent.supersonic.chat.api.pojo.response;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -13,7 +12,6 @@ public class ParseResp {
|
||||
private Long queryId;
|
||||
private ParseState state;
|
||||
private List<SemanticParseInfo> selectedParses = Lists.newArrayList();
|
||||
private List<SemanticParseInfo> candidateParses = Lists.newArrayList();
|
||||
private ParseTimeCostDO parseTimeCost = new ParseTimeCostDO();
|
||||
|
||||
public enum ParseState {
|
||||
@@ -22,14 +20,4 @@ public class ParseResp {
|
||||
FAILED
|
||||
}
|
||||
|
||||
//Compatible with front-end
|
||||
public List<SemanticParseInfo> getSelectedParses() {
|
||||
selectedParses = Lists.newArrayList();
|
||||
if (CollectionUtils.isNotEmpty(candidateParses)) {
|
||||
selectedParses.addAll(candidateParses);
|
||||
candidateParses.clear();
|
||||
}
|
||||
return selectedParses;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,9 +27,8 @@ public class RespBuildProcessor implements ParseResultProcessor {
|
||||
if (candidateQueries.size() > 0) {
|
||||
List<SemanticParseInfo> candidateParses = candidateQueries.stream()
|
||||
.map(SemanticQuery::getParseInfo).collect(Collectors.toList());
|
||||
parseResp.setCandidateParses(candidateParses);
|
||||
parseResp.setSelectedParses(candidateParses);
|
||||
parseResp.setState(ParseResp.ParseState.COMPLETED);
|
||||
parseResp.setCandidateParses(candidateParses);
|
||||
ChatService chatService = ContextUtils.getBean(ChatService.class);
|
||||
chatService.batchAddParse(chatContext, queryReq, parseResp);
|
||||
} else {
|
||||
|
||||
@@ -215,7 +215,7 @@ public class ChatServiceImpl implements ChatService {
|
||||
|
||||
@Override
|
||||
public List<ChatParseDO> batchAddParse(ChatContext chatCtx, QueryReq queryReq, ParseResp parseResult) {
|
||||
List<SemanticParseInfo> candidateParses = parseResult.getCandidateParses();
|
||||
List<SemanticParseInfo> candidateParses = parseResult.getSelectedParses();
|
||||
return chatQueryRepository.batchSaveParseInfo(chatCtx, queryReq, parseResult, candidateParses);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ModelSchemaBuilder {
|
||||
|
||||
public static ModelSchema build(ModelSchemaResp resp) {
|
||||
ModelSchema modelSchema = new ModelSchema();
|
||||
SchemaElement domain = SchemaElement.builder()
|
||||
SchemaElement model = SchemaElement.builder()
|
||||
.model(resp.getId())
|
||||
.id(resp.getId())
|
||||
.name(resp.getName())
|
||||
@@ -34,7 +34,7 @@ public class ModelSchemaBuilder {
|
||||
.type(SchemaElementType.MODEL)
|
||||
.alias(SchemaItem.getAliasList(resp.getAlias()))
|
||||
.build();
|
||||
modelSchema.setModel(domain);
|
||||
modelSchema.setModel(model);
|
||||
modelSchema.setModelRelas(resp.getModelRelas());
|
||||
|
||||
Set<SchemaElement> metrics = new HashSet<>();
|
||||
|
||||
Reference in New Issue
Block a user