(fix)(Chat) Fix dimension value query failed (#1257)

Co-authored-by: lxwcodemonkey
This commit is contained in:
LXW
2024-06-27 22:27:09 +08:00
committed by GitHub
parent 391c0dccc8
commit 995c4f8ada
7 changed files with 54 additions and 46 deletions

View File

@@ -17,7 +17,6 @@ import com.tencent.supersonic.chat.server.service.ChatService;
import com.tencent.supersonic.chat.server.util.ComponentFactory;
import com.tencent.supersonic.chat.server.util.QueryReqConverter;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.common.util.ContextUtils;
import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
import com.tencent.supersonic.headless.api.pojo.request.DimensionValueReq;
import com.tencent.supersonic.headless.api.pojo.request.QueryDataReq;
@@ -45,6 +44,8 @@ public class ChatServiceImpl implements ChatService {
private ChatQueryService chatQueryService;
@Autowired
private RetrieveService retrieveService;
@Autowired
private AgentService agentService;
private List<ChatParser> chatParsers = ComponentFactory.getChatParsers();
private List<ChatExecutor> chatExecutors = ComponentFactory.getChatExecutors();
private List<ParseResultProcessor> parseResultProcessors = ComponentFactory.getParseProcessors();
@@ -111,7 +112,6 @@ public class ChatServiceImpl implements ChatService {
private ChatParseContext buildParseContext(ChatParseReq chatParseReq) {
ChatParseContext chatParseContext = new ChatParseContext();
BeanMapper.mapper(chatParseReq, chatParseContext);
AgentService agentService = ContextUtils.getBean(AgentService.class);
Agent agent = agentService.getAgent(chatParseReq.getAgentId());
chatParseContext.setAgent(agent);
QueryReq queryReq = QueryReqConverter.buildText2SqlQueryReq(chatParseContext);
@@ -147,6 +147,9 @@ public class ChatServiceImpl implements ChatService {
@Override
public Object queryDimensionValue(DimensionValueReq dimensionValueReq, User user) throws Exception {
Integer agentId = dimensionValueReq.getAgentId();
Agent agent = agentService.getAgent(agentId);
dimensionValueReq.setDataSetIds(agent.getDataSetIds());
return chatQueryService.queryDimensionValue(dimensionValueReq, user);
}