mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
(improvement)(Chat) Integrate chat with plugin recognizer and parse result processor (#820)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.response;
|
||||
|
||||
import com.tencent.supersonic.headless.api.pojo.SchemaMapInfo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MapResp {
|
||||
|
||||
private String queryText;
|
||||
|
||||
private SchemaMapInfo mapInfo = new SchemaMapInfo();
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -22,7 +21,6 @@ public class ChatQueryApiController {
|
||||
|
||||
@Autowired
|
||||
private ChatQueryService chatQueryService;
|
||||
|
||||
@Autowired
|
||||
private SearchService searchService;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.tencent.supersonic.headless.api.pojo.request.DimensionValueReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ExecuteQueryReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QueryDataReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.MapResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.QueryResult;
|
||||
|
||||
@@ -15,6 +16,8 @@ import com.tencent.supersonic.headless.api.pojo.response.QueryResult;
|
||||
*/
|
||||
public interface ChatQueryService {
|
||||
|
||||
MapResp performMapping(QueryReq queryReq);
|
||||
|
||||
ParseResp performParsing(QueryReq queryReq);
|
||||
|
||||
QueryResult performExecution(ExecuteQueryReq queryReq) throws Exception;
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.tencent.supersonic.headless.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QueryStructReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.SemanticQueryReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ExplainResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.MapResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.QueryResult;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.QueryState;
|
||||
@@ -106,6 +107,18 @@ public class ChatQueryServiceImpl implements ChatQueryService {
|
||||
private List<SemanticCorrector> semanticCorrectors = ComponentFactory.getSemanticCorrectors();
|
||||
private List<ResultProcessor> resultProcessors = ComponentFactory.getResultProcessors();
|
||||
|
||||
@Override
|
||||
public MapResp performMapping(QueryReq queryReq) {
|
||||
MapResp mapResp = new MapResp();
|
||||
QueryContext queryCtx = buildQueryContext(queryReq);
|
||||
schemaMappers.forEach(mapper -> {
|
||||
mapper.map(queryCtx);
|
||||
});
|
||||
SchemaMapInfo mapInfo = queryCtx.getMapInfo();
|
||||
mapResp.setMapInfo(mapInfo);
|
||||
return mapResp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParseResp performParsing(QueryReq queryReq) {
|
||||
ParseResp parseResult = new ParseResp();
|
||||
|
||||
Reference in New Issue
Block a user