Repository navigation
feat: 手动触发 DMN、备忘录回读与记忆列表分页 - #4
Merged
Merged
Conversation
Reviewer's Guide本 PR 增加了潜意识调度的超级用户手动触发、备忘录的合并转发与全文回读工具,并将记忆列表从本地切片改为基于 Chroma limit/offset 的分页,同时更新命令和工具文档。 Sequence diagram for manual subconscious schedulingsequenceDiagram
actor Superuser
participant Matcher
participant Runner as SubconsciousRunner
participant Scheduler
participant Task as asyncio.Task
Superuser->>Matcher: /memory dmn
Matcher->>Runner: trigger_now()
Runner->>Scheduler: remove_job(_job_id)
Runner->>Task: asyncio.create_task(_run())
Runner-->>Matcher: trigger_now() completes
Matcher-->>Superuser: 已触发,潜意识将在后台跑一轮
Task->>Runner: _run()
Sequence diagram for memo viewing and fallback deliverysequenceDiagram
actor User
participant Matcher
participant Memo as get_memo()
participant Bot
User->>Matcher: /memory memo
Matcher->>Memo: get_memo(scope_id)
Memo-->>Matcher: memo content
Matcher->>Bot: send_group_forward_msg or send_private_forward_msg
alt forward API fails
Bot-->>Matcher: exception
Matcher->>Matcher: send(content)
end
Matcher-->>User: memo chunks labeled by segment
Sequence diagram for paginated memory listingsequenceDiagram
actor User
participant Matcher
participant Memory as AsyncUserMemory
participant Chroma
User->>Matcher: /memory user list page
Matcher->>Memory: count_user_notes(partition_id)
Memory->>Chroma: count()
Chroma-->>Memory: total
Matcher->>Memory: get_all_notes(limit=10, offset=page offset)
Memory->>Chroma: get(limit, offset)
Chroma-->>Memory: page of notes
Memory-->>Matcher: IDs, documents, metadatas
Matcher-->>User: page results and next-page hint
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
- /memory dmn 手动触发潜意识调度(仅超级用户) - /memory memo 以合并转发查看当前作用域备忘录 - 新增 read_memo 工具,返回备忘录全文与字数 - list_memory 支持 offset 分页,单页上限 50,不再全量拉取 - /memory user|group list 支持页码翻页
AmriaLin
force-pushed
the
feat/manual-dmn-memo-view
branch
from
October 17, 2026 12:22
511e404 to
44e5d57
Compare
备忘录只支持整篇替换时,补一条规则要重写全文,容易丢内容。append_memo 在末尾追加并以换行分隔,仍受 memo_max_chars 约束。
trigger_now 之前只查 runner 是否存在,配置关掉时提示含糊;改为先读 subconscious.enabled 与 target_user_id。另外本轮 token 原先只进全局 InsightsModel,现同步累加到目标用户元数据,与用户自身对话的统计口径一致。
原先固定 600 字硬切,会把句子和规则从中间劈开。改为按行装箱、超长行按句切,发送直接复用 amrita.utils.send.send_forward_msg,去掉自写的合并转发调用与段号前缀。
nonebot.get_bot 返回内部 Bot 类型,Pyright 在 CI 上会报 reportArgumentType, 这里取到的本来就是 OneBot V11 适配器实例,用 cast 收窄类型即可。
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.
变更内容
1.
/memory dmn— 手动触发潜意识调度SubconsciousRunner.trigger_now():取消已排的 date 任务,取消上一次手动任务,用create_task立即跑一轮_manual_task,避免被 GC 回收;stop()一并取消/memory dmn(别名run、触发),仅超级用户可用,runner 未启动时返回明确提示2.
/memory memo— 查看备忘录amrita.utils.send.send_forward_msg3.
read_memo/append_memo工具备忘录常驻注入系统提示,但 LLM 拿不到原文,也无法只补一条规则。
read_memo:只读,返回全文、字数与empty标志append_memo:在末尾追加一段,与原文以换行分隔,仍受memo_max_chars上限约束;整篇重写仍走update_memo4. 记忆列表分页
AsyncUserMemory.get_all_notes增加limit/offset,透传给 chroma 的getlist_memory工具新增offset,limit默认 10、上限 50,返回total/has_more/next_offset,不再整库拉取后切片/memory user|group list [页码]每页 10 条,显示页码并提示下一页说明
Summary by Sourcery
Enable on-demand subconscious runs, memo access and incremental updates, and efficient paginated memory browsing.
New Features:
Enhancements:
Build:
Documentation: