@peterwangze/claude-trigger-router 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -177
- package/config/trigger.advanced.yaml +16 -20
- package/dist/cli.js +1282 -341
- package/dist/cli.js.map +4 -4
- package/package.json +74 -74
package/README.md
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
# Claude Trigger Router
|
|
2
2
|
|
|
3
|
-
Claude Code
|
|
3
|
+
Claude Trigger Router 是给 Claude Code 用的本地路由代理。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
你可以把它理解成 Claude Code 和上游模型之间的一层本地服务:Claude Code 仍然照常使用,但请求会先经过 `ctr`,再按你的配置转发到 OpenAI、Anthropic、OpenRouter、DeepSeek 或其他 OpenAI-compatible 接口。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
7
|
+
它适合这些场景:
|
|
8
|
+
|
|
9
|
+
- 想用统一配置管理多个模型和供应商
|
|
10
|
+
- 想让日常任务走便宜/快的模型,复杂任务自动切到更强模型
|
|
11
|
+
- 想在 Claude Code 外层增加配置校验、健康检查、治理观测和 UI 工作台
|
|
12
|
+
- 想从 `claude-code-router` 迁移到更清晰的 `Models + Router` 配置心智
|
|
13
|
+
|
|
14
|
+
## 功能概览
|
|
15
|
+
|
|
16
|
+
- **本地代理服务**:默认监听 `127.0.0.1:5678`,接管 Claude Code 上游请求。
|
|
17
|
+
- **统一模型配置**:用 `Models[]` 描述模型接入项,路由直接引用 `Models[].id`。
|
|
18
|
+
- **协议兼容**:支持 `openai` / `anthropic` 两类接口协议,OpenRouter、DeepSeek 等 OpenAI-compatible 服务按 `openai` 配。
|
|
19
|
+
- **基础路由**:用 `Router.default`、`Router.think`、`Router.longContext` 等槽位指定不同任务的默认模型。
|
|
20
|
+
- **SmartRouter**:先用显式规则命中高确定性任务,也可以在规则未命中时让路由模型从候选模型中自动选择。
|
|
21
|
+
- **Governance 观测**:记录 trace、metrics、异常摘要,帮助你理解路由选择和运行状态。
|
|
22
|
+
- **doctor 诊断**:检查配置、服务可启动性、模型兼容策略和可选模型探测。
|
|
23
|
+
- **UI 工作台**:`ctr ui` 打开本地页面,查看配置草稿、compiled models、capability warnings、治理 trace 和 metrics。
|
|
24
|
+
- **远程状态基础**:可配置 `Runtime.remote_service`,通过 `/api/remote-status` 查看远程服务健康、compiled model 摘要和治理告警摘要。默认用户不需要配置远程模式。
|
|
10
25
|
|
|
11
26
|
## 安装
|
|
12
27
|
|
|
@@ -14,44 +29,62 @@ Claude Code 的本地路由代理。
|
|
|
14
29
|
npm install -g @peterwangze/claude-trigger-router
|
|
15
30
|
```
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
安装后确认命令可用:
|
|
18
33
|
|
|
19
34
|
```bash
|
|
20
35
|
ctr version
|
|
21
36
|
ctr help
|
|
22
37
|
```
|
|
23
38
|
|
|
24
|
-
##
|
|
39
|
+
## 5 分钟跑起来
|
|
25
40
|
|
|
26
|
-
|
|
41
|
+
首次使用最推荐走交互式 setup:
|
|
27
42
|
|
|
28
43
|
```bash
|
|
29
44
|
ctr setup
|
|
30
45
|
```
|
|
31
46
|
|
|
32
|
-
`ctr setup`
|
|
47
|
+
`ctr setup` 会自动处理:
|
|
33
48
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
49
|
+
- 复用已有 `~/.claude-trigger-router/config.yaml`
|
|
50
|
+
- 探测并迁移旧 `claude-code-router` 配置
|
|
51
|
+
- 在没有可用配置时创建最小可用配置
|
|
52
|
+
- 引导填写默认模型 ID、接口地址、API Key 和模型名
|
|
53
|
+
- 可选追加复杂任务模型,并生成 SmartRouter 起步模板
|
|
37
54
|
- 保存配置后启动本地服务
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
完成后按这个顺序使用:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
ctr status
|
|
60
|
+
ctr code
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`ctr code` 会带着本地代理环境启动 Claude Code。之后你在 Claude Code 里的请求会经过 Trigger Router。
|
|
40
64
|
|
|
41
|
-
##
|
|
65
|
+
## 手动配置
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
如果你更喜欢手动编辑,可以先生成模板:
|
|
44
68
|
|
|
45
69
|
```bash
|
|
46
70
|
ctr init --force
|
|
47
71
|
```
|
|
48
72
|
|
|
49
|
-
|
|
73
|
+
配置文件位置:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
~/.claude-trigger-router/config.yaml
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
最小可用配置如下:
|
|
50
80
|
|
|
51
81
|
```yaml
|
|
52
82
|
HOST: "127.0.0.1"
|
|
53
83
|
PORT: 5678
|
|
54
84
|
|
|
85
|
+
LOG: true
|
|
86
|
+
LOG_LEVEL: "debug"
|
|
87
|
+
|
|
55
88
|
Models:
|
|
56
89
|
- id: sonnet
|
|
57
90
|
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
@@ -64,36 +97,48 @@ Router:
|
|
|
64
97
|
default: "sonnet"
|
|
65
98
|
```
|
|
66
99
|
|
|
67
|
-
|
|
100
|
+
你第一次通常只需要改:
|
|
68
101
|
|
|
69
|
-
-
|
|
70
|
-
- `Models[0]
|
|
71
|
-
- `
|
|
72
|
-
-
|
|
102
|
+
- `Models[0].api`:上游接口地址
|
|
103
|
+
- `Models[0].key`:API Key
|
|
104
|
+
- `Models[0].interface`:接口协议,通常是 `openai` 或 `anthropic`
|
|
105
|
+
- `Models[0].model`:上游真实模型名
|
|
106
|
+
- `Router.default`:默认使用哪个 `Models[].id`
|
|
73
107
|
|
|
74
|
-
|
|
108
|
+
改完后启动:
|
|
75
109
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
110
|
+
```bash
|
|
111
|
+
ctr start
|
|
112
|
+
ctr code
|
|
113
|
+
```
|
|
80
114
|
|
|
81
|
-
|
|
115
|
+
后台运行:
|
|
82
116
|
|
|
83
|
-
|
|
117
|
+
```bash
|
|
118
|
+
ctr start --daemon
|
|
119
|
+
ctr status
|
|
120
|
+
ctr code
|
|
121
|
+
```
|
|
84
122
|
|
|
85
|
-
`
|
|
123
|
+
## `interface` 怎么选
|
|
124
|
+
|
|
125
|
+
`interface` 表示上游接口协议,不是厂商名。
|
|
86
126
|
|
|
87
|
-
|
|
127
|
+
常见写法:
|
|
88
128
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
129
|
+
| 服务 | interface |
|
|
130
|
+
|---|---|
|
|
131
|
+
| OpenAI 官方 | `openai` |
|
|
132
|
+
| Anthropic 官方 | `anthropic` |
|
|
133
|
+
| OpenRouter | `openai` |
|
|
134
|
+
| DeepSeek | `openai` |
|
|
135
|
+
| 其他 OpenAI-compatible 服务 | `openai` |
|
|
93
136
|
|
|
94
|
-
|
|
137
|
+
路由层会负责请求格式转换,你不需要自己按不同供应商手写消息体。
|
|
95
138
|
|
|
96
|
-
|
|
139
|
+
## 配多个模型
|
|
140
|
+
|
|
141
|
+
每个 `Models[]` 项都是一个可被路由引用的模型接入项:
|
|
97
142
|
|
|
98
143
|
```yaml
|
|
99
144
|
Models:
|
|
@@ -103,16 +148,29 @@ Models:
|
|
|
103
148
|
interface: "openai"
|
|
104
149
|
model: "anthropic/claude-sonnet-4"
|
|
105
150
|
|
|
106
|
-
- id:
|
|
107
|
-
api: "https://
|
|
151
|
+
- id: reasoner
|
|
152
|
+
api: "https://api.deepseek.com/chat/completions"
|
|
108
153
|
key: "sk-xxx"
|
|
109
154
|
interface: "openai"
|
|
110
|
-
model: "
|
|
155
|
+
model: "deepseek-reasoner"
|
|
156
|
+
thinking: "high"
|
|
157
|
+
|
|
158
|
+
Router:
|
|
159
|
+
default: "sonnet"
|
|
160
|
+
think: "reasoner"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
推荐所有路由字段都引用 `Models[].id`,比如上面的 `sonnet`、`reasoner`。
|
|
164
|
+
|
|
165
|
+
## 显式规则路由
|
|
111
166
|
|
|
167
|
+
适合能用关键词稳定识别的任务,例如架构设计、代码审查、长文档评审。
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
112
170
|
Router:
|
|
113
171
|
default: "sonnet"
|
|
114
172
|
|
|
115
|
-
|
|
173
|
+
SmartRouter:
|
|
116
174
|
enabled: true
|
|
117
175
|
analysis_scope: "last_message"
|
|
118
176
|
rules:
|
|
@@ -122,47 +180,16 @@ TriggerRouter:
|
|
|
122
180
|
patterns:
|
|
123
181
|
- type: exact
|
|
124
182
|
keywords: ["架构设计", "system design"]
|
|
125
|
-
model: "
|
|
183
|
+
model: "reasoner"
|
|
126
184
|
```
|
|
127
185
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- 默认请求走 `Router.default`
|
|
131
|
-
- 命中 TriggerRouter 规则的请求,优先切到规则指定模型
|
|
132
|
-
|
|
133
|
-
## SmartRouter:候选模型自动选择
|
|
134
|
-
|
|
135
|
-
`SmartRouter` 是当前产品的另一个核心功能。
|
|
136
|
-
|
|
137
|
-
它适合“规则难以穷举,但模型选择仍然很重要”的任务:
|
|
138
|
-
|
|
139
|
-
- 通用编程 vs 深度推理
|
|
140
|
-
- 日常修复 vs 架构设计
|
|
141
|
-
- 常规回答 vs 长上下文分析
|
|
186
|
+
规则命中时优先使用规则指定模型;没命中时回到 `Router.default`。
|
|
142
187
|
|
|
143
|
-
|
|
188
|
+
## 智能模型选择
|
|
144
189
|
|
|
145
|
-
|
|
190
|
+
如果任务边界比较模糊,可以让 SmartRouter 用一个路由模型从候选模型中选择:
|
|
146
191
|
|
|
147
192
|
```yaml
|
|
148
|
-
Models:
|
|
149
|
-
- id: sonnet
|
|
150
|
-
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
151
|
-
key: "sk-xxx"
|
|
152
|
-
interface: "openai"
|
|
153
|
-
model: "anthropic/claude-sonnet-4"
|
|
154
|
-
|
|
155
|
-
- id: reasoner
|
|
156
|
-
api: "https://api.deepseek.com/chat/completions"
|
|
157
|
-
key: "sk-xxx"
|
|
158
|
-
interface: "openai"
|
|
159
|
-
model: "deepseek-reasoner"
|
|
160
|
-
thinking: "high"
|
|
161
|
-
|
|
162
|
-
Router:
|
|
163
|
-
default: "sonnet"
|
|
164
|
-
think: "reasoner"
|
|
165
|
-
|
|
166
193
|
SmartRouter:
|
|
167
194
|
enabled: true
|
|
168
195
|
router_model: "sonnet"
|
|
@@ -170,163 +197,157 @@ SmartRouter:
|
|
|
170
197
|
- model: "sonnet"
|
|
171
198
|
description: "通用编程、代码生成、日常调试"
|
|
172
199
|
- model: "reasoner"
|
|
173
|
-
description: "
|
|
200
|
+
description: "复杂推理、严谨分析、架构设计"
|
|
174
201
|
```
|
|
175
202
|
|
|
176
|
-
|
|
203
|
+
推荐心智:
|
|
177
204
|
|
|
178
|
-
-
|
|
179
|
-
- SmartRouter
|
|
205
|
+
- `Router.default` 负责默认去向
|
|
206
|
+
- `SmartRouter.rules` 负责高确定性任务
|
|
207
|
+
- `SmartRouter.candidates` 负责规则未命中时的智能兜底
|
|
180
208
|
|
|
181
|
-
|
|
209
|
+
## capability hint
|
|
182
210
|
|
|
183
|
-
|
|
184
|
-
- 再让 `SmartRouter` 处理剩余的模糊任务
|
|
211
|
+
如果你明确知道某个模型能力受限,可以配置 `metadata`:
|
|
185
212
|
|
|
186
|
-
|
|
213
|
+
```yaml
|
|
214
|
+
Models:
|
|
215
|
+
- id: text_only
|
|
216
|
+
api: "https://api.example.com/v1/chat/completions"
|
|
217
|
+
key: "sk-xxx"
|
|
218
|
+
interface: "openai"
|
|
219
|
+
model: "vendor/text-only"
|
|
220
|
+
metadata:
|
|
221
|
+
supports_reasoning: false
|
|
222
|
+
supports_tools: false
|
|
223
|
+
supports_images: false
|
|
224
|
+
```
|
|
187
225
|
|
|
188
|
-
|
|
226
|
+
当前行为:
|
|
189
227
|
|
|
190
|
-
|
|
228
|
+
- `supports_reasoning: false`:忽略 `thinking`
|
|
229
|
+
- `supports_tools: false`:工具调用退化为文本表达
|
|
230
|
+
- `supports_images: false`:图片输入退化为文本描述
|
|
191
231
|
|
|
192
|
-
|
|
193
|
-
- Anthropic 官方:`interface: anthropic`
|
|
194
|
-
- OpenRouter:`interface: openai`
|
|
195
|
-
- DeepSeek 兼容接口:`interface: openai`
|
|
196
|
-
- 其他 OpenAI-compatible 服务:`interface: openai`
|
|
232
|
+
不确定时可以先不配,等主路径跑通后再补。
|
|
197
233
|
|
|
198
|
-
##
|
|
234
|
+
## UI 工作台
|
|
199
235
|
|
|
200
|
-
|
|
236
|
+
启动服务后运行:
|
|
201
237
|
|
|
202
238
|
```bash
|
|
203
|
-
ctr
|
|
204
|
-
ctr init
|
|
239
|
+
ctr ui
|
|
205
240
|
```
|
|
206
241
|
|
|
207
|
-
|
|
242
|
+
默认打开:
|
|
208
243
|
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
ctr start --daemon
|
|
212
|
-
ctr status
|
|
213
|
-
ctr restart
|
|
214
|
-
ctr restart --daemon
|
|
215
|
-
ctr stop
|
|
244
|
+
```text
|
|
245
|
+
http://127.0.0.1:5678/ui
|
|
216
246
|
```
|
|
217
247
|
|
|
218
|
-
|
|
248
|
+
当前 UI 分成两层:
|
|
249
|
+
|
|
250
|
+
- **使用者工作台**:查看和编辑配置草稿、模型、路由、compiled preview 和保存结果。
|
|
251
|
+
- **维护者工作台**:查看 Governance trace、metrics、异常阈值、快照和归档。
|
|
252
|
+
|
|
253
|
+
如果服务没有启动,`ctr ui` 会提示先运行:
|
|
219
254
|
|
|
220
255
|
```bash
|
|
221
|
-
ctr
|
|
256
|
+
ctr start
|
|
222
257
|
```
|
|
223
258
|
|
|
224
|
-
|
|
259
|
+
或:
|
|
225
260
|
|
|
226
261
|
```bash
|
|
227
|
-
ctr
|
|
228
|
-
ctr upgrade
|
|
229
|
-
ctr doctor
|
|
230
|
-
ctr ui
|
|
262
|
+
ctr start --daemon
|
|
231
263
|
```
|
|
232
264
|
|
|
233
|
-
## doctor
|
|
265
|
+
## doctor 诊断
|
|
234
266
|
|
|
235
|
-
|
|
267
|
+
配置不确定、服务起不来、模型不可用、迁移后想体检,都可以运行:
|
|
236
268
|
|
|
237
269
|
```bash
|
|
238
270
|
ctr doctor
|
|
239
271
|
```
|
|
240
272
|
|
|
241
|
-
|
|
273
|
+
它会检查:
|
|
242
274
|
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
-
|
|
247
|
-
-
|
|
248
|
-
-
|
|
275
|
+
- 配置文件是否存在或能否解析
|
|
276
|
+
- 缺失字段和低风险结构问题
|
|
277
|
+
- 配置是否能通过本地校验
|
|
278
|
+
- 服务是否可启动
|
|
279
|
+
- 模型兼容策略和请求编译方式
|
|
280
|
+
- capability hint 可能触发的运行时降级
|
|
281
|
+
- 在你确认后,对模型发送最小探测请求
|
|
249
282
|
|
|
250
|
-
|
|
283
|
+
模型探测会消耗少量额度,所以 doctor 会先征求确认。
|
|
251
284
|
|
|
252
|
-
##
|
|
285
|
+
## 远程服务状态
|
|
253
286
|
|
|
254
|
-
|
|
287
|
+
默认情况下,你只需要本地模式,不需要配置远程服务。
|
|
255
288
|
|
|
256
|
-
|
|
257
|
-
ctr help
|
|
258
|
-
ctr version
|
|
259
|
-
ctr setup
|
|
260
|
-
ctr status
|
|
261
|
-
ctr code
|
|
262
|
-
```
|
|
289
|
+
如果你已经有一个远程 Trigger Router 服务,可以在本地配置远程目标:
|
|
263
290
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
291
|
+
```yaml
|
|
292
|
+
Runtime:
|
|
293
|
+
mode: "local"
|
|
294
|
+
remote_service:
|
|
295
|
+
enabled: true
|
|
296
|
+
base_url: "https://router.example.com"
|
|
297
|
+
auth_token: "${CTR_REMOTE_AUTH_TOKEN}"
|
|
298
|
+
|
|
299
|
+
Router: {}
|
|
270
300
|
```
|
|
271
301
|
|
|
272
|
-
|
|
302
|
+
启用后,服务状态接口会返回远程健康、compiled model 摘要和治理告警摘要:
|
|
273
303
|
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
ctr status
|
|
277
|
-
ctr ui
|
|
278
|
-
ctr code
|
|
304
|
+
```text
|
|
305
|
+
GET /api/remote-status
|
|
279
306
|
```
|
|
280
307
|
|
|
281
|
-
|
|
308
|
+
这条能力当前作为远程接入基础 contract 提供;首次使用仍建议从本地 `ctr setup -> ctr start -> ctr code` 开始。
|
|
282
309
|
|
|
283
|
-
|
|
284
|
-
- `ctr restart --daemon` 只是更显式的等价写法
|
|
285
|
-
|
|
286
|
-
## 旧配置迁移
|
|
287
|
-
|
|
288
|
-
如果你之前在用 `claude-code-router`:
|
|
289
|
-
|
|
290
|
-
- `ctr setup` 会自动探测旧配置
|
|
291
|
-
- 会优先提供迁移选项
|
|
292
|
-
- 迁移后的新配置会落到 `~/.claude-trigger-router/config.yaml`
|
|
293
|
-
|
|
294
|
-
当前推荐的新配置心智是:
|
|
310
|
+
## 常用命令
|
|
295
311
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
312
|
+
| 命令 | 用途 |
|
|
313
|
+
|---|---|
|
|
314
|
+
| `ctr setup` | 首次配置、复用、迁移、修复配置 |
|
|
315
|
+
| `ctr init --force` | 生成最小配置模板 |
|
|
316
|
+
| `ctr start` | 前台启动本地服务 |
|
|
317
|
+
| `ctr start --daemon` | 后台启动本地服务 |
|
|
318
|
+
| `ctr status` | 查看服务状态 |
|
|
319
|
+
| `ctr restart` | 重启服务,默认按后台模式 |
|
|
320
|
+
| `ctr stop` | 停止服务 |
|
|
321
|
+
| `ctr code` | 带 Trigger Router 环境启动 Claude Code |
|
|
322
|
+
| `ctr doctor` | 配置和服务诊断 |
|
|
323
|
+
| `ctr ui` | 打开本地 UI 工作台 |
|
|
324
|
+
| `ctr version` | 查看版本 |
|
|
325
|
+
| `ctr upgrade` | 升级 |
|
|
299
326
|
|
|
300
|
-
##
|
|
327
|
+
## 旧配置迁移
|
|
301
328
|
|
|
302
|
-
|
|
329
|
+
如果你之前使用 `claude-code-router`:
|
|
303
330
|
|
|
304
331
|
```bash
|
|
305
|
-
ctr
|
|
332
|
+
ctr setup
|
|
306
333
|
```
|
|
307
334
|
|
|
308
|
-
|
|
335
|
+
setup 会自动探测旧配置,并优先提供迁移选项。迁移后的配置会写入:
|
|
309
336
|
|
|
310
337
|
```text
|
|
311
|
-
|
|
338
|
+
~/.claude-trigger-router/config.yaml
|
|
312
339
|
```
|
|
313
340
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
它适合做配置查看和调试,但主线入口仍然建议优先使用 `ctr setup`。
|
|
317
|
-
|
|
318
|
-
## 示例配置
|
|
319
|
-
|
|
320
|
-
最小示例:
|
|
321
|
-
|
|
322
|
-
- `config/trigger.example.yaml`
|
|
323
|
-
|
|
324
|
-
完整高级示例:
|
|
341
|
+
迁移后的推荐心智是:
|
|
325
342
|
|
|
326
|
-
- `
|
|
343
|
+
- 每个模型写成一个 `Models[]` 项
|
|
344
|
+
- 路由引用 `Models[].id`
|
|
345
|
+
- 少写旧式 `provider,model`
|
|
327
346
|
|
|
328
|
-
|
|
347
|
+
## 更多示例和文档
|
|
329
348
|
|
|
330
|
-
-
|
|
331
|
-
-
|
|
332
|
-
-
|
|
349
|
+
- 最小示例:`config/trigger.example.yaml`
|
|
350
|
+
- 高级示例:`config/trigger.advanced.yaml`
|
|
351
|
+
- 配置细节:`docs/configuration-guide.md`
|
|
352
|
+
- Models 迁移:`docs/models-migration-guide.md`
|
|
353
|
+
- 发布验证:`docs/releasing.md`
|
|
@@ -55,11 +55,10 @@ Router:
|
|
|
55
55
|
longContextThreshold: 60000
|
|
56
56
|
webSearch: "sonnet"
|
|
57
57
|
|
|
58
|
-
# 3)
|
|
59
|
-
|
|
58
|
+
# 3) SmartRouter:统一路由入口。先走高确定性规则,再用候选模型智能兜底
|
|
59
|
+
SmartRouter:
|
|
60
60
|
enabled: true
|
|
61
61
|
analysis_scope: "last_message"
|
|
62
|
-
llm_intent_recognition: false
|
|
63
62
|
rules:
|
|
64
63
|
- name: "architecture"
|
|
65
64
|
priority: 90
|
|
@@ -121,9 +120,6 @@ TriggerRouter:
|
|
|
121
120
|
- "simple"
|
|
122
121
|
model: "ollama_qwen"
|
|
123
122
|
|
|
124
|
-
# 4) SmartRouter:规则没命中时,从候选模型中自动挑选
|
|
125
|
-
SmartRouter:
|
|
126
|
-
enabled: true
|
|
127
123
|
router_model: "sonnet"
|
|
128
124
|
candidates:
|
|
129
125
|
- model: "sonnet"
|
|
@@ -139,10 +135,6 @@ SmartRouter:
|
|
|
139
135
|
max_tokens: 256
|
|
140
136
|
fallback: "default"
|
|
141
137
|
|
|
142
|
-
# 5) Governance:治理模块也直接引用 model id
|
|
143
|
-
Governance:
|
|
144
|
-
enabled: true
|
|
145
|
-
|
|
146
138
|
sticky:
|
|
147
139
|
enabled: true
|
|
148
140
|
session_ttl_ms: 3600000
|
|
@@ -153,6 +145,19 @@ Governance:
|
|
|
153
145
|
summarizer_model: "sonnet"
|
|
154
146
|
max_summary_tokens: 256
|
|
155
147
|
|
|
148
|
+
semantic:
|
|
149
|
+
enabled: true
|
|
150
|
+
mode: "embedding"
|
|
151
|
+
threshold: 0.2
|
|
152
|
+
prototypes:
|
|
153
|
+
architecture: "重构 系统 结构 模块 拆分 架构 设计"
|
|
154
|
+
code_review: "代码 审查 风险 评审 review"
|
|
155
|
+
complex_reasoning: "复杂 推理 分析 严谨 逻辑 reasoning"
|
|
156
|
+
|
|
157
|
+
# 4) Governance:保留响应治理、级联与观测能力;semantic / sticky 已归入 SmartRouter
|
|
158
|
+
Governance:
|
|
159
|
+
enabled: true
|
|
160
|
+
|
|
156
161
|
cascade:
|
|
157
162
|
enabled: true
|
|
158
163
|
max_attempts: 2
|
|
@@ -168,15 +173,6 @@ Governance:
|
|
|
168
173
|
to: "opus"
|
|
169
174
|
reasoning: "high"
|
|
170
175
|
|
|
171
|
-
semantic:
|
|
172
|
-
enabled: true
|
|
173
|
-
mode: "embedding"
|
|
174
|
-
threshold: 0.2
|
|
175
|
-
prototypes:
|
|
176
|
-
architecture: "重构 系统 结构 模块 拆分 架构 设计"
|
|
177
|
-
code_review: "代码 审查 风险 评审 review"
|
|
178
|
-
complex_reasoning: "复杂 推理 分析 严谨 逻辑 reasoning"
|
|
179
|
-
|
|
180
176
|
shadow:
|
|
181
177
|
enabled: true
|
|
182
178
|
mode: "async_audit"
|
|
@@ -199,7 +195,7 @@ Governance:
|
|
|
199
195
|
spike_warn_rate: 0.5
|
|
200
196
|
spike_delta_rate: 0.3
|
|
201
197
|
|
|
202
|
-
#
|
|
198
|
+
# 5) Legacy 兼容:旧 `Providers` 仅作为兼容层保留,不建议新配置继续扩展
|
|
203
199
|
# Providers:
|
|
204
200
|
# - name: openrouter
|
|
205
201
|
# api_base_url: "https://openrouter.ai/api/v1/chat/completions"
|