From e1abdac0b6efa0d61a67fb645fcc0dfad208b48d Mon Sep 17 00:00:00 2001 From: kicer Date: Tue, 29 Sep 2026 17:43:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(schedule):=20get=20=E7=9A=84=20prompt=20?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=88=AA=E6=96=AD=E2=80=94=E2=80=94=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E8=AF=A6=E6=83=85=E5=B0=B1=E6=98=AF=20get=20=E7=9A=84?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=84=8F=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上笔自相矛盾:get 定位全量详情,却把 prompt 裁到 160 字。上下文污染防线本就在 写入侧(scheduler PROMPT_MAX_LEN=2 万硬帽,create/update 时已拒),读取侧再截 只剩副作用:用户问「任务具体让我干嘛」AI 拿不全。改 prompt= 原样输出(多行保真, 不压空白);last_note 仍 160 截断(设计即短句人话说明,防御性帽无实害)。 --- app/server/tools/executor.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/server/tools/executor.js b/app/server/tools/executor.js index 3f79cf5..5b5fc9b 100644 --- a/app/server/tools/executor.js +++ b/app/server/tools/executor.js @@ -898,7 +898,7 @@ async function toolMintPublicLink(ctx, args) { // id 省略/'0' = 本会话(兼容旧调用);跨会话操作带 op=list 里看到的 id,同用户校验—— // 用户不切会话,AI 代办一切。create 只落当前会话(定时即下班,建完本会话收口退位成专柜)。 // 回执只给事实,零教学(怎么做写在 schema description 里,不每次复读): -// 列表/详情用编号条目 + key=value 分行,时间 ISO+08:00,prompt 截断;写操单一行短确认。 +// list 紧凑索引/get 全量详情(编号条目 + key=value 分行,时间 ISO+08:00);写操单一行短确认。 // list 紧凑索引:认任务、看状态够用(name/last_note/prompt 等细节归 get) function schedEntry(t, idx) { return [ @@ -909,7 +909,8 @@ function schedEntry(t, idx) { t.last_run_at ? 'last=' + scheduler.fmtIso(t.last_run_at) + ' last_status=' + (t.last_status || '-') : 'last=尚未执行', ].join('\n'); } -// get 详情:索引之上补 name(会话标题)、brief、last_note、prompt(截断防污染上下文)——全量字段只在这出现 +// get 详情:索引之上补 name(会话标题)、last_note、prompt(原样全量——写入侧已有 2 万字硬帽, +// 读取侧再截就废了 get 的存在意义)——详情字段只在这出现 function schedDetail(t) { const clip = s => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > 160 ? s.slice(0, 160) + '…' : s; }; const lines = ['id=' + t.session_id + (t.current ? '(本会话)' : '')]; @@ -920,7 +921,7 @@ function schedDetail(t) { if (t.last_run_at) lines.push('last=' + scheduler.fmtIso(t.last_run_at) + ' last_status=' + (t.last_status || '-')); else lines.push('last=尚未执行'); if (t.last_note) lines.push('last_note=' + clip(t.last_note)); - if (t.prompt) lines.push('prompt="' + clip(t.prompt) + '"'); + if (t.prompt) lines.push('prompt=' + t.prompt); return lines.join('\n'); } function toolScheduleTask(ctx, args) {