Skip to content

Commit 67bd22f

Browse files
committed
Refactor file processing status handling by replacing the 'error' status with 'retrying' to better reflect API retry logic
1 parent 013630a commit 67bd22f

5 files changed

Lines changed: 23 additions & 15 deletions

File tree

‎packages/ui/src/components/editor/panel/modals/ProgressModal/ProgressModal.module.scss‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@
8383
&--done {
8484
color: var(--vscode-testing-iconPassed);
8585
}
86-
&--error {
87-
color: var(--vscode-testing-iconFailed);
88-
}
8986
}
9087

9188
.file-item__details {

‎packages/ui/src/components/editor/panel/modals/ProgressModal/ProgressModal.tsx‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type FileProgressStatus =
99
| 'thinking'
1010
| 'receiving'
1111
| 'done'
12-
| 'error'
12+
| 'retrying'
1313

1414
export type FileProgress = {
1515
file_path: string
@@ -45,8 +45,8 @@ const get_status_text = (status: FileProgressStatus): string => {
4545
return 'Receiving...'
4646
case 'done':
4747
return 'Done'
48-
case 'error':
49-
return 'Error'
48+
case 'retrying':
49+
return 'Retrying...'
5050
}
5151
}
5252

@@ -104,6 +104,7 @@ export const ProgressModal: React.FC<Props> = (props) => {
104104
</div>
105105
<div className={styles.progress}>
106106
{file.status == 'thinking' ||
107+
file.status == 'retrying' ||
107108
(file.status == 'receiving' &&
108109
file.progress === undefined) ? (
109110
<div
@@ -113,13 +114,11 @@ export const ProgressModal: React.FC<Props> = (props) => {
113114
<div
114115
className={cn(styles.progress__fill, {
115116
[styles['progress__fill--done']]:
116-
file.status == 'done',
117-
[styles['progress__fill--error']]:
118-
file.status == 'error'
117+
file.status == 'done'
119118
})}
120119
style={{
121120
width: `${
122-
file.status == 'done' || file.status == 'error'
121+
file.status == 'done'
123122
? 100
124123
: file.status == 'receiving' &&
125124
file.progress !== undefined

‎packages/vscode/src/commands/apply-chat-response-command/handlers/intelligent-update-handler.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,19 @@ export const handle_intelligent_update = async (params: {
315315
}
316316
update_progress()
317317
}
318+
},
319+
on_retry_attempt: () => {
320+
if (file_progress_index != -1) {
321+
receiving_started = false
322+
file_progress_list[file_progress_index].status = 'thinking'
323+
update_progress()
324+
}
325+
},
326+
on_retry: () => {
327+
if (file_progress_index != -1) {
328+
file_progress_list[file_progress_index].status = 'retrying'
329+
update_progress()
330+
}
318331
}
319332
})
320333

@@ -340,10 +353,6 @@ export const handle_intelligent_update = async (params: {
340353
workspaceName: file.workspace_name
341354
}
342355
} catch (error: any) {
343-
if (file_progress_index != -1) {
344-
file_progress_list[file_progress_index].status = 'error'
345-
update_progress()
346-
}
347356
if (axios.isCancel(error) || error.message == 'Operation cancelled') {
348357
throw new Error('Operation cancelled')
349358
}

‎packages/vscode/src/utils/intelligent-update-utils.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ export const process_file = async (params: {
204204
cancel_token?: CancelToken
205205
on_chunk?: (tokens_per_second: number, total_tokens: number) => void
206206
on_thinking_chunk?: (text: string) => void
207+
on_retry?: (attempt: number, error: any) => void
208+
on_retry_attempt?: () => void
207209
}): Promise<string> => {
208210
Logger.info({
209211
function_name: 'process_file',
@@ -283,6 +285,7 @@ export const process_file = async (params: {
283285
`Refactoring error for ${params.file_path} (attempt ${attempt}):`,
284286
error
285287
)
288+
params.on_retry?.(attempt, error)
286289
await new Promise((resolve) => setTimeout(resolve, 5000))
287290
}
288291
}

‎packages/vscode/src/views/panel/types/messages.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type FileProgressStatus =
2525
| 'thinking'
2626
| 'receiving'
2727
| 'done'
28-
| 'error'
28+
| 'retrying'
2929

3030
export type FileProgress = {
3131
file_path: string

0 commit comments

Comments
 (0)