mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[improvement][chat]Introduce new chat workflow state.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user