@@ -49,8 +49,8 @@ export class DeepseekLLM
4949 private initializeDisposable ( ) : void {
5050 this . disposables . push (
5151 vscode . workspace . onDidChangeConfiguration ( ( ) =>
52- this . handleConfigurationChange ( )
53- )
52+ this . handleConfigurationChange ( ) ,
53+ ) ,
5454 ) ;
5555 }
5656
@@ -87,7 +87,7 @@ export class DeepseekLLM
8787
8888 public async generateText (
8989 prompt : string ,
90- instruction ?: string
90+ instruction ?: string ,
9191 ) : Promise < string > {
9292 try {
9393 const messages = [
@@ -145,7 +145,7 @@ export class DeepseekLLM
145145 undefined ,
146146 undefined ,
147147 undefined ,
148- true
148+ true ,
149149 ) ;
150150 // Note this prompt should be for system instruction only.
151151 const prompt = createPrompt ( userInput ) ;
@@ -203,7 +203,7 @@ export class DeepseekLLM
203203 {
204204 name : response . choices [ 0 ] . message . function_call . name ,
205205 args : JSON . parse (
206- response . choices [ 0 ] . message . function_call . arguments
206+ response . choices [ 0 ] . message . function_call . arguments ,
207207 ) ,
208208 } ,
209209 ] ;
@@ -246,8 +246,8 @@ export class DeepseekLLM
246246 const timeoutPromise = new Promise ( ( _ , reject ) =>
247247 setTimeout (
248248 ( ) => reject ( new Error ( "Timeout Exceeded" ) ) ,
249- this . timeOutMs
250- )
249+ this . timeOutMs ,
250+ ) ,
251251 ) ;
252252
253253 const responsePromise = this . generateContentWithTools ( userQuery ) ;
@@ -276,17 +276,17 @@ export class DeepseekLLM
276276 ) {
277277 this . logger . warn (
278278 "Detecting no progress: same function calls repeated" ,
279- ""
279+ "" ,
280280 ) ;
281281
282282 const regeneratedQuery = await this . generateText (
283283 userQuery ,
284- "Rewrite the user query to more clearly and effectively express the user's underlying intent. The goal is to enable the system to retrieve and utilize the available tools more accurately. Identify the core information need and rephrase the query to highlight it. Consider what information the tools need to function optimally and ensure the query provides it."
284+ "Rewrite the user query to more clearly and effectively express the user's underlying intent. The goal is to enable the system to retrieve and utilize the available tools more accurately. Identify the core information need and rephrase the query to highlight it. Consider what information the tools need to function optimally and ensure the query provides it." ,
285285 ) ;
286286
287287 this . orchestrator . publish (
288288 "onQuery" ,
289- JSON . stringify ( regeneratedQuery )
289+ JSON . stringify ( regeneratedQuery ) ,
290290 ) ;
291291
292292 let answer = await this . processUserQuery ( regeneratedQuery ) ;
@@ -300,13 +300,13 @@ export class DeepseekLLM
300300 this . lastFunctionCalls . add ( currentCallSignatures ) ;
301301 if ( this . lastFunctionCalls . size > 10 ) {
302302 this . lastFunctionCalls = new Set (
303- [ ...this . lastFunctionCalls ] . slice ( - 10 )
303+ [ ...this . lastFunctionCalls ] . slice ( - 10 ) ,
304304 ) ;
305305 }
306306
307307 if ( toolCalls && toolCalls . length > 0 ) {
308308 this . logger . info (
309- `Function calls detected: ${ JSON . stringify ( toolCalls ) } `
309+ `Function calls detected: ${ JSON . stringify ( toolCalls ) } ` ,
310310 ) ;
311311
312312 for ( const functionCall of toolCalls ) {
@@ -320,7 +320,7 @@ export class DeepseekLLM
320320 functionCall ,
321321 functionResult ,
322322 undefined ,
323- false
323+ false ,
324324 ) ;
325325
326326 const snapShot = this . createSnapShot ( {
@@ -336,7 +336,7 @@ export class DeepseekLLM
336336 const retry = await vscode . window . showErrorMessage (
337337 `Function call failed: ${ error . message } . Retry or abort?` ,
338338 "Retry" ,
339- "Abort"
339+ "Abort" ,
340340 ) ;
341341
342342 if ( retry === "Retry" ) {
@@ -369,28 +369,28 @@ export class DeepseekLLM
369369 if ( snapshot ?. length > 0 ) {
370370 Memory . removeItems (
371371 "DEEPSEEK_SNAPSHOT" ,
372- Memory . get ( "DEEPSEEK_SNAPSHOT" ) . length
372+ Memory . get ( "DEEPSEEK_SNAPSHOT" ) . length ,
373373 ) ;
374374 }
375375
376376 return finalResult ;
377377 } catch ( error : any ) {
378378 this . orchestrator . publish (
379379 "onError" ,
380- "Model not responding at this time, please try again"
380+ "Model not responding at this time, please try again" ,
381381 ) ;
382382 vscode . window . showErrorMessage ( "Error processing user query" ) ;
383383 this . logger . error (
384384 "Error generating queries, thoughts from user query" ,
385- error
385+ error ,
386386 ) ;
387387 throw error ;
388388 }
389389 }
390390
391391 private async handleSingleFunctionCall (
392392 functionCall : any ,
393- attempt : number = 0
393+ attempt : number = 0 ,
394394 ) : Promise < any > {
395395 const MAX_RETRIES = 3 ;
396396 const args = functionCall . args as Record < string , any > ;
@@ -418,7 +418,7 @@ export class DeepseekLLM
418418 if ( attempt < MAX_RETRIES ) {
419419 this . logger . warn (
420420 `Retry attempt ${ attempt + 1 } for function ${ name } ` ,
421- JSON . stringify ( { error : error . message , args } )
421+ JSON . stringify ( { error : error . message , args } ) ,
422422 ) ;
423423 return this . handleSingleFunctionCall ( functionCall , attempt + 1 ) ;
424424 }
@@ -441,7 +441,7 @@ export class DeepseekLLM
441441 functionCall ?: any ,
442442 functionResponse ?: any ,
443443 chat ?: any ,
444- isInitialQuery : boolean = false
444+ isInitialQuery : boolean = false ,
445445 ) : Promise < any [ ] > {
446446 let chatHistory : any = Memory . get ( COMMON . DEEPSEEK_CHAT_HISTORY ) || [ ] ;
447447 Memory . removeItems ( COMMON . DEEPSEEK_CHAT_HISTORY ) ;
@@ -471,15 +471,15 @@ export class DeepseekLLM
471471 } ,
472472 } ,
473473 ] ,
474- } )
474+ } ) ,
475475 ) ;
476476
477477 // Add function result as user message
478478 chatHistory . push (
479479 Message . of ( {
480480 role : "user" ,
481481 content : `Tool result: ${ JSON . stringify ( functionResponse ) } ` ,
482- } )
482+ } ) ,
483483 ) ;
484484 }
485485
0 commit comments