Commit 0d79b105 authored by alex yao's avatar alex yao

feat: 数据库列表按修改时间倒序

parent 936fde5b
...@@ -649,23 +649,29 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -649,23 +649,29 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
HttpServletResponse httpServletResponse) throws Exception { HttpServletResponse httpServletResponse) throws Exception {
if (stream) { if (stream) {
SSEUtil sseUtil = new SSEUtil(httpServletResponse); SSEUtil sseUtil = new SSEUtil(httpServletResponse);
if (CollectionUtils.isNotEmpty(dbChainResults)) { if (ObjectUtil.isNotNull(functionResult) && StringUtils.isNotBlank(functionResult.getFunctionName())) {
LargeModelDemandResult result = new LargeModelDemandResult(); LargeModelDemandResult result = new LargeModelDemandResult();
result.setCode("0"); result.setCode("0");
result.setDbChainResult(dbChainResults); ToolFunction toolFunction = functionResultConvertToolFunction(functionResult);
result.setFunction(toolFunction);
result.setDbChainResult(null);
result.setKnowledgeContentResult(null);
sseUtil.send(JsonUtils.serialize(result)); sseUtil.send(JsonUtils.serialize(result));
} }
if (CollectionUtils.isNotEmpty(knowledgeResult)) { if (CollectionUtils.isNotEmpty(dbChainResults)) {
LargeModelDemandResult result = new LargeModelDemandResult(); LargeModelDemandResult result = new LargeModelDemandResult();
result.setCode("0"); result.setCode("0");
result.setKnowledgeContentResult(knowledgeResult); result.setFunction(null);
result.setDbChainResult(dbChainResults);
result.setKnowledgeContentResult(null);
sseUtil.send(JsonUtils.serialize(result)); sseUtil.send(JsonUtils.serialize(result));
} }
if (ObjectUtil.isNotNull(functionResult) && StringUtils.isNotBlank(functionResult.getFunctionName())) { if (CollectionUtils.isNotEmpty(knowledgeResult)) {
LargeModelDemandResult result = new LargeModelDemandResult(); LargeModelDemandResult result = new LargeModelDemandResult();
result.setCode("0"); result.setCode("0");
ToolFunction toolFunction = functionResultConvertToolFunction(functionResult); result.setFunction(null);
result.setFunction(toolFunction); result.setDbChainResult(null);
result.setKnowledgeContentResult(knowledgeResult);
sseUtil.send(JsonUtils.serialize(result)); sseUtil.send(JsonUtils.serialize(result));
} }
BufferedReader bufferedReader = invokeLLMStream(model, messageArray, topP); BufferedReader bufferedReader = invokeLLMStream(model, messageArray, topP);
...@@ -931,7 +937,10 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -931,7 +937,10 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
sseUtil.complete(); sseUtil.complete();
throw ex; throw ex;
} }
sseUtil.send(res); result.setFunction(null);
result.setDbChainResult(null);
result.setKnowledgeContentResult(null);
sseUtil.send(JsonUtils.serialize(result));
if (StringUtils.isNotEmpty(result.getMessage())) { if (StringUtils.isNotEmpty(result.getMessage())) {
output.append(result.getMessage()); output.append(result.getMessage());
} }
......
package cn.com.poc.utils; package cn.com.poc.utils;
import cn.com.poc.common.utils.DatabaseUtil; import cn.com.poc.common.utils.DatabaseUtil;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult;
import cn.com.yict.framemax.core.spring.SingleContextInitializer; import cn.com.yict.framemax.core.spring.SingleContextInitializer;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -40,4 +42,15 @@ public class DatabaseUtilTest { ...@@ -40,4 +42,15 @@ public class DatabaseUtilTest {
DatabaseUtil.getTableInfo(host, port, username, password, database); DatabaseUtil.getTableInfo(host, port, username, password, database);
} }
@Test
public void test(){
LargeModelDemandResult result = new LargeModelDemandResult();
result.setCode("0");
result.setFunction(null);
result.setDbChainResult(null);
// result.setKnowledgeContentResult(null);
System.out.println(JsonUtils.serialize(result));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment