mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
[fix][chat]Fix memory creation logic.
This commit is contained in:
@@ -37,9 +37,9 @@ public class MemoryServiceImpl implements MemoryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMemory(ChatMemoryDO memory) {
|
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()
|
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) {
|
if (memories.size() == 0) {
|
||||||
chatMemoryRepository.createMemory(memory);
|
chatMemoryRepository.createMemory(memory);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user