3 Commits

Author SHA1 Message Date
wangyong
4d8d801be2 Merge b80db694c5 into 6f497b142e 2025-07-03 12:32:13 +00:00
wangyong97
b80db694c5 (fix)(headless) BaseMapper.getMatches,空Map提前返回matches 2025-07-03 20:30:59 +08:00
jerryjzhang
6f497b142e [fix][chat]Memory deletion should disable it first.
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled
2025-07-02 18:59:56 +08:00
2 changed files with 9 additions and 2 deletions

View File

@@ -26,7 +26,6 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -110,6 +109,14 @@ public class MemoryServiceImpl implements MemoryService, CommandLineRunner {
@Override
public void batchDelete(List<Long> ids) {
QueryWrapper<ChatMemoryDO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ChatMemoryDO::getId, ids);
List<ChatMemoryDO> chatMemoryDOS = chatMemoryRepository.getMemories(queryWrapper);
chatMemoryDOS.forEach(chatMemoryDO -> {
if (MemoryStatus.ENABLED.toString().equals(chatMemoryDO.getStatus().trim())) {
disableMemory(chatMemoryDO);
}
});
chatMemoryRepository.batchDelete(ids);
}

View File

@@ -129,7 +129,7 @@ public abstract class BaseMapper implements SchemaMapper {
Map<MatchText, List<T>> matchResult = matchStrategy.match(chatQueryContext, terms,
chatQueryContext.getRequest().getDataSetIds());
List<T> matches = new ArrayList<>();
if (Objects.isNull(matchResult)) {
if (Objects.isNull(matchResult) || matchResult.isEmpty()) {
return matches;
}
Optional<List<T>> first = matchResult.entrySet().stream()