mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
进行第二阶段调试修复:修复部分细节问题
- 调整'fixTopicPath'在提取主题路径时的执行时机 - 记忆切片索引出错将不再保存异常快照,只保留日志 - 尝试发布临时版本
This commit is contained in:
@@ -118,10 +118,7 @@ public class MemorySelector implements InteractionModule, PreModuleActions {
|
||||
for (ExtractorMatchData match : matches) {
|
||||
try {
|
||||
MemoryResult memoryResult = switch (match.getType()) {
|
||||
case ExtractorMatchData.Constant.TOPIC -> {
|
||||
fixTopicPath(match.getText());
|
||||
yield memoryManager.selectMemory(match.getText());
|
||||
}
|
||||
case ExtractorMatchData.Constant.TOPIC -> memoryManager.selectMemory(match.getText());
|
||||
case ExtractorMatchData.Constant.DATE ->
|
||||
memoryManager.selectMemory(LocalDate.parse(match.getText()));
|
||||
default -> null;
|
||||
@@ -131,7 +128,7 @@ public class MemorySelector implements InteractionModule, PreModuleActions {
|
||||
memoryResultList.add(memoryResult);
|
||||
} catch (UnExistedDateIndexException | UnExistedTopicException e) {
|
||||
log.error("[MemorySelector] 不存在的记忆索引! 请尝试更换更合适的主题提取LLM!", e);
|
||||
GlobalExceptionHandler.writeExceptionState(new GlobalException(e.getMessage()));
|
||||
log.error("[MemorySelector] 错误索引: {}", match.getText());
|
||||
}
|
||||
}
|
||||
//清理切片记录
|
||||
|
||||
@@ -15,6 +15,7 @@ import work.slhaf.agent.core.session.SessionManager;
|
||||
import work.slhaf.agent.module.common.Model;
|
||||
import work.slhaf.agent.module.common.ModelConstant;
|
||||
import work.slhaf.agent.module.modules.memory.selector.extractor.data.ExtractorInput;
|
||||
import work.slhaf.agent.module.modules.memory.selector.extractor.data.ExtractorMatchData;
|
||||
import work.slhaf.agent.module.modules.memory.selector.extractor.data.ExtractorResult;
|
||||
import work.slhaf.agent.shared.memory.EvaluatedSlice;
|
||||
|
||||
@@ -23,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static work.slhaf.agent.common.util.ExtractUtil.extractJson;
|
||||
import static work.slhaf.agent.common.util.ExtractUtil.fixTopicPath;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@@ -86,6 +88,17 @@ public class MemorySelectExtractor extends Model {
|
||||
extractorResult.setRecall(false);
|
||||
extractorResult.setMatches(List.of());
|
||||
}
|
||||
return fix(extractorResult);
|
||||
}
|
||||
|
||||
private ExtractorResult fix(ExtractorResult extractorResult) {
|
||||
extractorResult.getMatches().forEach(m -> {
|
||||
if (m.getType().equals(ExtractorMatchData.Constant.DATE)) {
|
||||
return;
|
||||
}
|
||||
m.setText(fixTopicPath(m.getText()));
|
||||
});
|
||||
extractorResult.getMatches().removeIf(m -> m.getText().split("->")[0].isEmpty());
|
||||
return extractorResult;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user