会话阶段状态机advising/executing(单会话单问题:先聊清再干活):新建会话与「清空」落advising——resolveProfileName两档化(phase=advising强制命中内置advising组合,否则随模型配置profile,tools_allow只留read_file/fetch/write_file、不带skill故模板无技能清单段,配advising-system.txt:问答判意图引导澄清、每轮至多1-2问防过度追问);唯一出口是任务书正门——runLoopInner工具批跑完后,advising回合内write_file/edit_file成功落任务目录根task.md(argsHitTaskBrief,上传同名与terminal间接创建不算;批量末尾统一切,防父assistant先存档后落库回执成孤儿行被上游拒收)即enterExecuting:全史标archived+插type=task_brief磁盘快照行作执行阶段唯一上下文起点+phase翻转与SSE phase广播,下一迭代重读历史重解profile天然切默认组合、同回合开工(幂等:执行中再改task.md只是普通编辑);回头路只有清空(archiveTaskBrief把旧task.md mv进.task-history/task-<ts>.md防污染新规划,点目录沿用.imgcache隐式约定);压缩对phase中性(压完回原模式,task_brief不豁免存档,漂移可控因压缩本就用户主导);定时投递前强制executing(无人值守不能被顾问话术卡住);db迁移存量phase回填executing零打扰、sessions.profile列废弃不读写;运行期手动切profile全拆(消息级参数/bind的profile分支/setSessionProfile与hasModelProfile/status的model_profiles名单/bind弹窗模式区),头部徽标机位复用为阶段徽标(仅advising显灯泡,SSE phase驱动,转执行toast反馈)
This commit is contained in:
@@ -21,13 +21,7 @@ router.post('/:id/messages', wrap((req, res) => {
|
||||
if (!content) return res.status(400).json({ error: 'content 不能为空' });
|
||||
// deepThink:是否启用模型该「深度思考」参数(thinking_params 合并进上游请求体)
|
||||
const deepThink = !!(req.body && req.body.deepThink);
|
||||
// profile:本轮 prompt+tools 组合(config.yml 顶层 model_profiles 的名字;保留值 'default' = 显式全量(仍受全局 tools_deny 屏蔽);
|
||||
// 不传 = 随模型配置的 profile)。名字不存在直接 400 打回,不静默回退(难排查)。
|
||||
const profile = String((req.body && req.body.profile) || '').trim();
|
||||
if (profile && profile !== 'default' && !engine.hasModelProfile(profile)) {
|
||||
return res.status(400).json({ error: 'profile 不存在:' + profile + '(可选:' + Object.keys(engine.getConfig().model_profiles || {}).join(', ') + ')' });
|
||||
}
|
||||
const r = engine.postUserMessage(req.params.id, content, { deepThink, profile });
|
||||
const r = engine.postUserMessage(req.params.id, content, { deepThink });
|
||||
log.info('msg', (req.user || '-') + ' ' + req.params.id + ' 用户消息(' + (r && r.delivered || '?') + '):' +
|
||||
content.slice(0, 60).replace(/\s+/g, ' '));
|
||||
res.json(r);
|
||||
|
||||
Reference in New Issue
Block a user