mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-11 22:51:26 +00:00
feat: improve context budget truncation notice with total lines and continuation example
When files are truncated due to context budget limits, the truncation notice now includes: - Total number of lines in the file - The next line number to continue from - A concrete example of the line_range syntax This helps models understand why they received fewer lines than expected and how to continue reading. Addresses Issue #10239
This commit is contained in:
parent
78dc34498b
commit
5bf4eec3d8
1 changed files with 3 additions and 2 deletions
|
|
@ -547,8 +547,9 @@ export class ReadFileTool extends BaseTool<"read_file"> {
|
|||
content = addLineNumbers(result.content)
|
||||
|
||||
if (!result.complete) {
|
||||
// File was truncated
|
||||
const notice = `File truncated: showing ${result.lineCount} lines (${result.tokenCount} tokens) due to context budget. Use line_range to read specific sections.`
|
||||
// File was truncated due to context budget
|
||||
const nextLine = result.lineCount + 1
|
||||
const notice = `File truncated at line ${result.lineCount} of ${totalLines} total lines due to context budget (${result.tokenCount} tokens used). To continue reading, use the read_file tool again with line_range starting at line ${nextLine} (e.g., <line_range>${nextLine}-${Math.min(nextLine + 499, totalLines)}</line_range>)`
|
||||
const lineRangeAttr = result.lineCount > 0 ? ` lines="1-${result.lineCount}"` : ""
|
||||
xmlInfo =
|
||||
result.lineCount > 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue