Skip to content

Commit 22b2e50

Browse files
committed
use real context window size
1 parent af0d2f3 commit 22b2e50

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/mentions/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ async function getFileOrFolderContent(mentionPath: string, cwd: string): Promise
156156
if (isBinary) {
157157
return "(Binary file, unable to display content)"
158158
}
159-
const content = await extractTextFromFile(absPath, 128_000) // Use standard context window size
159+
const contextWindow = this.api.getModel().info.contextWindow || 128_000
160+
const content = await extractTextFromFile(absPath, contextWindow)
160161
return content
161162
} else if (stats.isDirectory()) {
162163
const entries = await fs.readdir(absPath, { withFileTypes: true })
@@ -177,7 +178,8 @@ async function getFileOrFolderContent(mentionPath: string, cwd: string): Promise
177178
if (isBinary) {
178179
return undefined
179180
}
180-
const content = await extractTextFromFile(absoluteFilePath, 128_000) // Use standard context window size
181+
const contextWindow = this.api.getModel().info.contextWindow || 128_000
182+
const content = await extractTextFromFile(absoluteFilePath, contextWindow)
181183
return `<file_content path="${filePath.toPosix()}">\n${content}\n</file_content>`
182184
} catch (error) {
183185
return undefined

0 commit comments

Comments
 (0)