From 123093b9c066cc0067fd09a1e98668b62b721bbe Mon Sep 17 00:00:00 2001 From: Will Li Date: Mon, 4 Aug 2025 09:45:48 -0700 Subject: [PATCH] Apply small suggestions from code review Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- src/i18n/locales/zh-TW/tools.json | 2 +- src/integrations/misc/read-partial-content.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/locales/zh-TW/tools.json b/src/i18n/locales/zh-TW/tools.json index 4a27b04090..6daecf2b1e 100644 --- a/src/i18n/locales/zh-TW/tools.json +++ b/src/i18n/locales/zh-TW/tools.json @@ -7,7 +7,7 @@ "imageTooLarge": "圖片檔案過大 ({{size}} MB)。允許的最大大小為 {{max}} MB。", "imageWithSize": "圖片檔案 ({{size}} KB)", "partialReadSingleLine": "已讀取此單行檔案中 {{totalCharacters}} 個字元中的 {{charactersRead}} 個字元 ({{percentRead}}%)。這是部分讀取 - 由於內容限制,無法存取剩餘內容。", - "partialReadMultiLine": "已讀取 {{totalCharacters}} 個字元中的 {{charactersRead}} 個字元 ({{percentRead}}%),讀取到第 {{lastLineRead}} 行,共 {{totalLines}} 行。要讀取此檔案的特定部分,請使用以下格式:\n\n\n \n {{path}}\n start-end\n \n\n\n\n例如,要讀取第 {{nextLineStart}}-{{suggestedLineEnd}} 行:\n\n\n \n {{path}}\n {{nextLineStart}}-{{suggestedLineEnd}}\n \n\n" + "partialReadMultiLine": "已讀取 {{totalCharacters}} 個字元中的 {{charactersRead}} 個字元 ({{percentRead}}%),讀取到第 {{lastLineRead}} 行,共 {{totalLines}} 行。要讀取此檔案的特定部分,請使用以下格式:\n\n\n \n {{path}}\n 開始-結束\n \n\n\n\n例如,要讀取第 {{nextLineStart}}-{{suggestedLineEnd}} 行:\n\n\n \n {{path}}\n {{nextLineStart}}-{{suggestedLineEnd}}\n \n\n" }, "toolRepetitionLimitReached": "Roo 似乎陷入循環,反覆嘗試同一操作 ({{toolName}})。這可能表明目前策略存在問題。請考慮重新描述工作、提供更具體的指示或引導其嘗試不同的方法。", "codebaseSearch": { diff --git a/src/integrations/misc/read-partial-content.ts b/src/integrations/misc/read-partial-content.ts index e8db809982..f31624577c 100644 --- a/src/integrations/misc/read-partial-content.ts +++ b/src/integrations/misc/read-partial-content.ts @@ -47,7 +47,7 @@ export async function readPartialContent(filePath: string, maxChars: number): Pr encoding: "utf8", highWaterMark: 16 * 1024, // Smaller 16KB chunks for better control start: 0, - end: Math.max(0, Math.min(maxChars * 2, maxChars + 1024 * 1024)), // Read at most 2x maxChars or maxChars + 1MB buffer + end: Math.max(0, Math.min(maxChars * 2, maxChars + 1024 * 1024)), // Heuristic: read at most the lesser of (2x maxChars) or (maxChars + 1MB), but never less than 0, to balance memory use and ensure enough data for multi-byte chars }) let content = ""