mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[fix][chat]Fix memory creation logic.
This commit is contained in:
@@ -37,9 +37,9 @@ public class MemoryServiceImpl implements MemoryService {
|
||||
|
||||
@Override
|
||||
public void createMemory(ChatMemoryDO memory) {
|
||||
// do not save duplicate memory for exactly the same question
|
||||
// if an existing enabled memory has the same question, just skip
|
||||
List<ChatMemoryDO> memories = getMemories(ChatMemoryFilter.builder()
|
||||
.agentId(memory.getAgentId()).question(memory.getQuestion()).build());
|
||||
.agentId(memory.getAgentId()).question(memory.getQuestion()).status(MemoryStatus.ENABLED).build());
|
||||
if (memories.size() == 0) {
|
||||
chatMemoryRepository.createMemory(memory);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user