修复 smoke 全部过时用例并顺带修两处真 bug:messages 路由丢失 attachments(纯附件消息被 400、【系统通知】不再拼入),api_key/password 脱敏正则误伤空串值("" 变 ***");smoke 适配新建即 held 预留语义与平台名/模型id 唯一键;process.exit 改 exitCode 防跳过 finally 残留 mock/server 占端口;测试配置隔离 data_root;68/68 全过

This commit is contained in:
2026-09-06 08:21:49 +08:00
parent 548ce651f6
commit 120726b7fe
4 changed files with 31 additions and 20 deletions
+7 -3
View File
@@ -37,12 +37,16 @@ function composeWithAttachments(content, attachments) {
router.post('/:id/messages', wrap((req, res) => {
const content = String((req.body && req.body.content) || '').trim();
if (!content) return res.status(400).json({ error: 'content 不能为空' });
// 附件告知:正文前拼【系统通知】行(见 composeWithAttachments 注释);纯附件消息(无正文)也合法。
const attachments = Array.isArray(req.body && req.body.attachments) && (req.body.attachments || []).length
? req.body.attachments : null;
const full = composeWithAttachments(content, attachments);
if (!full) return res.status(400).json({ error: 'content 与 attachments 不能同时为空' });
// deepThink:是否启用模型该「深度思考」参数(thinking_params 合并进上游请求体)
const deepThink = !!(req.body && req.body.deepThink);
const r = engine.postUserMessage(req.params.id, content, { deepThink });
const r = engine.postUserMessage(req.params.id, full, { deepThink });
log.info('msg', (req.user || '-') + ' ' + req.params.id + ' 用户消息(' + (r && r.delivered || '?') + '):' +
content.slice(0, 60).replace(/\s+/g, ' '));
full.slice(0, 60).replace(/\s+/g, ' '));
res.json(r);
}));