Skip to content

feat: 命令推断、自动处理管线与统一附件上下文#56

Merged
69gg merged 52 commits into
mainfrom
feature/good-things
May 2, 2026
Merged

feat: 命令推断、自动处理管线与统一附件上下文#56
69gg merged 52 commits into
mainfrom
feature/good-things

Conversation

@69gg
Copy link
Copy Markdown
Owner

@69gg 69gg commented May 1, 2026

v3.3.3 命令推断、自动处理管线与统一附件上下文

本版本重点优化了命令系统的交互体验、AI 工具边界和消息前置处理链路。新增 GitHub 链接自动卡片生成,并将 Bilibili、arXiv、GitHub 等自动提取迁入 skills/auto_pipeline 热重载管线,使预处理结果能写入历史并进入后续 AI 回复上下文。同时,帮助说明与用户侧写默认改为图片输出,系统剥离独立群聊分析工具集,全面推行统一附件标签,并为远程附件加入可配置下载上限和 URL 引用降级,完善底层用户识别机制与模型高级透传配置。

  • 优化命令系统:支持声明式子命令与用户意图推断。如 /faq 合并了列表、阅读、搜索与删除入口,可自然理解省略部分参数后的交互意图。
  • 改善长文本呈现:/help/profile 默认渲染为图片分发,避免长内容刷屏;保留 -t 参数用于强制返回纯文本,/profile 仍支持 -f 合并转发模式。
  • 新增自动处理管线:在 skills/auto_pipeline 下提供 config.json + handler.py 结构,支持热重载、并行检测和并行处理多个命中结果;首批内置 Bilibili、arXiv、GitHub 三条管线,且斜杠命令优先级高于自动管线,命中命令后不会触发后续自动提取或 AI 自动回复。
  • 新增 GitHub 自动卡片:支持在对话中检测 GitHub 链接及 owner/repo 标识,自动生成包含项目简介、Stars、Forks、贡献者等信息的卡片;支持独立开关与白名单控制,并裁剪渲染截图底部空白。
  • 打通命令与自动提取历史上下文:斜杠命令输入、命令输出、自动管线发送的信息、图片、文件和视频摘要都会写入消息历史;统一发送层会自动把本地 CQ 图片、视频、语音和上传文件登记为当前会话可见的 pic_* / file_* UID,并记录群合并转发摘要,后续 AI 回复可直接看到这些结果并用 <attachment uid="..."/> 引用附件。
  • 新增远程附件下载上限:[attachments].remote_download_max_size_mb 控制外部远程附件缓存大小,超过上限或配置为 0 时只登记 URL 引用,避免大文件导致磁盘占用和消息处理延迟激增。
  • 独立群聊分析工具:将群成员构成与水群分析从基础群工具中完全剥离,划归专属 group_analysis.* 集合,避免日常查询与复杂分析导致的 AI 工具边界混淆。
  • 统一多模态附件标签:全系统推行 <attachment uid="..."/> 作为标准分发标签(继续兼容旧 <pic>),配套统一了表情包提示词,新增 group.get_avatar 头像专用工具。
  • 稳定用户识别体系:底层认知逻辑固定以 QQ 号为唯一绑定标识,辅以 group.get_member_info(brief=true) 快速拉取当前昵称,有效解决群友频繁更换名片引发的识别错乱。
  • 增强模型连接配置:新增 stream_enabled 独立控制推流行为,增加 request_params 以支持向不同厂商端点透传特殊参数。
  • 提升基础工程质量:对命令推断、群分析、附件处理、配置参数等进行了全面的单元与集成测试补强,总测试用例数提升至 1500+ 项。
  • 修复图片渲染超时:重构 render.py 为浏览器实例单例复用模式,并引入可配置的并发信号量,防止低资源设备多任务抢占导致截图超时。
  • 改进 LaTeX 渲染稳定性:常见公式优先使用本地 matplotlib mathtext 渲染,复杂内容再回退 MathJax + Playwright,避免简单公式依赖外部网络或系统 TeX 环境。

Open in Devin Review

69gg and others added 30 commits April 25, 2026 16:10
Allow each LLM config to opt into upstream streaming without changing runtime or WebUI chat protocols. Preserve provider compatibility by aggregating stream responses in the unified requester and falling back to non-stream requests when streaming fails.
- 提示词添加用户识别规则:以 QQ 号为准,称呼用最新昵称
- observations 格式要求:必须包含 QQ 号(昵称会变但 QQ 号不变)
- get_member_info 工具新增 brief 参数,支持简洁模式只返回昵称

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 将所有工具返回的 <pic uid="..."/> 改为推荐的 <attachment uid="..."/>
- 更新文档中的附件标签说明
- 新增 group.get_avatar 工具:获取 QQ 用户头像返回 UID

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 添加统一附件标签说明(推荐 <attachment uid="..."/>)
- 添加 group.get_member_info brief 参数说明
- 添加 group.get_avatar 工具说明
- 添加用户识别规则与提示词约定

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…emove internal permission checks

- Extend CommandMeta/SubcommandMeta with subcommands and inference fields
- Add SubcommandInferenceRule/SubcommandInference dataclasses in registry.py
- Implement resolve_subcommand() with explicit match + inference (default/rules/fallback)
- Dispatcher: apply subcommand permissions/rate_limits before handler invocation
- Add CommandContext.check_permission() and resolved_subcommand for handler use
- Migrate faq: config.json subcommands + inference, handler simplified
- Migrate naga: config.json subcommands, delete scopes.json + _check_scope()
- Migrate profile: use context.check_permission() instead of direct config check
- Update /help: compact list format, subcommand detail with inference hints
- Sync all documentation: slash-commands.md, usage.md, READMEs
- Add tests for registry inference, context permission checks
The ai_draw_handler now returns the unified <attachment uid="..."/> tag,
aligning with the attachment system migration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
为所有接受 QQ 号参数的斜杠命令(/addadmin、/rmadmin、/profile、/bugfix)
支持真 @ 提及,例如 /addadmin @某人 等价于 /addadmin 1234567。

实现策略:在命令解析层 (services.command.parse_command) 统一归一化,
命令实现侧无需任何改动,仍按纯数字处理参数。

- services/command.py:
  * parse_command 仅剥离开头的 @ 机器人提及(保留参数中的真 @)
  * 新增 _normalize_qq_arg:自动把 [@qq]/[@qq(昵称)]/[@{QQ}] 归一化为
    纯数字 QQ 号,注入到 args 列表中
- 各 command handler 保持原状(仅文档/提示语轻微调整)
- 同步更新 4 份 config.json 的 description/usage/example
- tests: 新增 test_command_qq_arg.py 覆盖归一化与 parse_command 行为

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@69gg 69gg force-pushed the feature/good-things branch from 0d6fa64 to 34af653 Compare May 1, 2026 23:51
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@69gg 69gg merged commit 87d5523 into main May 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant