refactor(memory): 重构记忆系统架构,引入可配置的采样策略

将记忆系统从单一构建模式重构为多策略可配置架构,支持灵活的采样行为控制:

核心架构改进:
- 重构记忆构建流程,分离采样策略与核心逻辑
- 引入MemorySamplingMode枚举,标准化采样模式定义
- 设计插件化采样器接口,支持海马体后台定时采样
- 优化记忆处理管道,添加bypass_interval机制支持后台采样

配置系统增强:
- 新增memory_sampling_mode配置项,支持hippocampus/immediate/all三种模式
- 添加海马体双峰采样参数配置,支持自定义采样间隔和分布
- 引入自适应采样阈值控制,动态调整记忆构建频率
- 完善精准记忆配置,支持基于价值评分的触发机制

兼容性与性能优化:
- 修复Python 3.9兼容性问题,替换strict=False参数
- 优化记忆检索逻辑,统一使用filters参数替代scope_id
- 改进错误处理机制,增强系统稳定性

BREAKING CHANGE: 新增memory_sampling_mode配置项,默认值从adaptive改为immediate
This commit is contained in:
Windpicker-owo
2025-10-03 22:00:53 +08:00
parent a2bbb8041a
commit 1eb41f8372
5 changed files with 969 additions and 17 deletions

View File

@@ -373,7 +373,11 @@ class VirtualLogDisplay:
# 为每个部分应用正确的标签
current_len = 0
for part, tag_name in zip(parts, tags, strict=False):
# Python 3.9 兼容性:不使用 strict=False 参数
min_len = min(len(parts), len(tags))
for i in range(min_len):
part = parts[i]
tag_name = tags[i]
start_index = f"{start_pos}+{current_len}c"
end_index = f"{start_pos}+{current_len + len(part)}c"
self.text_widget.tag_add(tag_name, start_index, end_index)