feat(memory): 实现用户显式管理的长期记忆 V1 - #20
Merged
Merged
Conversation
新增基于 MySQL 的用户输出偏好模块,支持类型校验、空白归一化、原子覆盖保存、幂等真实删除及安全提示词渲染。 提供受认证保护的长期记忆 CRUD 接口,并在应用启动时迁移 user_memories 表及其用户级联外键。 设置页新增长期记忆面板,支持六类偏好的查看、保存和清除,且不依赖 Provider 或 LLM 配置。 Chat 与 Generation 通过统一 Reader 只读加载偏好;读取失败时跳过个性化上下文并保持原流程可用。 补充 memory、HTTP API、Chat 和 Generation 的单元与集成测试。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
实现长期记忆 V1:用户可在设置页显式维护跨会话的输出偏好,并在 Chat 和 Generation 中只读注入。
主要变更
新增
internal/memory模块user_memories新增认证保护的用户记忆 API
GET /api/v1/user/memoriesPUT /api/v1/user/memories/:typeDELETE /api/v1/user/memories/:type设置页新增“长期记忆”面板
Chat 与 Generation 集成
memory.Reader加载快照新增模块、API、Chat 与 Generation 测试覆盖
非目标
验证
已通过:
go test ./internal/memory ./internal/api/v1/memory ./internal/agent/chat ./internal/service ./internal/service/generation -count=1 说明:全量前端 lint 存在项目既有错误;新增长期记忆前端文件的 lint 与生产构建已通过。