From 09113dc0e16baa90881163ebf23221b5aed41c2a Mon Sep 17 00:00:00 2001 From: qer Date: Thu, 11 Jun 2026 02:53:24 +0800 Subject: [PATCH] feat(kimi-web): temporarily hide turn-summary Comment out turnSummary display in both mobile and desktop templates, along with helper functions (countToolsAndFiles, extractFilePath). Keep the code intact with TODO markers for restoration. --- apps/kimi-web/src/components/ChatPane.vue | 83 ++++++++++++----------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/apps/kimi-web/src/components/ChatPane.vue b/apps/kimi-web/src/components/ChatPane.vue index 8d2455bbf..a75dcfd0d 100644 --- a/apps/kimi-web/src/components/ChatPane.vue +++ b/apps/kimi-web/src/components/ChatPane.vue @@ -150,45 +150,48 @@ function turnBlocks(turn: ChatTurn): TurnBlock[] { return blocks; } -/** Extract a file path from a tool argument string (JSON or plain). */ -function extractFilePath(arg: string): string | undefined { - try { - const d = JSON.parse(arg) as Record; - const p = - (typeof d.path === 'string' ? d.path : undefined) ?? - (typeof d.file_path === 'string' ? d.file_path : undefined) ?? - (typeof d.filePath === 'string' ? d.filePath : undefined) ?? - (typeof d.filename === 'string' ? d.filename : undefined) ?? - (typeof d.dir === 'string' ? d.dir : undefined) ?? - (typeof d.directory === 'string' ? d.directory : undefined) ?? - (typeof d.cwd === 'string' ? d.cwd : undefined); - return p ? p.split('/').pop() ?? p : undefined; - } catch { - return undefined; - } -} +/** Extract a file path from a tool argument string (JSON or plain). + TODO: temporarily unused with turn-summary hidden. */ +// function extractFilePath(arg: string): string | undefined { +// try { +// const d = JSON.parse(arg) as Record; +// const p = +// (typeof d.path === 'string' ? d.path : undefined) ?? +// (typeof d.file_path === 'string' ? d.file_path : undefined) ?? +// (typeof d.filePath === 'string' ? d.filePath : undefined) ?? +// (typeof d.filename === 'string' ? d.filename : undefined) ?? +// (typeof d.dir === 'string' ? d.dir : undefined) ?? +// (typeof d.directory === 'string' ? d.directory : undefined) ?? +// (typeof d.cwd === 'string' ? d.cwd : undefined); +// return p ? p.split('/').pop() ?? p : undefined; +// } catch { +// return undefined; +// } +// } -/** Count tools and unique files touched in a turn. */ -function countToolsAndFiles(turn: ChatTurn): { toolCount: number; fileCount: number } { - let toolCount = 0; - const filePaths = new Set(); - for (const blk of turnBlocks(turn)) { - if (blk.kind !== 'tool') continue; - toolCount++; - const path = extractFilePath(blk.tool.arg); - if (path) filePaths.add(path); - } - return { toolCount, fileCount: filePaths.size }; -} +/** Count tools and unique files touched in a turn. + TODO: temporarily unused with turn-summary hidden. */ +// function countToolsAndFiles(turn: ChatTurn): { toolCount: number; fileCount: number } { +// let toolCount = 0; +// const filePaths = new Set(); +// for (const blk of turnBlocks(turn)) { +// if (blk.kind !== 'tool') continue; +// toolCount++; +// const path = extractFilePath(blk.tool.arg); +// if (path) filePaths.add(path); +// } +// return { toolCount, fileCount: filePaths.size }; +// } -/** Turn-end summary: "已调用 3 个工具,修改 5 个文件". */ -function turnSummary(turn: ChatTurn): string { - const { toolCount, fileCount } = countToolsAndFiles(turn); - const parts: string[] = []; - if (toolCount > 0) parts.push(`已调用 ${toolCount} 个工具`); - if (fileCount > 0) parts.push(`修改 ${fileCount} 个文件`); - return parts.join(','); -} +/** Turn-end summary: "已调用 3 个工具,修改 5 个文件". + TODO: temporarily hidden — uncomment when turn-summary UI is ready. */ +// function turnSummary(turn: ChatTurn): string { +// const { toolCount, fileCount } = countToolsAndFiles(turn); +// const parts: string[] = []; +// if (toolCount > 0) parts.push(`已调用 ${toolCount} 个工具`); +// if (fileCount > 0) parts.push(`修改 ${fileCount} 个文件`); +// return parts.join(','); +// } +