Apply small suggestions from code review

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
Will Li 2025-08-04 09:45:48 -07:00 committed by GitHub
parent 22850158fa
commit 123093b9c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -7,7 +7,7 @@
"imageTooLarge": "圖片檔案過大 ({{size}} MB)。允許的最大大小為 {{max}} MB。",
"imageWithSize": "圖片檔案 ({{size}} KB)",
"partialReadSingleLine": "已讀取此單行檔案中 {{totalCharacters}} 個字元中的 {{charactersRead}} 個字元 ({{percentRead}}%)。這是部分讀取 - 由於內容限制,無法存取剩餘內容。",
"partialReadMultiLine": "已讀取 {{totalCharacters}} 個字元中的 {{charactersRead}} 個字元 ({{percentRead}}%),讀取到第 {{lastLineRead}} 行,共 {{totalLines}} 行。要讀取此檔案的特定部分,請使用以下格式:\n<read_file>\n<args>\n <file>\n <path>{{path}}</path>\n <line_range>start-end</line_range>\n </file>\n</args>\n</read_file>\n\n例如要讀取第 {{nextLineStart}}-{{suggestedLineEnd}} 行:\n<read_file>\n<args>\n <file>\n <path>{{path}}</path>\n <line_range>{{nextLineStart}}-{{suggestedLineEnd}}</line_range>\n </file>\n</args>\n</read_file>"
"partialReadMultiLine": "已讀取 {{totalCharacters}} 個字元中的 {{charactersRead}} 個字元 ({{percentRead}}%),讀取到第 {{lastLineRead}} 行,共 {{totalLines}} 行。要讀取此檔案的特定部分,請使用以下格式:\n<read_file>\n<args>\n <file>\n <path>{{path}}</path>\n <line_range>開始-結束</line_range>\n </file>\n</args>\n</read_file>\n\n例如要讀取第 {{nextLineStart}}-{{suggestedLineEnd}} 行:\n<read_file>\n<args>\n <file>\n <path>{{path}}</path>\n <line_range>{{nextLineStart}}-{{suggestedLineEnd}}</line_range>\n </file>\n</args>\n</read_file>"
},
"toolRepetitionLimitReached": "Roo 似乎陷入循環,反覆嘗試同一操作 ({{toolName}})。這可能表明目前策略存在問題。請考慮重新描述工作、提供更具體的指示或引導其嘗試不同的方法。",
"codebaseSearch": {

View file

@ -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 = ""