清理:移除全部注入型消息(会话上下文/附件系统通知/开始执行指令)

- 会话上下文:删 sessionContextContent/ensureSessionContext/loadHistoryForModel/modelDisplayName 及 bindToSession、runLoopInner、createSession 三处注入;存档/hasUserSince/hasPendingUser 去掉 session_context 特判;SSE 请求历史改用 loadHistory 直取;server.js prompt dump 去掉第 3 部分
- 附件通知:删 routes/messages.js 的 composeWithAttachments/fmtSize 与 POST 路由的 attachments 拼接,正文原样入库、content 必填;前端 send() 不再随 body 传 attachments,无文字时拦截并提示(附件仅上传任务目录);parseUploadNotice 保留兼容旧库行
- 开始执行:删 START_EXECUTION_MESSAGE、engine.startExecution、POST /:id/start 路由与导出(v2 前端本无入口)
- 注释与 README 同步清理
This commit is contained in:
2026-09-10 08:12:56 +08:00
parent 775d92eb67
commit 4051fcdd5c
8 changed files with 22 additions and 148 deletions
+7 -3
View File
@@ -532,7 +532,8 @@
});
// ---------- 消息渲染 ----------
// 服务端把附件说明拼在正文前(【系统通知】用户上传了文件:...),此处拆开单独展示 📎 行
// 旧消息兼容:早期服务端把附件说明拼在正文前(【系统通知】用户上传了文件:...),此处拆开单独展示 📎 行;
// 新版已不再生成这种行,仅历史会话渲染时命中。
function parseUploadNotice(content) {
const m = /^【系统通知】用户上传了文件:([^\n]*)(?:\n([\s\S]*))?$/.exec(content || '');
if (!m) return { text: content || '', files: null };
@@ -1409,7 +1410,11 @@
async function send() {
const ta = $('msg-input');
const content = ta.value.trim();
if (!content && !state.attachments.length) return;
// 附件仅上传到任务目录,不再随正文拼通知行:没有文字就不发(避免产生空消息)。
if (!content) {
if (state.attachments.length) toast('附件需随一条文字消息发送');
return;
}
const pending = state.attachments.slice();
state.attachments = [];
@@ -1422,7 +1427,6 @@
let atts = [];
if (pending.length) atts = await uploadFiles(id, pending);
const body = { content, deepThink: !!state.deepThink };
if (atts.length) body.attachments = atts;
const sent = await req('POST', '/api/sessions/' + id + '/messages', body);
appendUserMsg(content, atts.map(a => a.name), sent && sent.message_id);