From 55fe7d1024bb5834175c577688983f9577383846 Mon Sep 17 00:00:00 2001 From: Rick Ye Date: Tue, 8 Sep 2026 01:03:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=80=9D=E8=80=83/=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E5=AE=8C=E6=95=B4=E5=B1=95=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=9C=81=E7=95=A5=E5=8F=B7=E6=88=AA=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E8=BF=87=E9=95=BF=E5=8A=A0=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/renderer/src/components/Thinking.tsx | 6 ++-- .../src/renderer/src/components/ToolChips.tsx | 36 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/apps/desktop/src/renderer/src/components/Thinking.tsx b/apps/desktop/src/renderer/src/components/Thinking.tsx index d1e8f86..d52e03d 100644 --- a/apps/desktop/src/renderer/src/components/Thinking.tsx +++ b/apps/desktop/src/renderer/src/components/Thinking.tsx @@ -114,7 +114,7 @@ export function Thinking({
@@ -143,11 +143,11 @@ export function Thinking({ ) } -/** 思考文本 → 行数组(空行剔除,超长行截断) */ +/** 思考文本 → 行数组(空行剔除,内容不截断;过长由容器的滚动条承担) */ export function thinkingRows(text: string): { primary: string }[] { return text .split('\n') .map((l) => l.trim()) .filter(Boolean) - .map((line) => ({ primary: line.length > 300 ? `${line.slice(0, 300)}…` : line })) + .map((line) => ({ primary: line })) } diff --git a/apps/desktop/src/renderer/src/components/ToolChips.tsx b/apps/desktop/src/renderer/src/components/ToolChips.tsx index e7a1b3d..2972d3a 100644 --- a/apps/desktop/src/renderer/src/components/ToolChips.tsx +++ b/apps/desktop/src/renderer/src/components/ToolChips.tsx @@ -198,9 +198,13 @@ function buildRow(view: ToolCallView, dupIndex: number): ToolRow { ) const resultText = extractResultText(tool.result) if (resultText) { - const lines = resultText.split('\n').slice(0, 10) - for (const line of lines) detail.push({ text: line.slice(0, 160), tone: 'plain' }) - if (resultText.split('\n').length > 10) detail.push({ text: '…(结果已截断)', tone: 'plain' }) + // 完整输出,不逐行截断;过长由展开区的滚动条承担,仅在行数超限时兜底 + const lines = resultText.split('\n') + const maxLines = 400 + for (const line of lines.slice(0, maxLines)) detail.push({ text: line, tone: 'plain' }) + if (lines.length > maxLines) { + detail.push({ text: `…(共 ${lines.length} 行,已截断)`, tone: 'plain' }) + } } } const args = tool?.args ?? view.pendingApproval?.args @@ -237,7 +241,7 @@ function buildThinkingRows(texts: string[]): ToolRow[] { file: '', dir: '', chip: lines[0].length > 60 ? `${lines[0].slice(0, 60)}…` : lines[0], - detail: lines.slice(0, 12).map((line) => ({ text: line.slice(0, 160), tone: 'plain' as const })), + detail: lines.map((line) => ({ text: line, tone: 'plain' as const })), tool: undefined, pending: false }) @@ -336,22 +340,24 @@ export function ToolChips({ calls = [], thinking = [], className = '' }: { {row.icon !== 'think' && } - {/* 展开明细 */} + {/* 展开明细:完整内容不截断,过长时在滚动区里查看;收起时懒渲染不占 DOM */}
-
- {row.detail.map((line, lineIndex) => ( - - {line.text} - - ))} -
+ {rowOpen && ( +
+ {row.detail.map((line, lineIndex) => ( + + {line.text} + + ))} +
+ )}