mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 21:17:08 +00:00
[improvement][chat]Support user feedback to semantic parse info.#1729
This commit is contained in:
@@ -15,6 +15,7 @@ import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
|
||||
import com.tencent.supersonic.headless.api.pojo.SemanticSchema;
|
||||
import com.tencent.supersonic.headless.api.pojo.SqlEvaluation;
|
||||
import com.tencent.supersonic.headless.api.pojo.SqlInfo;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.ChatWorkflowState;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QueryMapReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QueryNLReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QuerySqlReq;
|
||||
@@ -87,7 +88,11 @@ public class S2ChatLayerService implements ChatLayerService {
|
||||
public ParseResp parse(QueryNLReq queryNLReq) {
|
||||
ParseResp parseResult = new ParseResp(queryNLReq.getQueryText());
|
||||
ChatQueryContext queryCtx = buildChatQueryContext(queryNLReq);
|
||||
chatWorkflowEngine.start(queryCtx, parseResult);
|
||||
if (queryCtx.getMapInfo().isEmpty()) {
|
||||
chatWorkflowEngine.start(ChatWorkflowState.MAPPING, queryCtx, parseResult);
|
||||
} else {
|
||||
chatWorkflowEngine.start(ChatWorkflowState.PARSING, queryCtx, parseResult);
|
||||
}
|
||||
return parseResult;
|
||||
}
|
||||
|
||||
@@ -113,6 +118,7 @@ public class S2ChatLayerService implements ChatLayerService {
|
||||
Map<Long, List<Long>> modelIdToDataSetIds = dataSetService.getModelIdToDataSetIds();
|
||||
queryCtx.setSemanticSchema(semanticSchema);
|
||||
queryCtx.setModelIdToDataSetIds(modelIdToDataSetIds);
|
||||
|
||||
return queryCtx;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,14 @@ public class ChatWorkflowEngine {
|
||||
ComponentFactory.getSemanticCorrectors();
|
||||
private final List<ResultProcessor> resultProcessors = ComponentFactory.getResultProcessors();
|
||||
|
||||
public void start(ChatQueryContext queryCtx, ParseResp parseResult) {
|
||||
queryCtx.setChatWorkflowState(ChatWorkflowState.MAPPING);
|
||||
public void start(ChatWorkflowState initialState, ChatQueryContext queryCtx,
|
||||
ParseResp parseResult) {
|
||||
queryCtx.setChatWorkflowState(initialState);
|
||||
while (queryCtx.getChatWorkflowState() != ChatWorkflowState.FINISHED) {
|
||||
switch (queryCtx.getChatWorkflowState()) {
|
||||
case MAPPING:
|
||||
performMapping(queryCtx);
|
||||
if (queryCtx.getMapInfo().getMatchedDataSetInfos().isEmpty()) {
|
||||
if (queryCtx.getMapInfo().isEmpty()) {
|
||||
parseResult.setState(ParseResp.ParseState.FAILED);
|
||||
parseResult.setErrorMsg(
|
||||
"No semantic entities can be mapped against user question.");
|
||||
|
||||
Reference in New Issue
Block a user