Skip to content

Commit 1ddd284

Browse files
committed
Simplify intelligent update modal UI and increase API chain resolution delay
1 parent ec3fb8c commit 1ddd284

10 files changed

Lines changed: 102 additions & 191 deletions

File tree

‎apps/editor/src/commands/apply-chat-response-command/handlers/active-editor-intelligent-update-handler.ts‎

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,8 @@ export const handle_active_editor_intelligent_update = async (params: {
9292
params.panel_provider.api_call_cancel_token_source = cancel_token_source
9393
params.panel_provider.send_message({
9494
command: 'SHOW_ACTIVE_EDITOR_INTELLIGENT_UPDATE_MODAL',
95-
title: 'Called Intelligent Update API tool',
96-
file: {
97-
file_path: file_item.file_path,
98-
workspace_name: file_item.workspace_name,
99-
status: 'thinking'
100-
}
95+
title: 'Updating file...',
96+
status: 'thinking'
10197
})
10298
}
10399

@@ -131,40 +127,29 @@ export const handle_active_editor_intelligent_update = async (params: {
131127

132128
params.panel_provider.send_message({
133129
command: 'SHOW_ACTIVE_EDITOR_INTELLIGENT_UPDATE_MODAL',
134-
title: 'Called Intelligent Update API tool',
135-
file: {
136-
file_path: file_item.file_path,
137-
workspace_name: file_item.workspace_name,
138-
status: 'receiving',
139-
tokens_per_second,
140-
progress
141-
}
130+
title: 'Updating file...',
131+
status: 'receiving',
132+
tokens_per_second,
133+
progress,
134+
total_tokens
142135
})
143136
}
144137
},
145138
on_retry_attempt: () => {
146139
if (params.panel_provider) {
147140
params.panel_provider.send_message({
148141
command: 'SHOW_ACTIVE_EDITOR_INTELLIGENT_UPDATE_MODAL',
149-
title: 'Called Intelligent Update API tool',
150-
file: {
151-
file_path: file_item.file_path,
152-
workspace_name: file_item.workspace_name,
153-
status: 'thinking'
154-
}
142+
title: 'Updating file...',
143+
status: 'thinking'
155144
})
156145
}
157146
},
158147
on_retry: () => {
159148
if (params.panel_provider) {
160149
params.panel_provider.send_message({
161150
command: 'SHOW_ACTIVE_EDITOR_INTELLIGENT_UPDATE_MODAL',
162-
title: 'Called Intelligent Update API tool',
163-
file: {
164-
file_path: file_item.file_path,
165-
workspace_name: file_item.workspace_name,
166-
status: 'retrying'
167-
}
151+
title: 'Updating file...',
152+
status: 'retrying'
168153
})
169154
}
170155
}

‎apps/editor/src/services/api-manager.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import axios, { CancelTokenSource } from 'axios'
44
import { randomUUID, createHash } from 'crypto'
55
import { Logger } from '@shared/utils/logger'
66

7-
const CHAIN_RESOLUTION_DELAY_MS = 2000
7+
const CHAIN_RESOLUTION_DELAY_MS = 3000
88

99
export class ApiManager {
1010
private cancel_token_sources: Map<string, CancelTokenSource> = new Map()

‎apps/editor/src/views/panel/frontend/Panel.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,12 @@ export const Panel = () => {
665665
<div className={styles.slot}>
666666
<UiActiveEditorIntelligentUpdateModal
667667
title={active_editor_intelligent_update_state.title}
668-
file={active_editor_intelligent_update_state.file}
668+
status={active_editor_intelligent_update_state.status}
669+
progress={active_editor_intelligent_update_state.progress}
670+
tokens_per_second={
671+
active_editor_intelligent_update_state.tokens_per_second
672+
}
673+
total_tokens={active_editor_intelligent_update_state.total_tokens}
669674
on_cancel={() => {
670675
post_message(vscode, { command: 'CANCEL_API_REQUEST' })
671676
}}

‎apps/editor/src/views/panel/frontend/hooks/use-panel.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
22
import { Preset } from '@shared/types/preset'
33
import {
44
BackendMessage,
5-
FileProgress,
5+
FileProgressStatus,
66
FrontendMessage,
77
SelectionState
88
} from '../../types/messages'
@@ -135,7 +135,13 @@ export const use_panel = (vscode: any) => {
135135
const [
136136
active_editor_intelligent_update_state,
137137
set_active_editor_intelligent_update_state
138-
] = useState<{ title: string; file?: FileProgress }>()
138+
] = useState<{
139+
title: string
140+
status?: FileProgressStatus
141+
progress?: number
142+
tokens_per_second?: number
143+
total_tokens?: number
144+
}>()
139145

140146
const handle_instructions_change = (
141147
value: string,
@@ -386,7 +392,10 @@ export const use_panel = (vscode: any) => {
386392
) {
387393
set_active_editor_intelligent_update_state({
388394
title: message.title,
389-
file: message.file
395+
status: message.status,
396+
progress: message.progress,
397+
tokens_per_second: message.tokens_per_second,
398+
total_tokens: message.total_tokens
390399
})
391400
} else if (
392401
message.command == 'HIDE_ACTIVE_EDITOR_INTELLIGENT_UPDATE_MODAL'

‎apps/editor/src/views/panel/types/messages.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ export type FileProgressStatus =
5151
| 'done'
5252
| 'retrying'
5353

54-
export type FileProgress = {
55-
file_path: string
56-
workspace_name?: string
57-
status: FileProgressStatus
58-
progress?: number
59-
tokens_per_second?: number
60-
}
61-
6254
// === FROM FRONTEND TO BACKEND ===
6355
export interface GetInstructionsMessage extends BaseMessage {
6456
command: 'GET_INSTRUCTIONS'
@@ -793,7 +785,10 @@ export interface HideApiManagerProgressMessage extends BaseMessage {
793785
export interface ShowActiveEditorIntelligentUpdateModalMessage extends BaseMessage {
794786
command: 'SHOW_ACTIVE_EDITOR_INTELLIGENT_UPDATE_MODAL'
795787
title: string
796-
file?: FileProgress
788+
status?: FileProgressStatus
789+
progress?: number
790+
tokens_per_second?: number
791+
total_tokens?: number
797792
}
798793

799794
export interface HideActiveEditorIntelligentUpdateModalMessage extends BaseMessage {

‎packages/ui/src/components/editor/panel/Scrollable/Scrollable.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ type Props = {
1818
on_scroll?: (top: number) => void
1919
on_scrolled_change?: (is_scrolled: boolean) => void
2020
scroll_trigger?: number
21-
className?: string
2221
}
2322

2423
export const Scrollable = forwardRef<any, Props>((props, ref) => {
@@ -86,7 +85,7 @@ export const Scrollable = forwardRef<any, Props>((props, ref) => {
8685

8786
return (
8887
<div
89-
className={cn(styles.scrollable, props.className, {
88+
className={cn(styles.scrollable, {
9089
[styles['scrollable--shadow']]: has_top_shadow
9190
})}
9291
>

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

Lines changed: 22 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
.elapsed-time {
2-
text-align: center;
3-
font-size: 20px;
4-
font-family: monospace;
5-
}
6-
7-
.tokens-per-second {
8-
text-align: center;
9-
font-family: monospace;
10-
color: var(--cwc-text-color-dimmed);
11-
}
12-
131
.progress {
142
width: 100%;
153
height: 3px;
164
background-color: var(--vscode-dropdown-border);
175
border-radius: 999px;
186
overflow: hidden;
197
position: relative;
8+
margin: 6px 0;
209

2110
&__fill {
2211
height: 100%;
@@ -36,62 +25,39 @@
3625
.content {
3726
display: flex;
3827
flex-direction: column;
39-
gap: 8px;
28+
padding: 0 4px;
4029
}
4130

4231
.file-item {
4332
display: flex;
4433
flex-direction: column;
45-
gap: 4px;
46-
}
47-
48-
.file-item__header {
49-
display: flex;
50-
justify-content: space-between;
51-
align-items: center;
52-
gap: 8px;
53-
}
54-
55-
.file-item__name {
56-
font-size: 12px;
57-
white-space: nowrap;
58-
overflow: hidden;
59-
text-overflow: ellipsis;
60-
color: var(--cwc-text-color-dimmed);
61-
flex-shrink: 1;
34+
width: 100%;
6235

63-
> span:nth-child(2) {
64-
margin-left: 0.5em;
36+
&__bottom {
37+
display: flex;
38+
align-items: center;
39+
justify-content: space-between;
40+
font-size: 12px;
41+
color: var(--vscode-editorWidget-foreground);
6542
opacity: 0.7;
66-
font-size: 0.9em;
67-
}
68-
}
6943

70-
.file-item__status {
71-
font-size: 12px;
72-
flex-shrink: 0;
44+
&__status {
45+
overflow: hidden;
46+
white-space: nowrap;
47+
text-overflow: ellipsis;
48+
margin-right: 8px;
49+
}
7350

74-
&--waiting {
75-
color: var(--cwc-text-color-dimmed);
76-
}
77-
&--thinking {
78-
color: var(--vscode-focusBorder);
79-
}
80-
&--receiving {
81-
color: var(--vscode-focusBorder);
82-
}
83-
&--done {
84-
color: var(--vscode-testing-iconPassed);
51+
&__right {
52+
display: flex;
53+
align-items: center;
54+
gap: 6px;
55+
flex-shrink: 0;
56+
font-variant-numeric: tabular-nums;
57+
}
8558
}
8659
}
8760

88-
.file-item__details {
89-
font-family: monospace;
90-
font-size: 10px;
91-
color: var(--cwc-text-color-dimmed);
92-
text-align: right;
93-
}
94-
9561
@keyframes indeterminate-progress {
9662
from {
9763
left: -50px;

0 commit comments

Comments
 (0)