diff --git a/README.md b/README.md index 64a86676..50773efb 100644 --- a/README.md +++ b/README.md @@ -218,16 +218,23 @@ The `run.sh` script will automatically: **Networking defaults:** `run.sh` starts the server with **`--https`** and the repo **`config.yaml`** (local self-signed TLS; better for many concurrent streams). Use **`./run.sh --http`** for plain HTTP. In production, set **`server.tls_cert_path`** / **`server.tls_key_path`** in **`config.yaml`** (see comments there). For manual runs, add **`--https`** or **`CYBERSTRIKE_HTTPS=1`**; if **`-config`** is wrong, the binary prints a short usage hint on stderr. **First-Time Configuration:** -1. **Configure OpenAI-compatible API** (required before first use) +1. **Configure AI channels** (required before first use) - After launch, open **`https://127.0.0.1:8080/`** (or **`https://localhost:8080/`**; replace **8080** with `server.port` in `config.yaml`) and accept the self-signed certificate warning once. If you used `./run.sh --http`, use **`http://`** instead. - - Go to `Settings` → Fill in your API credentials: + - Go to `System Settings` → `Basic Settings` → `AI Channel Configuration`, add or edit a channel, then fill in provider, Base URL, API key, model, and token limits. Click **Save changes**. The left channel list supports setting a default, copy, delete, and bulk probe. ```yaml - openai: - api_key: "${OPENAI_API_KEY}" - base_url: "https://api.openai.com/v1" # or https://api.deepseek.com/v1 - model: "gpt-4o" # or deepseek-chat, claude-3-opus, etc. + ai: + default_channel: openai-main + channels: + openai-main: + name: OpenAI Main + provider: openai_compatible + api_key: "${OPENAI_API_KEY}" + base_url: "https://api.openai.com/v1" # or https://api.deepseek.com/v1 + model: "gpt-4o" # or deepseek-chat, qwen3-max, etc. + max_total_tokens: 120000 + max_completion_tokens: 16384 ``` - - Or edit `config.yaml` directly before launching + - Or edit `config.yaml` directly before launching. `ai.default_channel` is used for new conversations and tasks that do not explicitly select a channel; the chat page can also select any saved channel per session. 2. **Login** - On first startup the console prints an auto-generated initial `admin` password; create accounts from **Platform permissions → User management** 3. **Install security tools (optional)** - Install tools from `tools/` as needed; missing tools are skipped or substituted at runtime. Common examples: @@ -281,19 +288,23 @@ Requirements / tips: ## Configuration -Use [`config.example.yaml`](config.example.yaml) as the authoritative configuration template and copy only the values required for your environment. At minimum, configure the server and an OpenAI-compatible model provider: +Use [`config.example.yaml`](config.example.yaml) as the authoritative configuration template and copy only the values required for your environment. At minimum, configure the server and one AI channel: ```yaml server: host: "127.0.0.1" port: 8080 -openai: - api_key: "${OPENAI_API_KEY}" - base_url: "https://api.openai.com/v1" - model: "your-model" +ai: + default_channel: openai-main + channels: + openai-main: + provider: openai_compatible + api_key: "${OPENAI_API_KEY}" + base_url: "https://api.openai.com/v1" + model: "your-model" ``` -Do not commit real credentials. Review the [configuration reference](docs/en-US/configuration.md), [recommended profiles](docs/en-US/configuration-profiles.md), and [security hardening guide](docs/en-US/security-hardening.md) before exposing the service beyond localhost. +`openai` is a backward-compatible runtime field; maintain new model settings in `ai.channels`. Do not commit real credentials. Review the [configuration reference](docs/en-US/configuration.md), [recommended profiles](docs/en-US/configuration-profiles.md), and [security hardening guide](docs/en-US/security-hardening.md) before exposing the service beyond localhost. ## Related documentation diff --git a/README_CN.md b/README_CN.md index aa0f01ad..75232b09 100644 --- a/README_CN.md +++ b/README_CN.md @@ -217,16 +217,23 @@ chmod +x run.sh && ./run.sh **网络默认:** `run.sh` 会以 **`--https`** 并传入项目根 **`config.yaml`** 启动(本机自签证书,多路流式场景更稳)。只要明文 HTTP 用 **`./run.sh --http`**。生产环境在 **`config.yaml`** 的 **`server.tls_cert_path` / `server.tls_key_path`** 配正式证书(见文件内注释)。手动启动可加 **`--https`** 或环境变量 **`CYBERSTRIKE_HTTPS=1`**;`-config` 写错时程序会在终端提示正确写法。 **首次配置:** -1. **配置 AI 模型 API**(首次使用前必填) +1. **配置 AI 通道**(首次使用前必填) - 启动后在浏览器打开 **`https://127.0.0.1:8080/`**(或 **`https://localhost:8080/`**;端口以 `config.yaml` 中 **`server.port`** 为准,默认 8080),并按提示信任自签证书。若使用 **`./run.sh --http`**,则改用 **`http://`** 访问。 - - 进入 `设置` → 填写 API 配置信息: + - 进入 `系统设置` → `基本设置` → `AI 通道配置`,新增或编辑通道,填写 API 提供商、Base URL、API Key、模型和 Token 上限,点击 **保存更改**。左侧通道列表支持设为默认、复制、删除和批量探活。 ```yaml - openai: - api_key: "${OPENAI_API_KEY}" - base_url: "https://api.openai.com/v1" # 或 https://api.deepseek.com/v1 - model: "gpt-4o" # 或 deepseek-chat, claude-3-opus 等 + ai: + default_channel: openai-main + channels: + openai-main: + name: OpenAI Main + provider: openai_compatible + api_key: "${OPENAI_API_KEY}" + base_url: "https://api.openai.com/v1" # 或 https://api.deepseek.com/v1 + model: "gpt-4o" # 或 deepseek-chat, qwen3-max 等 + max_total_tokens: 120000 + max_completion_tokens: 16384 ``` - - 或启动前直接编辑 `config.yaml` 文件 + - 或启动前直接编辑 `config.yaml` 文件。`ai.default_channel` 会作为新对话和未显式选择通道任务的默认模型;对话页也可以在会话设置里选择某个已保存通道。 2. **登录系统** - 首次启动时控制台会显示自动生成的 `admin` 初始密码;也可在「平台权限 → 用户管理」中创建账号 3. **安装安全工具(可选)** - 按需安装 `tools/` 目录中的工具;未安装的工具在执行时会自动跳过或改用替代方案。常用示例: @@ -279,19 +286,23 @@ go build -o cyberstrike-ai cmd/server/main.go ## 配置 -请以 [`config.example.yaml`](config.example.yaml) 作为权威配置模板,只复制当前环境需要的配置。最少需要配置服务监听地址和一个 OpenAI 兼容模型: +请以 [`config.example.yaml`](config.example.yaml) 作为权威配置模板,只复制当前环境需要的配置。最少需要配置服务监听地址和一个 AI 通道: ```yaml server: host: "127.0.0.1" port: 8080 -openai: - api_key: "${OPENAI_API_KEY}" - base_url: "https://api.openai.com/v1" - model: "your-model" +ai: + default_channel: openai-main + channels: + openai-main: + provider: openai_compatible + api_key: "${OPENAI_API_KEY}" + base_url: "https://api.openai.com/v1" + model: "your-model" ``` -不要提交真实凭证。将服务暴露到 localhost 之外前,请阅读[配置参考](docs/zh-CN/configuration.md)、[推荐配置画像](docs/zh-CN/configuration-profiles.md)和[安全加固指南](docs/zh-CN/security-hardening.md)。 +`openai` 是兼容旧版本的运行时字段,新配置优先维护 `ai.channels`。不要提交真实凭证。将服务暴露到 localhost 之外前,请阅读[配置参考](docs/zh-CN/configuration.md)、[推荐配置画像](docs/zh-CN/configuration-profiles.md)和[安全加固指南](docs/zh-CN/security-hardening.md)。 ## 相关文档 diff --git a/docs/en-US/VISION.md b/docs/en-US/VISION.md index a6509532..390161d8 100644 --- a/docs/en-US/VISION.md +++ b/docs/en-US/VISION.md @@ -21,7 +21,7 @@ vision: timeout_seconds: 60 ``` -Empty `api_key`, `base_url`, or `provider` inherits from `openai`. +Empty `api_key`, `base_url`, or `provider` inherits from the resolved default AI channel. ## Data Handling diff --git a/docs/en-US/api-reference.md b/docs/en-US/api-reference.md index 2f073828..d61a1ba4 100644 --- a/docs/en-US/api-reference.md +++ b/docs/en-US/api-reference.md @@ -45,6 +45,18 @@ Multi-agent: `orchestration` may be `deep`, `plan_execute`, or `supervisor`. +Common request body fields: + +| Field | Meaning | +| --- | --- | +| `message` | User message, required. | +| `conversationId` | Continue an existing conversation; empty creates a new one. | +| `projectId` | Project for a new conversation; empty may follow `config.project.default_project_id`. | +| `role` | Use a named role. | +| `aiChannelId` | Select a channel from `ai.channels`; empty follows `ai.default_channel`. | +| `reasoning` | Per-session reasoning override, controlled by the channel's `reasoning.allow_client_reasoning`. | +| `hitl` | Per-session human-in-the-loop settings. | + ## SSE Notes Streaming endpoints are long-lived. Clients should: diff --git a/docs/en-US/configuration.md b/docs/en-US/configuration.md index 4ef51d39..a2418843 100644 --- a/docs/en-US/configuration.md +++ b/docs/en-US/configuration.md @@ -16,11 +16,15 @@ server: # - https://trusted-integration.example auth: session_duration_hours: 12 -openai: - provider: openai - base_url: https://api.openai.com/v1 - api_key: sk-... - model: gpt-4.1 +ai: + default_channel: openai-main + channels: + openai-main: + name: OpenAI Main + provider: openai_compatible + base_url: https://api.openai.com/v1 + api_key: sk-... + model: gpt-4.1 agent: max_iterations: 12000 tool_timeout_minutes: 60 @@ -30,13 +34,64 @@ Change the initial `admin` password from the Web UI after first login. Use HTTPS Valid Chromium `chrome-extension://<32-character-extension-id>` origins are recognized automatically. The extension must still obtain host permission and authenticate with a password and Bearer token. `server.cors_allowed_origins` remains available as an exact allowlist for other trusted Web integrations; wildcards are not accepted, and changing it requires a restart. +## AI Channels + +`ai` is the recommended model configuration entry. In the Web UI, use **System Settings → Basic Settings → AI Channel Configuration**. Saving that form writes `ai.default_channel` and `ai.channels`. The legacy `openai` field remains as a backward-compatible runtime field; on load, CyberStrikeAI ensures a default channel exists and synchronizes the resolved `ai.default_channel` into runtime `openai`. + +```yaml +ai: + default_channel: openai-main + channels: + openai-main: + name: OpenAI Main + provider: openai_compatible + base_url: https://api.openai.com/v1 + api_key: sk-... + model: gpt-4.1 + max_total_tokens: 120000 + max_completion_tokens: 16384 + reasoning: + mode: on + effort: high + allow_client_reasoning: true + profile: openai_compat + claude-main: + name: Claude Main + provider: claude + base_url: https://api.anthropic.com/v1 + api_key: sk-ant-... + model: claude-sonnet-4-5 +``` + +| Field | Meaning | +| --- | --- | +| `ai.default_channel` | Default channel ID for new conversations and requests without an explicit channel. | +| `ai.channels.` | Channel config. IDs are normalized to lowercase letters, digits, and hyphens. | +| `name` | Display name in the Web UI; falls back to the ID. | +| `provider` | `openai_compatible` or `claude`. OpenAI-compatible channels map to runtime `openai`; Claude channels bridge to Anthropic Messages API. | +| `base_url/api_key/model` | Required. Base URL usually includes a version path such as `/v1`. | +| `max_total_tokens` | Shared context budget for compression, attack-chain generation, multi-agent summaries, and similar paths. | +| `max_completion_tokens` | Per-response output cap; default is used when empty. | +| `reasoning` | Default reasoning fields for the channel. Gateway support varies; try `mode: off` first when a provider rejects requests. | + +The chat page reads saved channels into the “AI Channel” selector. A non-empty request `aiChannelId` selects a channel for that run/session without sending API credentials through the prompt path. Empty `aiChannelId` follows `ai.default_channel`. + +Common Web UI operations: + +- Add: click `+`, fill required fields, then save. +- Set default: select a channel, click **Set as default**, then save/apply. +- Copy: duplicate the current form, useful for the same provider with a different model. +- Delete: keep at least one channel; the default channel is protected from bulk delete. +- Probe: use **Test connection** or **Bulk probe** to validate API key, Base URL, and model. + ## Hot-Apply Boundaries `POST /api/config/apply` coordinates model config, tool description mode, MCP tool registration, knowledge components, robot restarts, and C2 runtime reconciliation. It does not make every field instantly effective. | Section | Usually hot-applies | Extra action | | --- | --- | --- | -| `openai` | new requests use new model settings | running streams keep their current state | +| `ai.default_channel` / `ai.channels` | new requests use the resolved default or selected channel | running streams keep their current state; reload config for the frontend channel list | +| `openai` | compatibility field, usually synchronized from the default AI channel | prefer maintaining new config in `ai.channels` | | `agent.max_iterations` | new tasks | existing tasks continue | | `hitl.tool_whitelist` | new approval checks | pending approvals are not re-decided | | `knowledge.enabled` | initializes/updates components | scan and index are still required | @@ -47,8 +102,8 @@ Valid Chromium `chrome-extension://<32-character-extension-id>` origins are reco ## Fallback Relationships -- `vision.api_key/base_url/provider` can inherit from `openai`. -- `hitl.audit_model` can inherit from `openai`. +- `vision.api_key/base_url/provider` can inherit from the resolved default AI channel. +- `hitl.audit_model` can inherit from the resolved default AI channel. - `knowledge.embedding.base_url/api_key` can inherit from model settings. - rerank config can inherit from embedding/openai. - `database.knowledge_db_path` can be separate or reuse the main DB. diff --git a/docs/en-US/deployment.md b/docs/en-US/deployment.md index 48d1195e..cbfb8ee1 100644 --- a/docs/en-US/deployment.md +++ b/docs/en-US/deployment.md @@ -10,7 +10,7 @@ CyberStrikeAI can run as a local testing tool, an internal team service, or a pr - Python for some MCP servers and tool scripts. - SQLite files under `data/`; no external DB is required by default. - Actual security tools installed in PATH. YAML files under `tools/` only describe commands. -- An OpenAI-compatible model endpoint, or `openai.provider: claude` for the Claude bridge. +- At least one `ai.channels` entry. Use `provider: openai_compatible` for OpenAI-compatible endpoints, or `provider: claude` for the Claude bridge. Important persistent paths: diff --git a/docs/en-US/hitl-best-practices.md b/docs/en-US/hitl-best-practices.md index 7a12f3b8..baf4f18b 100644 --- a/docs/en-US/hitl-best-practices.md +++ b/docs/en-US/hitl-best-practices.md @@ -23,12 +23,12 @@ hitl: provider: "" base_url: "" api_key: "" - model: "" # set a small model here; blank reuses openai.model + model: "" # set a small model here; blank reuses the default AI channel model retention_days: 90 tool_whitelist: [read_file, list_dir, glob, grep, tool_search] ``` -`audit_model` supports partial configuration. Empty fields inherit from the main `openai` config, so the common setup is to fill only `model` and run approvals on a cheaper small model. +`audit_model` supports partial configuration. Empty fields inherit from the resolved default AI channel, so the common setup is to fill only `model` and run approvals on a cheaper small model. ## Recommended Approval Strategy diff --git a/docs/en-US/troubleshooting.md b/docs/en-US/troubleshooting.md index c5e1881c..a39ec081 100644 --- a/docs/en-US/troubleshooting.md +++ b/docs/en-US/troubleshooting.md @@ -56,10 +56,11 @@ Output `1` means that the row was updated. The command requires `sqlite3` and `h Model fails: -- wrong `base_url` path; +- selected AI channel does not exist; empty selection follows `ai.default_channel`; +- wrong `ai.channels..base_url` path; - invalid API key; - model unavailable; -- reasoning fields unsupported by gateway. Try `openai.reasoning.mode: off`. +- reasoning fields unsupported by gateway. Try `ai.channels..reasoning.mode: off`. Streaming stalls: diff --git a/docs/zh-CN/VISION.md b/docs/zh-CN/VISION.md index e7107b40..49652015 100644 --- a/docs/zh-CN/VISION.md +++ b/docs/zh-CN/VISION.md @@ -12,9 +12,9 @@ vision: enabled: true model: qwen-vl-max # 必填 - api_key: # 留空 → openai.api_key - base_url: # 留空 → openai.base_url - provider: # 留空 → openai.provider + api_key: # 留空 → 默认 AI 通道 api_key + base_url: # 留空 → 默认 AI 通道 base_url + provider: # 留空 → 默认 AI 通道 provider max_image_bytes: 5242880 max_dimension: 2048 jpeg_quality: 82 @@ -28,7 +28,7 @@ vision: ## Web 设置 -**系统设置 → 基本设置 → 视觉分析(analyze_image)** 可配置启用开关、视觉模型、API Key/Base URL(留空复用 OpenAI)、预处理参数;**保存并应用** 后写入 `config.yaml` 并重新注册 MCP 工具。 +**系统设置 → 基本设置 → 视觉分析(analyze_image)** 可配置启用开关、视觉模型、API Key/Base URL(留空复用默认 AI 通道)、预处理参数;**保存并应用** 后写入 `config.yaml` 并重新注册 MCP 工具。 ## 路径 diff --git a/docs/zh-CN/api-reference.md b/docs/zh-CN/api-reference.md index 5ddf7546..be3e844c 100644 --- a/docs/zh-CN/api-reference.md +++ b/docs/zh-CN/api-reference.md @@ -52,6 +52,18 @@ Content-Type: application/json - `plan_execute` - `supervisor` +常用请求体字段: + +| 字段 | 说明 | +| --- | --- | +| `message` | 用户消息,必填。 | +| `conversationId` | 继续已有对话;为空时创建新对话。 | +| `projectId` | 新对话绑定项目;为空时可跟随 `config.project.default_project_id`。 | +| `role` | 使用指定角色。 | +| `aiChannelId` | 选择 `ai.channels` 中的通道 ID;为空时使用 `ai.default_channel`。 | +| `reasoning` | 会话级推理覆盖,受通道 `reasoning.allow_client_reasoning` 控制。 | +| `hitl` | 会话级人机协同配置。 | + 对话管理: - `POST /api/conversations` diff --git a/docs/zh-CN/configuration.md b/docs/zh-CN/configuration.md index 08b8d23f..e6b28f17 100644 --- a/docs/zh-CN/configuration.md +++ b/docs/zh-CN/configuration.md @@ -29,26 +29,57 @@ log: - `auth.session_duration_hours`:登录会话有效期(小时)。登录密码由 RBAC 用户管理,首次启动时在控制台输出 `admin` 初始密码。 - `log.output`:可以是 `stdout`、`stderr` 或文件路径。 -## 模型配置 +## AI 通道与模型配置 ```yaml -openai: - provider: openai - base_url: https://api.openai.com/v1 - api_key: sk-... - model: gpt-4.1 - max_total_tokens: 120000 - reasoning: - mode: on - effort: high - allow_client_reasoning: true - profile: openai_compat +ai: + default_channel: openai-main + channels: + openai-main: + name: OpenAI Main + provider: openai_compatible + base_url: https://api.openai.com/v1 + api_key: sk-... + model: gpt-4.1 + max_total_tokens: 120000 + max_completion_tokens: 16384 + reasoning: + mode: on + effort: high + allow_client_reasoning: true + profile: openai_compat + claude-main: + name: Claude Main + provider: claude + base_url: https://api.anthropic.com/v1 + api_key: sk-ant-... + model: claude-sonnet-4-5 ``` -- `provider`:`openai` 表示 OpenAI 兼容接口;`claude` 会桥接到 Anthropic Claude Messages API。 -- `base_url/api_key/model`:主模型配置。 -- `max_total_tokens`:上下文压缩、攻击链构建、多代理摘要等共用的总预算。 -- `reasoning`:控制推理扩展字段。不同网关支持差异较大,异常时先尝试 `mode: off`。 +`ai` 是推荐的模型配置入口。系统设置页对应路径是 **系统设置 → 基本设置 → AI 通道配置**,保存后写入 `ai.default_channel` 和 `ai.channels`。旧版 `openai` 字段仍保留为兼容运行时字段;加载配置时会确保至少有一个默认通道,并把 `ai.default_channel` 解析后的配置同步到运行时 `openai`。 + +通道字段: + +| 字段 | 说明 | +| --- | --- | +| `ai.default_channel` | 默认通道 ID。新对话、机器人、批量任务和未显式选择通道的请求使用它。 | +| `ai.channels.` | 通道配置。ID 会归一化为小写、数字和短横线,例如 `Qwen_Max` 会变成 `qwen-max`。 | +| `name` | Web UI 展示名。留空时使用通道 ID。 | +| `provider` | `openai_compatible` 或 `claude`。`openai_compatible` 会在运行时映射为 `openai`;`claude` 会桥接到 Anthropic Messages API。 | +| `base_url/api_key/model` | 必填。Base URL 通常需要包含版本路径,如 OpenAI/兼容网关的 `/v1`。 | +| `max_total_tokens` | 上下文压缩、攻击链构建、多代理摘要等共用的总预算。 | +| `max_completion_tokens` | 单次模型输出上限;未填时使用默认值。 | +| `reasoning` | 该通道的默认推理扩展字段。不同网关支持差异较大,异常时先尝试 `mode: off`。 | + +对话页的“AI 通道”下拉框会读取已保存通道。请求体中的 `aiChannelId` 非空时仅对本次/本会话运行配置生效,不会把 API Key 发送给模型;为空时跟随 `ai.default_channel`。 + +常用操作: + +- 新增:点击左侧 `+`,填写必填字段后保存。 +- 设默认:选中通道后点击“设为默认”,保存并应用后新请求生效。 +- 复制:以当前表单内容创建副本,适合为同一服务商配置不同模型。 +- 删除:默认通道不能作为批量删除目标;删除后需保留至少一个通道。 +- 探活:单通道“测试连接”或左侧“批量探活”会调用模型测试接口,适合验证 Key、Base URL 和模型名。 ## Agent @@ -213,7 +244,8 @@ project: | 配置段 | 应用后通常立即生效 | 需要额外动作 | | --- | --- | --- | -| `openai` | 新请求使用新模型配置 | 旧的流式请求不会被强制切换 | +| `ai.default_channel` / `ai.channels` | 新请求使用解析后的默认或选定通道 | 旧的流式请求不会被强制切换;前端通道列表需要重新读取配置 | +| `openai` | 兼容字段;通常由默认 AI 通道同步 | 新配置优先维护 `ai.channels` | | `agent.max_iterations` | 新 Agent 任务生效 | 已运行任务按启动时状态继续 | | `security.tool_description_mode` | 工具重新暴露时生效 | 模型已有上下文不会回滚 | | `hitl.tool_whitelist` | 新工具调用审批判断生效 | 已挂起审批不自动重判 | @@ -228,7 +260,7 @@ project: 几个字段有“留空复用”的关系: - `vision.api_key/base_url/provider` 留空时复用 `openai`。 -- `hitl.audit_model` 留空时复用 `openai`。 +- `hitl.audit_model` 留空时复用默认 AI 通道解析后的 `openai`。 - `knowledge.embedding.base_url/api_key` 留空时复用主模型或 embedding 默认配置。 - `knowledge.retrieval.rerank.base_url/api_key` 留空时复用 embedding/openai。 - `database.knowledge_db_path` 留空时可以复用主会话数据库,但独立文件更利于备份。 diff --git a/docs/zh-CN/deployment.md b/docs/zh-CN/deployment.md index a3fa7ce3..997f9461 100644 --- a/docs/zh-CN/deployment.md +++ b/docs/zh-CN/deployment.md @@ -10,7 +10,7 @@ - Python:部分 MCP 服务或工具脚本需要 Python 运行环境。 - SQLite:默认使用文件型数据库,无需单独服务。 - 安全工具:`tools/` 中的 YAML 只是工具定义,实际命令如 `nmap`、`sqlmap`、`nuclei` 仍需安装到系统 PATH。 -- 模型服务:需要 OpenAI 兼容 API,或配置 `openai.provider: claude` 走 Claude 桥接。 +- 模型服务:至少配置一个 `ai.channels` 通道;`provider: openai_compatible` 适用于 OpenAI 兼容 API,`provider: claude` 会走 Claude 桥接。 建议目录: diff --git a/docs/zh-CN/hitl-best-practices.md b/docs/zh-CN/hitl-best-practices.md index e113cf06..90c496ef 100644 --- a/docs/zh-CN/hitl-best-practices.md +++ b/docs/zh-CN/hitl-best-practices.md @@ -23,12 +23,12 @@ hitl: provider: "" base_url: "" api_key: "" - model: "" # 可填小模型;留空复用 openai.model + model: "" # 可填小模型;留空复用默认 AI 通道的模型 retention_days: 90 tool_whitelist: [read_file, list_dir, glob, grep, tool_search] ``` -`audit_model` 的字段可以只填一部分。空字段会自动继承主 `openai` 配置,因此常见做法是只填 `model`,让审计 Agent 使用更便宜的小模型。 +`audit_model` 的字段可以只填一部分。空字段会自动继承默认 AI 通道解析后的模型配置,因此常见做法是只填 `model`,让审计 Agent 使用更便宜的小模型。 ## 推荐审批策略 diff --git a/docs/zh-CN/troubleshooting.md b/docs/zh-CN/troubleshooting.md index 3bd9c82b..fab4e23f 100644 --- a/docs/zh-CN/troubleshooting.md +++ b/docs/zh-CN/troubleshooting.md @@ -44,17 +44,20 @@ HASH=$(htpasswd -nBC 10 '' | cut -d: -f2 | tr -d '\n') && sqlite3 data/conversat 检查: -- `openai.base_url` 是否包含正确路径,如 `/v1`。 -- `openai.api_key` 是否有效。 -- `openai.model` 是否存在。 -- 服务商是否支持当前 `reasoning` 字段。 +- 当前对话选择的 AI 通道是否存在;为空时会使用 `ai.default_channel`。 +- `ai.channels..base_url` 是否包含正确路径,如 `/v1`。 +- `ai.channels..api_key` 是否有效。 +- `ai.channels..model` 是否存在。 +- 服务商是否支持当前通道的 `reasoning` 字段。 可在系统设置中使用模型测试。若网关报 400,先尝试: ```yaml -openai: - reasoning: - mode: off +ai: + channels: + your-channel: + reasoning: + mode: off ``` ## 流式输出中断