> For AI agents: the complete documentation index is available at https://surowan.com/llms.txt, the full documentation bundle is available at https://surowan.com/llms-full.txt.

文档对应源码提交： [`55e5d96b5634`](https://github.com/tuuject/surowan/commit/55e5d96b56340db24cbc51dea010617b57b40d8b)。请先与自己的部署版本核对。

# 为不同 Chat 设置模型与范围

全局 `agent` 是默认值；`telegram.chats[]` 可以限制 Chat/Topic，并为某个 Chat 覆盖 Provider、模型和 thinking level。覆盖属于 Chat，因此同一 Chat 下的所有 Forum Topic 共用它。

## 用 JSONC 配置 Chat

以下是局部片段（不是完整配置）：

```jsonc
{
  "telegram": {
    "chats": [
      {
        "id": -1001234567890,
        "topic_ids": [100, 200],
        "provider": "gateway",
        "model": "replace-with-your-text-and-image-model",
        "thinking_level": "off",
        "instructions_file": "prompts/group.md",
        "participation": { "active_windows": [] }
      },
      {
        "id": -1009876543210,
        "instructions_file": "prompts/social.md",
        "participation": {
          "active_windows": [{ "start": "18:00", "end": "23:00" }]
        }
      }
    ]
  }
}
```

模型引用沿用[完整示例](https://surowan.com/docs/configure/models.md)，请换成你已注册的真实模型。准备好两个附加指令文件。第一个群仅在被直接叫到或命中触发条件后打开注意力窗口；第二个群沿用全局模型，在晚间活跃。

不写 `topic_ids` 表示允许该 Chat 的普通消息和所有 Topic；写入后只允许列出的正整数 Topic。`provider` 与 `model` 必须成对出现，模型必须在该 Provider 的 `models` 中存在并支持 text。只写 `thinking_level` 则表示沿用全局模型、单独覆盖思考级别。

## 用 Admin Panel 编辑

1. 打开 **Chats**，确认当前配置文件 revision。
2. 新增或编辑 Chat，填写 Chat ID、Topic ID 列表和需要的模型设置。
3. 保存后查看反馈：模型/thinking 覆盖可热应用；新增/删除 Chat 或改变 Topic 范围需要重启。
4. 要恢复继承全局，清除该 Chat 的 Provider、模型和 thinking 覆盖。

全局模型请在 **模型 / Models** 页切换；全局切换不会覆盖已有 Chat 的局部模型。**供应商 / Providers** 页模型行的「用作 Agent」或模型页的切换都只改 `agent.*`。

## 何时生效

已有 Chat 的 `provider`、`model`、`thinking_level` 覆盖属于热更新，下一次 Invocation 使用新值。在 Admin **Chats** 里给某个 Chat 换模型时，如果该 Chat 有正在用旧模型的会话，面板会先弹窗确认：确认后这些会话立即终止，它们正在处理的那批消息不再回复、也不会重新处理，之前委派的任务不受影响，群友之后的消息马上由新模型处理；取消则什么都不保存。新模型直接沿用现有上下文，超出新模型能保留的范围时，下一次会话开始时自动重建。只改 thinking 不会终止任何会话。在群里用 `/model 序号` 或 `/model default` 切换时同样立即生效，但不弹确认：本群仍在用旧模型的会话直接终止，回执会说明终止了几个。只有手改配置文件后应用时，正在运行的 Invocation 才继续使用启动时快照。新增 Chat 同样热应用、立即生效；删除 Chat 与 Topic 范围修改后必须重启。配置文件没有 watcher，手改后要在 Settings 点击 **Apply config file**，再按面板提示重启。

## 如何确认

- 在 Admin **Chats** 查看 `Saved settings` 与 `Running settings` 是否一致。
- `/status` 显示当前 Chat 的生效模型。
- `/effort` 显示当前 Chat 生效模型接受的思考级别与当前级别（管理员），`/effort 级别` 只改这一项、`/effort default` 恢复继承全局。
- 在 Tool session 的 Model call 中确认 Provider、模型和 thinking level；不要只根据配置文件判断运行中的旧 Invocation。
- 运行 `check-config` 可提前发现 Chat 模型引用或 thinking level 不兼容。

## 常见误区

- Topic allowlist 只控制消息是否进入；Topic 不会获得独立的模型预算或 Chat 配置。
- Chat 覆盖按字段继承：没有覆盖的字段仍来自全局默认。
- 变更 Topic 范围不会删除旧消息、Context、Memo Pad 或审计历史。
- 不要把 Chat ID 转成浮点数；配置和管理面板都使用安全整数语义。

相关页面：[Telegram 与 Topic](https://surowan.com/docs/configure/telegram.md)、[模型](https://surowan.com/docs/configure/models.md)、[管理面板](https://surowan.com/docs/configure/admin.md)、[快速开始](https://surowan.com/docs/start/quick-start.md)。
