Commit ef47fcf7 authored by alex yao's avatar alex yao

fix:回答出现null

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