[improvement][chat]Make a few code restructure.
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled

This commit is contained in:
jerryjzhang
2025-02-08 14:39:23 +08:00
parent c34b85c8a4
commit eef7b3c443
5 changed files with 14 additions and 9 deletions

View File

@@ -65,14 +65,15 @@ public class S2ChatLayerService implements ChatLayerService {
@Override
public ParseResp parse(QueryNLReq queryNLReq) {
ParseResp parseResult = new ParseResp(queryNLReq.getQueryText());
ParseResp parseResp = new ParseResp(queryNLReq.getQueryText());
ChatQueryContext queryCtx = buildChatQueryContext(queryNLReq);
queryCtx.setParseResp(parseResp);
if (queryCtx.getMapInfo().isEmpty()) {
chatWorkflowEngine.start(ChatWorkflowState.MAPPING, queryCtx, parseResult);
chatWorkflowEngine.start(ChatWorkflowState.MAPPING, queryCtx);
} else {
chatWorkflowEngine.start(ChatWorkflowState.PARSING, queryCtx, parseResult);
chatWorkflowEngine.start(ChatWorkflowState.PARSING, queryCtx);
}
return parseResult;
return parseResp;
}
public void correct(QuerySqlReq querySqlReq, User user) {

View File

@@ -34,8 +34,8 @@ public class ChatWorkflowEngine {
private final List<SemanticCorrector> semanticCorrectors =
CoreComponentFactory.getSemanticCorrectors();
public void start(ChatWorkflowState initialState, ChatQueryContext queryCtx,
ParseResp parseResult) {
public void start(ChatWorkflowState initialState, ChatQueryContext queryCtx) {
ParseResp parseResult = queryCtx.getParseResp();
queryCtx.setChatWorkflowState(initialState);
while (queryCtx.getChatWorkflowState() != ChatWorkflowState.FINISHED) {
switch (queryCtx.getChatWorkflowState()) {