@@ -42,7 +42,7 @@ export async function parseMentions(
4242 text : string ,
4343 cwd : string ,
4444 urlContentFetcher : UrlContentFetcher ,
45- api : { getModel : ( ) => { info : { contextWindow ?: number } } } ,
45+ contextWindow ?: number ,
4646) : Promise < string > {
4747 const mentions : Set < string > = new Set ( )
4848 let parsedText = text . replace ( mentionRegexGlobal , ( match , mention ) => {
@@ -95,7 +95,7 @@ export async function parseMentions(
9595 } else if ( mention . startsWith ( "/" ) ) {
9696 const mentionPath = mention . slice ( 1 )
9797 try {
98- const content = await getFileOrFolderContent ( mentionPath , cwd , api )
98+ const content = await getFileOrFolderContent ( mentionPath , cwd , contextWindow )
9999 if ( mention . endsWith ( "/" ) ) {
100100 parsedText += `\n\n<folder_content path="${ mentionPath } ">\n${ content } \n</folder_content>`
101101 } else {
@@ -150,11 +150,7 @@ export async function parseMentions(
150150 return parsedText
151151}
152152
153- async function getFileOrFolderContent (
154- mentionPath : string ,
155- cwd : string ,
156- api : { getModel : ( ) => { info : { contextWindow ?: number } } } ,
157- ) : Promise < string > {
153+ async function getFileOrFolderContent ( mentionPath : string , cwd : string , contextWindow ?: number ) : Promise < string > {
158154 const absPath = path . resolve ( cwd , mentionPath )
159155
160156 try {
@@ -165,7 +161,6 @@ async function getFileOrFolderContent(
165161 if ( isBinary ) {
166162 return "(Binary file, unable to display content)"
167163 }
168- const contextWindow = api . getModel ( ) . info . contextWindow || 64_000 // minimum context (Deepseek)
169164 const content = await extractTextFromFile ( absPath , contextWindow )
170165 return content
171166 } else if ( stats . isDirectory ( ) ) {
@@ -187,7 +182,6 @@ async function getFileOrFolderContent(
187182 if ( isBinary ) {
188183 return undefined
189184 }
190- const contextWindow = api . getModel ( ) . info . contextWindow || 64_000 // minimum context (Deepseek)
191185 const content = await extractTextFromFile ( absoluteFilePath , contextWindow )
192186 return `<file_content path="${ filePath . toPosix ( ) } ">\n${ content } \n</file_content>`
193187 } catch ( error ) {
0 commit comments