@@ -40,6 +40,9 @@ export async function doUploadCommand(cvbFilePath: string, userPrompt: string, o
4040 vscode . window . showErrorMessage ( 'No workspace folder found' ) ;
4141 return ;
4242 }
43+
44+ resetCurrentOperationController ( ) ;
45+ const CurrentOperationController = getCurrentOperationController ( ) ;
4346
4447 const workspacePath = workspaceFolders [ 0 ] . uri . fsPath ;
4548 const tmpDir = path . join ( workspacePath , '.CodeReDesignWorkSpace' ) ;
@@ -56,9 +59,7 @@ export async function doUploadCommand(cvbFilePath: string, userPrompt: string, o
5659
5760 const cvbContent = fs . readFileSync ( cvbFilePath , 'utf-8' ) ;
5861
59- resetCurrentOperationController ( ) ;
60-
61- let apiResponse = await queryCodeReDesign ( cvbContent , userPrompt , outputChannel , getCurrentOperationController ( ) . signal ) ;
62+ let apiResponse = await queryCodeReDesign ( cvbContent , userPrompt , outputChannel , CurrentOperationController . signal ) ;
6263 let processSuccess = true ;
6364 let attemptCount = 0 ;
6465 do {
@@ -77,11 +78,11 @@ export async function doUploadCommand(cvbFilePath: string, userPrompt: string, o
7778 }
7879 } catch ( err : any ) {
7980 vscode . window . showInformationMessage ( `API response have error ${ err . message } , try fix ...` ) ;
80- apiResponse = await callDeepSeekFixApi ( err . message , outputChannel , true , getCurrentOperationController ( ) . signal ) ;
81+ apiResponse = await callDeepSeekFixApi ( err . message , outputChannel , true , CurrentOperationController . signal ) ;
8182 processSuccess = false ;
8283 attemptCount ++ ;
8384 }
84- } while ( ! processSuccess && attemptCount < 3 ) ;
85+ } while ( ! processSuccess && attemptCount < 3 && ! CurrentOperationController . signal . aborted ) ;
8586
8687 const lastMessageBody = GetLastMessageBody ( ) ;
8788
0 commit comments