From b6345b4409a17e122627577c82f13b5e98251411 Mon Sep 17 00:00:00 2001 From: cc-dan Date: Sat, 14 Mar 2026 05:06:16 +0000 Subject: [PATCH] =?UTF-8?q?refine:=20=E9=80=9A=E7=9F=A5=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=B4=B9=E7=94=A8=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/server.js b/server.js index 844e43d..23b593c 100644 --- a/server.js +++ b/server.js @@ -238,8 +238,6 @@ async function buildNotifyContent(entry, session, completionError, contextLimitE const agent = entry.agent || 'claude'; const agentLabel = agent === 'codex' ? 'Codex' : 'Claude'; const hasTools = (entry.toolCalls || []).length > 0; - const cost = entry.lastCost ? `$${entry.lastCost.toFixed(4)}` : ''; - const costLine = cost ? `费用: ${cost}` : ''; // Determine notify title let notifyTitle; @@ -255,7 +253,7 @@ async function buildNotifyContent(entry, session, completionError, contextLimitE // Context limit: fixed message, no AI if (contextLimitExceeded) { - return { title: notifyTitle, content: `${agentLabel} 会话上下文已达上限,已自动触发压缩。\n会话: ${title}${costLine ? '\n' + costLine : ''}` }; + return { title: notifyTitle, content: `${agentLabel} 会话上下文已达上限,已自动触发压缩。\n会话: ${title}` }; } // Check if summary is enabled and applicable @@ -265,9 +263,7 @@ async function buildNotifyContent(entry, session, completionError, contextLimitE if (!summaryEnabled) { // Fallback: simple content - const respLen = (entry.fullText || '').length; - const lines = [`会话: ${title}`, `字数: ${respLen}`]; - if (costLine) lines.push(costLine); + const lines = [`会话: ${title}`]; if (completionError) lines.push(`错误: ${completionError.slice(0, 200)}`); return { title: notifyTitle, content: lines.join('\n') }; } @@ -275,9 +271,7 @@ async function buildNotifyContent(entry, session, completionError, contextLimitE const creds = getSummaryApiCredentials(summaryCfg); if (!creds) { // No credentials — fallback - const respLen = (entry.fullText || '').length; - const lines = [`会话: ${title}`, `字数: ${respLen}`]; - if (costLine) lines.push(costLine); + const lines = [`会话: ${title}`]; if (completionError) lines.push(`错误: ${completionError.slice(0, 200)}`); return { title: notifyTitle, content: lines.join('\n') }; } @@ -293,12 +287,9 @@ async function buildNotifyContent(entry, session, completionError, contextLimitE let bodyText; if (result.ok && result.text) { bodyText = result.text; - if (costLine) bodyText += '\n\n' + costLine; } else { // Fallback on API failure - const respLen = (entry.fullText || '').length; - const lines = [`会话: ${title}`, `字数: ${respLen}`]; - if (costLine) lines.push(costLine); + const lines = [`会话: ${title}`]; if (completionError) lines.push(`错误: ${completionError.slice(0, 200)}`); if (!result.ok) lines.push('(摘要生成失败,以上为原始信息)'); bodyText = lines.join('\n');