mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
[improvement][chat]Make a few code restructure.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user