Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## v3.6.2 合并转发 UID、表情包跟进与协调器清理

本版本继续收敛消息附件链路和协调器结构:合并转发可作为会话内 `forward_` UID 被 AI 按层读取和复用,表情包跟进策略更稳定,同时移除旧版协调器兼容模块,并完成 3.6.2 版本号同步。

- 新增合并转发 UID 语义。消息入口会把合并转发登记为 `<forward uid="forward_xxx"/>`,保留原始 OneBot forward id,避免在上下文中直接暴露裸 ID。
- 增强 `get_forward_msg`。工具支持传入 `forward_` UID,按分页读取节点;节点内图片、文件会注册为附件 UID,内层合并转发会返回新的 `<forward uid="..."/>` 供继续读取。
- 完善附件与 XML 处理。OneBot forward 段、合并转发内附件注册、合法 `<attachment>` / `<forward>` 标签保留和复读图片发送链路同步修复。
- 调整表情包回复策略。主提示词、NagaAgent 提示词和协调器提示统一要求“先文字、后表情包”,减少首条回复被表情包检索拖慢或覆盖正文的情况。
- 清理旧版协调器入口。删除 `services.ai_coordinator` 兼容模块,文档和测试改为引用 `services.coordinator.AICoordinator`,并补齐合并转发、附件、复读和 XML 回归测试。

---

## v3.6.1 Agent 路由收敛、文件分析增强与发版脚本修复

本版本围绕 Agent 职责边界和文件分析链路做小版本收敛:把 arXiv 论文分析从独立 Agent 合并到通用文件分析 Agent,让论文、PDF 页面视觉分析和视频附件获取都走统一的附件 UID 语义;同时修复版本迭代脚本重写 Tauri 配置格式导致 pre-commit 失败的问题,保证后续版本号同步、lock 文件刷新和自动提交流程更稳定。
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async def main() -> None:
asyncio.run(main())
```

- [Python 库 API 参考](docs/python-api.md) — 根包符号表、shim 路径、`AIClient` / `CognitiveService` 等嵌入示例
- [Python 库 API 参考](docs/python-api.md) — 根包符号表、稳定子包路径、`AIClient` / `CognitiveService` 等嵌入示例
- [配置详解 — 库嵌入配置](docs/configuration.md#2-库嵌入配置) — `from_mapping` / `Config.builder`
- [开发者与拓展中心](docs/development.md) — 模块结构与自检命令

Expand Down
4 changes: 2 additions & 2 deletions apps/undefined-chat/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/undefined-chat/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "undefined-chat",
"private": true,
"version": "3.6.1",
"version": "3.6.2",
"type": "module",
"scripts": {
"tauri": "tauri",
Expand Down
2 changes: 1 addition & 1 deletion apps/undefined-chat/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/undefined-chat/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "undefined_chat"
version = "3.6.1"
version = "3.6.2"
description = "Undefined native chat client"
authors = ["Undefined contributors"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion apps/undefined-chat/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Undefined Chat",
"version": "3.6.1",
"version": "3.6.2",
"identifier": "com.undefined.chat",
"build": {
"beforeDevCommand": "npm run dev",
Expand Down
4 changes: 2 additions & 2 deletions apps/undefined-console/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/undefined-console/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "undefined-console",
"private": true,
"version": "3.6.1",
"version": "3.6.2",
"type": "module",
"scripts": {
"tauri": "tauri",
Expand Down
2 changes: 1 addition & 1 deletion apps/undefined-console/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/undefined-console/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "undefined_console"
version = "3.6.1"
version = "3.6.2"
description = "Undefined cross-platform management console"
authors = ["Undefined contributors"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion apps/undefined-console/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Undefined Console",
"version": "3.6.1",
"version": "3.6.2",
"identifier": "com.undefined.console",
"build": {
"beforeDevCommand": "npm run dev",
Expand Down
4 changes: 3 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ Prompt caching 补充:

外部接收的远程图片或文件默认会先下载到附件缓存再生成 UID,避免后续 URL 失效;大文件超过阈值时,UID 仍会生成,但绑定的是 URL 引用而不是缓存文件,AI 可在上下文中看到原始 `source_ref`。如果本地缓存因总容量或时间清理被删除,但记录仍保留 URL,后续需要文件内容时会优先按 URL 回源下载。

合并转发会复用同一注册表登记为 `forward_...` UID,并在实时 AI 输入中显示为 `<forward uid="..."/>`。历史记录仍保留递归展开后的文本;需要查看实时上下文里的转发内容时,AI 会调用 `messages.get_forward_msg` 按层读取,内层合并转发会继续分配新的 `forward_...` UID。

### 4.10.2 `[message_batcher]` 同 sender 短时消息合并

| 字段 | 默认值 | 说明 |
Expand Down Expand Up @@ -764,7 +766,7 @@ Prompt caching 补充:
- 命中 B 站链接、BV 号或 AV 号后,自动提取会发送一次外层合并转发,固定包含三个节点:视频信息、视频文件或视频状态、弹幕列表。
- 弹幕通过 Bilibili protobuf 接口分段拉取;项目内置了解码逻辑,无需安装 `protoc` 或额外生成 protobuf 代码。
- 弹幕列表节点会按每 100 条弹幕生成一个内层合并转发;每条弹幕对应内层合并转发中的一个节点,便于在客户端逐条查看。
- 视频文件下载、清晰度、时长和体积限制仍由本节配置控制;自动提取的转发消息也会通过统一发送层写入历史,供后续 AI 回复读取
- 视频文件下载、清晰度、时长和体积限制仍由本节配置控制;自动提取的转发消息会通过统一发送层写入历史。后续实时 AI 上下文遇到合并转发时只看到 `forward_...` UID,需要内容时按层调用 `messages.get_forward_msg` 读取

---

Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ src/Undefined/
│ └── _openapi.py # OpenAPI 文档生成
├── memes/ # 表情包库 (service + ingest/ + search/ + store + vector_store)
├── services/ # 核心运行服务
│ ├── coordinator/ # AICoordinator mixins(ai_coordinator.py 门面
│ ├── coordinator/ # AICoordinator 唯一实现(群聊 / 私聊 / 批处理 / 后台任务 mixins
│ ├── commands/ # CommandDispatcher mixins(stats / bugfix)
│ ├── message_batcher/ # 同 sender 短时合并
│ ├── command.py # 命令分发门面 + shim 组合
Expand Down
2 changes: 1 addition & 1 deletion docs/memes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Undefined 平台自 3.3.0 版本起内置了强大的**全局表情包库**功
存储与索引完成后,AI Agent 会通过内置的 `memes.*` 系列工具使用表情包:
- **`memes.search_memes`**:支持关键词检索(基于 SQLite)、语义检索(基于 ChromaDB 向量相似度)与混合检索(Hybrid)。AI 可借此根据当前对话的语境快速寻找最有梗的静态图或 GIF。
- **发送机制**:使用统一的图片 `uid` 进行索引。系统不仅提供了 `memes.send_meme_by_uid` 让 AI 一键发送表情包,还支持 AI 输出 `<attachment uid="..."/>` 统一资源标签指令进行图文混排;用户发来的图片在 AI 上下文中也使用同一格式,旧 `<pic>` / `[图片 uid=...]` 仅作为兼容格式保留。
- **回复顺序**:只有当本轮明确是纯表情包 / 纯反应图回复时,AI 才应先搜索并发送表情包。凡是需要文字承接、解释、答疑、推进任务或确认操作的场景,都必须先发送必要文字;如果仍想补表情包,再把 `memes.search_memes` / `memes.send_meme_by_uid` 放到后续轮次,避免表情包检索拖慢首条回复体验
- **回复顺序**:只有当本轮明确是纯表情包 / 纯反应图回复时,AI 才应先搜索并发送表情包。凡是需要文字承接、解释、答疑、推进任务或确认操作的场景,都必须先发送必要文字;轻松聊天、吐槽、附和、接梗、表达情绪、被拍一拍或被 @ 后的短回应等场景,文字发送成功后会更积极地在后续轮次补发一张独立表情包。严肃答疑、代码排查、长任务推进、隐私/安全拒绝或信息不足追问默认不补表情包,避免影响信息传递

## 目录结构与配置

Expand Down
2 changes: 1 addition & 1 deletion docs/message-batching.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ allow_cancel_after_send = false
## 相关文件

- 实现:[src/Undefined/services/message_batcher/](src/Undefined/services/message_batcher/)
- 接入:[src/Undefined/services/ai_coordinator.py](src/Undefined/services/ai_coordinator.py) 中 `handle_auto_reply` / `handle_private_reply` / `_dispatch_grouped_request`
- 接入:[src/Undefined/services/coordinator/](src/Undefined/services/coordinator/) 中 `handle_auto_reply` / `handle_private_reply` / `_dispatch_grouped_request`
- 创建/注入:[src/Undefined/handlers/message_flow.py](src/Undefined/handlers/message_flow.py)
- 关停 flush:[src/Undefined/main.py](src/Undefined/main.py)
- 热更新:[src/Undefined/config/hot_reload.py](src/Undefined/config/hot_reload.py)
Expand Down
2 changes: 1 addition & 1 deletion docs/multi-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ features.pool_enabled ← 全局总开关(false 时完全不生效)
| `config/loader.py` | 解析 pool 配置,字段缺省继承主模型 |
| `ai/model_selector.py` | 纯选择逻辑:策略、偏好存储、compare 状态 |
| `services/model_pool.py` | 私聊交互服务:`/compare`、「选X」、`select_chat_config` |
| `services/ai_coordinator.py` | 持有 `ModelPoolService`,私聊队列投递时选模型 |
| `services/coordinator/` | 持有 `ModelPoolService`,私聊队列投递时选模型 |
| `handlers.py` | 私聊消息委托给 `model_pool.handle_private_message()` |
| `skills/agents/runner.py` | Agent 执行时调用 `model_selector.select_agent_config()` |
| `utils/queue_intervals.py` | 注册 pool 模型的队列间隔 |
6 changes: 4 additions & 2 deletions docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

## 运行顺序

1. `MessageHandler` 先并行执行消息预处理:附件收集、历史文本解析、昵称或群信息读取等。图片、文件等媒体会登记为附件 UID,并在 AI 可见正文中统一写作 `<attachment uid="..."/>`。
2. 用户消息先写入历史。
1. `MessageHandler` 先并行执行消息预处理:附件收集、历史文本解析、昵称或群信息读取等。图片、文件等媒体会登记为附件 UID,并在 AI 可见正文中统一写作 `<attachment uid="..."/>`;合并转发会登记为 `<forward uid="forward_xxx"/>`,不在实时 AI 输入中自动展开
2. 用户消息先写入历史。历史记录仍会递归展开合并转发文本,保持历史检索和旧行为兼容;实时 AI 输入只保留 forward UID,AI 需要查看时调用 `messages.get_forward_msg` 按层读取。
3. 若消息命中斜杠命令,立即分发命令并结束本轮后续流程;命令输入和命令输出会写入历史,供后续 AI 轮次读取。
4. 未命中命令时,`PipelineRegistry` 并行调用所有已注册管线的 `detect(context)`。
5. 对所有命中的管线,并行调用对应的 `process(detection, context)`。
Expand All @@ -16,6 +16,8 @@

命中自动处理管线的消息会继续进入 AI 自动回复,让 AI 基于用户消息和刚写入的自动处理结果判断后续行为。

合并转发里的图片仍会在后台递归扫描并进入表情包入库队列;该扫描不把转发文本或图片列表追加到实时 AI 上下文,避免大型转发树撑爆上下文。

## 内置 Bilibili 管线

Bilibili 自动提取管线命中 B 站链接、BV 号或 AV 号后,会发送一次外层合并转发,外层固定包含三个节点:视频信息、视频文件或视频状态、弹幕列表。
Expand Down
1 change: 1 addition & 0 deletions docs/python-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ from Undefined.api.app import RuntimeAPIServer
以下模块**不会**进入根包 re-export,也不保证跨版本兼容:

- `Undefined.main`, `Undefined.webui`, `Undefined.handlers`, `Undefined.onebot`
- `Undefined.services` 下的运行时编排模块;`AICoordinator` 的唯一内部导入路径是 `Undefined.services.coordinator`,旧路径 `Undefined.services.ai_coordinator` 已移除
- `Undefined.config.coercers`, `Undefined.config.model_parsers`
- `Undefined.utils.io`, `Undefined.utils.paths`

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Undefined 搭载了基于 ChromaDB 向量数据库的后台认知系统,无需
| `messages.send_text_file` | 将文本内容生成文件后发送 |
| `messages.send_url_file` | 下载指定 URL 的文件后发送 |
| `messages.send_group_sign` | 执行群签到操作 |
| `messages.get_forward_msg` | 获取合并转发消息的内容 |
| `messages.get_forward_msg` | 按层读取合并转发内容;支持 `<forward uid="forward_xxx"/>` 和旧合并转发 ID,可用 `offset`/`limit` 分页查看更多 |

---

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "Undefined-bot"
version = "3.6.1"
version = "3.6.2"
description = "QQ bot platform with cognitive memory architecture and multi-agent Skills, via OneBot V11."
readme = "README.md"
authors = [
Expand Down
Loading
Loading