Commit 564e78e3 authored by alex yao's avatar alex yao

fix:期望用户发送信息后就会生成历史记录,而不是等回答完才生成

parent c65615be
...@@ -93,7 +93,14 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -93,7 +93,14 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
//获取知识库配置 //获取知识库配置
List<Integer> kdIdList = knowledgeService.getKdIdsByKnowledgeInfoIds(infoEntity.getKnowledgeIds()); List<Integer> kdIdList = knowledgeService.getKdIdsByKnowledgeInfoIds(infoEntity.getKnowledgeIds());
// 记录输入时间戳
// 构造对话参数
List<Message> messages = buildMessages(dialogsId, agentId, userBaseEntity.getUserId(), input);
//配置对话function
List<Tool> tools = buildMemoryConfig(infoEntity);
// 保存用户输入记录
Long inputTimestamp = System.currentTimeMillis(); Long inputTimestamp = System.currentTimeMillis();
BizAgentApplicationDialoguesRecordEntity inputRecord = new BizAgentApplicationDialoguesRecordEntity(); BizAgentApplicationDialoguesRecordEntity inputRecord = new BizAgentApplicationDialoguesRecordEntity();
inputRecord.setAgentId(agentId); inputRecord.setAgentId(agentId);
...@@ -105,12 +112,6 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -105,12 +112,6 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
BizAgentApplicationDialoguesRecordEntity saveRecord = bizAgentApplicationDialoguesRecordService.save(inputRecord); BizAgentApplicationDialoguesRecordEntity saveRecord = bizAgentApplicationDialoguesRecordService.save(inputRecord);
userRecordId = saveRecord.getId(); userRecordId = saveRecord.getId();
// 构造对话参数
List<Message> messages = buildMessages(dialogsId, agentId, userBaseEntity.getUserId(), input);
//配置对话function
List<Tool> tools = buildMemoryConfig(infoEntity);
// 记录输出时间戳 // 记录输出时间戳
BizAgentApplicationDialoguesRecordEntity outputRecord = new BizAgentApplicationDialoguesRecordEntity(); BizAgentApplicationDialoguesRecordEntity outputRecord = new BizAgentApplicationDialoguesRecordEntity();
...@@ -129,7 +130,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -129,7 +130,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
outputRecord.setContent(output); outputRecord.setContent(output);
bizAgentApplicationDialoguesRecordService.save(outputRecord); bizAgentApplicationDialoguesRecordService.save(outputRecord);
} catch (Exception e) { } catch (Exception e) {
if (userRecordId != null){ if (userRecordId != null) {
bizAgentApplicationDialoguesRecordService.deletedById(userRecordId); bizAgentApplicationDialoguesRecordService.deletedById(userRecordId);
} }
} }
......
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