Commit ef47fcf7 authored by alex yao's avatar alex yao

fix:回答出现null

parent 564e78e3
...@@ -131,7 +131,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ ...@@ -131,7 +131,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
systemMessage.setRole(AgentApplicationDialoguesRecordConstants.ROLE.SYSTEM); systemMessage.setRole(AgentApplicationDialoguesRecordConstants.ROLE.SYSTEM);
Message message = new Message(); Message message = new Message();
message.setContent("{"+input+"}"); message.setContent("{" + input + "}");
message.setRole(AgentApplicationDialoguesRecordConstants.ROLE.USER); message.setRole(AgentApplicationDialoguesRecordConstants.ROLE.USER);
List<Message> messages = new ArrayList<Message>() {{ List<Message> messages = new ArrayList<Message>() {{
add(systemMessage); add(systemMessage);
...@@ -396,7 +396,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ ...@@ -396,7 +396,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
if (LargeModelFunctionEnum.set_long_memory.name().equals(name)) { if (LargeModelFunctionEnum.set_long_memory.name().equals(name)) {
List<LongMemoryEntity> longMemoryEntities = GetLongMemory.get(identifier); List<LongMemoryEntity> longMemoryEntities = GetLongMemory.get(identifier);
if (CollectionUtils.isNotEmpty(longMemoryEntities)) { if (CollectionUtils.isNotEmpty(longMemoryEntities)) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder("");
for (LongMemoryEntity longMemoryEntity : longMemoryEntities) { for (LongMemoryEntity longMemoryEntity : longMemoryEntities) {
stringBuilder stringBuilder
.append("Time").append(":").append(longMemoryEntity.getTimestamp()) .append("Time").append(":").append(longMemoryEntity.getTimestamp())
...@@ -407,12 +407,14 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ ...@@ -407,12 +407,14 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
String searchMemoryContent = stringBuilder.toString(); String searchMemoryContent = stringBuilder.toString();
promptTemplate = promptTemplate.replace("${longMemoryResult}", searchMemoryContent); promptTemplate = promptTemplate.replace("${longMemoryResult}", searchMemoryContent);
} }
} else {
promptTemplate = promptTemplate.replace("${longMemoryResult}", StringUtils.EMPTY);
} }
// 变量 // 变量
if (LargeModelFunctionEnum.set_value_memory.name().equals(name)) { if (LargeModelFunctionEnum.set_value_memory.name().equals(name)) {
Map<Object, Object> map = GetValueMemory.get(identifier); Map<Object, Object> map = GetValueMemory.get(identifier);
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder("");
if (MapUtils.isNotEmpty(map)) { if (MapUtils.isNotEmpty(map)) {
Set<Object> keySet = map.keySet(); Set<Object> keySet = map.keySet();
for (Object key : keySet) { for (Object key : keySet) {
...@@ -420,6 +422,8 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ ...@@ -420,6 +422,8 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
} }
} }
promptTemplate = promptTemplate.replace("${valueMemoryResult}", stringBuilder.toString()); promptTemplate = promptTemplate.replace("${valueMemoryResult}", stringBuilder.toString());
} else {
promptTemplate = promptTemplate.replace("${valueMemoryResult}", StringUtils.EMPTY);
} }
} }
......
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