mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-28 12:59:03 +08:00
(improvement)(chat) recall history solved query in every parse
This commit is contained in:
@@ -21,5 +21,4 @@ public class QueryResult {
|
||||
private SemanticParseInfo chatContext;
|
||||
private Object response;
|
||||
private List<Map<String, Object>> queryResults;
|
||||
private List<SolvedQueryRecallResp> similarSolvedQuery;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.tencent.supersonic.chat.query.llm.dsl.LLMReq;
|
||||
import com.tencent.supersonic.chat.query.llm.dsl.LLMReq.ElementValue;
|
||||
import com.tencent.supersonic.common.pojo.Constants;
|
||||
import com.tencent.supersonic.common.util.JsonUtil;
|
||||
import com.tencent.supersonic.common.util.jsqlparser.SqlParserSelectHelper;
|
||||
import com.tencent.supersonic.common.util.jsqlparser.SqlParserUpdateHelper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -32,6 +33,11 @@ public class GlobalCorrector extends BaseSemanticCorrector {
|
||||
|
||||
private void addAggregateToMetric(SemanticCorrectInfo semanticCorrectInfo) {
|
||||
|
||||
if (SqlParserSelectHelper.hasGroupBy(semanticCorrectInfo.getSql())) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void replaceAlias(SemanticCorrectInfo semanticCorrectInfo) {
|
||||
|
||||
@@ -95,7 +95,7 @@ public class DefaultQueryResponder implements QueryResponder {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("recall similar solved query failed", e);
|
||||
log.warn("recall similar solved query failed, queryText:{}", queryText);
|
||||
}
|
||||
return solvedQueryRecallResps;
|
||||
}
|
||||
|
||||
@@ -143,15 +143,15 @@ public class QueryServiceImpl implements QueryService {
|
||||
saveInfo(timeCostDOList, queryReq.getQueryText(), parseResult.getQueryId(),
|
||||
queryReq.getUser().getName(), queryReq.getChatId().longValue());
|
||||
} else {
|
||||
List<SolvedQueryRecallResp> solvedQueryRecallResps =
|
||||
queryResponder.recallSolvedQuery(queryCtx.getRequest().getQueryText());
|
||||
parseResult = ParseResp.builder()
|
||||
.chatId(queryReq.getChatId())
|
||||
.queryText(queryReq.getQueryText())
|
||||
.state(ParseResp.ParseState.FAILED)
|
||||
.similarSolvedQuery(solvedQueryRecallResps)
|
||||
.build();
|
||||
}
|
||||
List<SolvedQueryRecallResp> solvedQueryRecallResps =
|
||||
queryResponder.recallSolvedQuery(queryCtx.getRequest().getQueryText());
|
||||
parseResult.setSimilarSolvedQuery(solvedQueryRecallResps);
|
||||
return parseResult;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user