[improvement][chat]Introduce new chat workflow state.
Some checks are pending
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run

This commit is contained in:
jerryjzhang
2025-02-08 09:24:23 +08:00
parent be2e380b4c
commit c34b85c8a4
2 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,12 @@
package com.tencent.supersonic.headless.api.pojo.enums;
public enum ChatWorkflowState {
MAPPING, PARSING, CORRECTING, TRANSLATING, PROCESSING, FINISHED
MAPPING,
PARSING,
S2SQL_CORRECTING,
TRANSLATING,
VALIDATING,
SQL_CORRECTING,
PROCESSING,
FINISHED
}

View File

@@ -61,14 +61,14 @@ public class ChatWorkflowEngine {
.map(SemanticQuery::getParseInfo).collect(Collectors.toList());
parseResult.setSelectedParses(parseInfos);
if (queryCtx.needSQL()) {
queryCtx.setChatWorkflowState(ChatWorkflowState.CORRECTING);
queryCtx.setChatWorkflowState(ChatWorkflowState.S2SQL_CORRECTING);
} else {
parseResult.setState(ParseResp.ParseState.COMPLETED);
queryCtx.setChatWorkflowState(ChatWorkflowState.FINISHED);
}
}
break;
case CORRECTING:
case S2SQL_CORRECTING:
performCorrecting(queryCtx);
queryCtx.setChatWorkflowState(ChatWorkflowState.TRANSLATING);
break;
@@ -109,7 +109,8 @@ public class ChatWorkflowEngine {
for (SemanticQuery semanticQuery : candidateQueries) {
for (SemanticCorrector corrector : semanticCorrectors) {
corrector.correct(queryCtx, semanticQuery.getParseInfo());
if (!ChatWorkflowState.CORRECTING.equals(queryCtx.getChatWorkflowState())) {
if (!ChatWorkflowState.S2SQL_CORRECTING
.equals(queryCtx.getChatWorkflowState())) {
break;
}
}