新增 model_profiles:小模型的 prompt+tools 组合白名单

- 顶层 model_profiles 定义多套组合 {tools_allow?, system_prompt_file?},platforms 里的模型用 profile: <名> 引用(同 id 跨平台复用);引用不存在/文件缺失/空壳组合直接校验报错
- tools_allow 按最终工具名(内置 + MCP,含 server__ 前缀)过滤发给模型的 tools;名单外工具被调用不拦,executor 全表照跑
- system_prompt_file 相对 server/templates/,配置加载时一次读入常驻内存;设了即完全接管(不拼技能段),语言后缀照拼
- 运行期动态切换:发消息带 profile 参数(同 deepThink 约定,每迭代取 run 最新值),纯内存选择、不碰 config.yml;'default'=显式全量,未知名 400
- 压缩回合跟随当前组合;prompt 缓存改 (profile,语言) 键;prompt.txt dump 每套组合各一段;/api/models 带 profile、/api/system/status 下发组合名供前端选择器
This commit is contained in:
2026-09-22 10:38:04 +08:00
parent af7bd69ed2
commit a9ec8f2741
9 changed files with 206 additions and 38 deletions
+10
View File
@@ -833,6 +833,16 @@ platforms:
models:
- id: ds3
display_name: "AMD DeepSeek 3"
# profile: mini # 选填,引用顶层 model_profiles 的 prompt+tools 组合(小模型省上下文用)
# 模型 profile(可选):预定义多套「system prompt 文件 + tools 白名单」组合,模型用 profile: <名>
# 引用(同 id 模型跳平台复用时免重复配置)。不配 profile 的模型照旧全量。动机:默认发给模型的
# 内置工具 schema + system prompt 约 6K token,特别小的模型会被撑爆上下文。
# 改后重启生效;运行期前端可在已定义组合间手动切换(发消息带 profile 参数,纯内存选择、不碰配置)。
# model_profiles:
# mini:
# tools_allow: [read_file, write_file, edit_file, list_directory, find_path, grep, terminal] # 白名单(内置名 + MCP 最终名)
# system_prompt_file: mini-system.txt # 相对 server/templates/ 的自定义 prompt
workspace_root: "/workspace/tasks"