新增 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
+3
View File
@@ -47,6 +47,9 @@ router.get('/status', wrap((req, res) => {
port: cfg.port,
auth_enabled: !!(cfg.auth && cfg.auth.users && cfg.auth.users.length),
running_sessions: engine.activeRuns(),
// 可用的 prompt+tools 组合名(config.yml 顶层 model_profiles):前端模式选择器据此渲染;
// 切换 = 发消息时带 profile 参数(见 routes/messages.js),纯内存选择,不碰配置不重启。
model_profiles: Object.keys((engine.getConfig() || {}).model_profiles || {}),
// 前端上传预处理参数(大图压缩阈值/尺寸/质量、大文件确认阈值),避免前端写死
upload: cfg.upload || {},
});