Skip to content

Commit dbc8f28

Browse files
committed
Rename chatbot_url to url and CommandArgs to ApplyChatResponseCommandArgs across the codebase
1 parent 34c4b10 commit dbc8f28

11 files changed

Lines changed: 31 additions & 32 deletions

File tree

apps/editor/src/commands/apply-chat-response-command/apply-chat-response-command.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import {
1616
preview_handler,
1717
ongoing_preview_cleanup_promise
1818
} from './utils/preview-handler'
19-
import { process_chat_response, CommandArgs } from './response-processor'
19+
import {
20+
process_chat_response,
21+
ApplyChatResponseCommandArgs
22+
} from './response-processor'
2023
import { Checkpoint } from '../checkpoints-command/types'
2124
import { CHECKPOINTS_STATE_KEY } from '@/constants/state-keys'
2225
import { ResponseHistoryItem } from '@shared/types/response-history-item'
@@ -57,7 +60,7 @@ export const apply_chat_response_command = (params: {
5760

5861
return vscode.commands.registerCommand(
5962
'codeWebChat.applyChatResponse',
60-
async (args?: CommandArgs) => {
63+
async (args?: ApplyChatResponseCommandArgs) => {
6164
if (!vscode.workspace.workspaceFolders?.length) {
6265
vscode.window.showErrorMessage(
6366
dictionary.error_message.NO_WORKSPACE_FOLDER_OPEN
@@ -102,7 +105,7 @@ export const apply_chat_response_command = (params: {
102105
response: chat_response,
103106
raw_instructions: args?.raw_instructions,
104107
created_at: Date.now(),
105-
chatbot_url: args?.chatbot_url,
108+
url: args?.url,
106109
api_configuration: args?.api_configuration
107110
}
108111

@@ -329,7 +332,7 @@ export const apply_chat_response_command = (params: {
329332
lines_added: total_lines_added,
330333
lines_removed: total_lines_removed,
331334
files: files_for_history,
332-
chatbot_url: args?.chatbot_url,
335+
url: args?.url,
333336
api_configuration: args?.api_configuration
334337
}
335338

@@ -354,7 +357,7 @@ export const apply_chat_response_command = (params: {
354357
original_editor_state: args?.original_editor_state,
355358
raw_instructions: args?.raw_instructions,
356359
created_at: created_at_for_preview,
357-
chatbot_url: args?.chatbot_url,
360+
url: args?.url,
358361
api_configuration: args?.api_configuration
359362
})
360363

apps/editor/src/commands/apply-chat-response-command/response-processor.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,21 @@ export type PreviewData = {
3535
chat_response: string
3636
}
3737

38-
export type CommandArgs = {
38+
export type ApplyChatResponseCommandArgs = {
3939
response?: string
4040
raw_instructions?: string
41-
edit_format?: string
4241
original_editor_state?: {
4342
file_path: string
4443
position: { line: number; character: number }
4544
}
4645
files_with_content?: FileInPreview[]
4746
created_at?: number
48-
chatbot_url?: string
47+
url?: string
4948
api_configuration?: ApiConfiguration
5049
}
5150

5251
export const process_chat_response = async (params: {
53-
args: CommandArgs | undefined
52+
args: ApplyChatResponseCommandArgs | undefined
5453
chat_response: string
5554
clipboard_items: ClipboardItem[]
5655
context: vscode.ExtensionContext

apps/editor/src/commands/apply-chat-response-command/utils/preview-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const preview_handler = async (params: {
2121
}
2222
raw_instructions?: string
2323
created_at?: number
24-
chatbot_url?: string
24+
url?: string
2525
api_configuration?: ApiConfiguration
2626
}): Promise<boolean> => {
2727
let resolve_cleanup_promise: () => void
@@ -37,7 +37,7 @@ export const preview_handler = async (params: {
3737
chat_response: params.chat_response,
3838
context: params.context,
3939
created_at: params.created_at,
40-
chatbot_url: params.chatbot_url,
40+
url: params.url,
4141
api_configuration: params.api_configuration
4242
})
4343

apps/editor/src/commands/apply-chat-response-command/utils/preview/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const preview = async (params: {
2626
chat_response: string
2727
context: vscode.ExtensionContext
2828
created_at?: number
29-
chatbot_url?: string
29+
url?: string
3030
api_configuration?: ApiConfiguration
3131
}): Promise<{
3232
accepted_files: PreviewableFile[]
@@ -139,7 +139,7 @@ export const preview = async (params: {
139139
raw_instructions: params.raw_instructions,
140140
created_at: params.created_at,
141141
fix_all_automatically,
142-
chatbot_url: params.chatbot_url,
142+
url: params.url,
143143
api_configuration: params.api_configuration
144144
})
145145
}

apps/editor/src/commands/checkpoints-command/actions/restore-checkpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ export const restore_checkpoint = async (params: {
535535
raw_instructions: item_to_preview.raw_instructions,
536536
files_with_content: item_to_preview.files,
537537
created_at: item_to_preview.created_at,
538-
chatbot_url: item_to_preview.chatbot_url,
538+
url: item_to_preview.url,
539539
api_configuration: item_to_preview.api_configuration
540540
})
541541
}

apps/editor/src/services/websocket-manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Logger } from '@shared/utils/logger'
1515
import { Preset } from '@shared/types/preset'
1616
import { ConfigPresetFormat } from '@/views/panel/backend/utils/preset-format-converters'
1717
import { LAST_SELECTED_BROWSER_ID_STATE_KEY } from '@/constants/state-keys'
18+
import { ApplyChatResponseCommandArgs } from '@/commands/apply-chat-response-command/response-processor'
1819

1920
/**
2021
* Bridges the current workspace window and websocket server that runs in a separate process.
@@ -159,9 +160,8 @@ export class WebSocketManager {
159160
} else if (message.action == 'apply-chat-response') {
160161
vscode.commands.executeCommand('codeWebChat.applyChatResponse', {
161162
raw_instructions: message.raw_instructions,
162-
edit_format: message.edit_format,
163-
chatbot_url: message.url
164-
})
163+
url: message.url
164+
} as ApplyChatResponseCommandArgs)
165165
}
166166
} catch (error) {
167167
Logger.error({

apps/editor/src/views/panel/backend/message-handlers/handle-apply-response-from-history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const handle_apply_response_from_history = async (
99
raw_instructions: message.raw_instructions,
1010
files_with_content: message.files,
1111
created_at: message.created_at,
12-
chatbot_url: message.chatbot_url,
12+
url: message.url,
1313
api_configuration: message.api_configuration
1414
})
1515
}

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const Panel = () => {
102102
preview_item_created_at,
103103
fix_all_automatically,
104104
handle_discard_user_changes_in_preview,
105-
chatbot_url,
105+
url,
106106
api_configuration
107107
} = use_preview_manager(vscode)
108108

@@ -279,7 +279,7 @@ export const Panel = () => {
279279
raw_instructions: item.raw_instructions,
280280
files: item.files,
281281
created_at: item.created_at,
282-
chatbot_url: item.chatbot_url,
282+
url: item.url,
283283
api_configuration: item.api_configuration
284284
})
285285
}
@@ -633,11 +633,8 @@ export const Panel = () => {
633633
post_message(vscode, { command: 'RESPONSE_PREVIEW', files: [] })
634634
}}
635635
header_slot={
636-
chatbot_url ? (
637-
<UiIconButton
638-
codicon_icon="link-external"
639-
href={chatbot_url}
640-
/>
636+
url ? (
637+
<UiIconButton codicon_icon="link-external" href={url} />
641638
) : undefined
642639
}
643640
footer_slot={

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const use_preview_manager = (vscode: any) => {
1010
const [preview_item_created_at, set_preview_item_created_at] =
1111
useState<number>()
1212
const [fix_all_automatically, set_fix_all_automatically] = useState(false)
13-
const [chatbot_url, set_chatbot_url] = useState<string>()
13+
const [url, set_url] = useState<string>()
1414
const [api_configuration, set_api_configuration] =
1515
useState<ApiConfiguration>()
1616

@@ -33,7 +33,7 @@ export const use_preview_manager = (vscode: any) => {
3333
set_raw_instructions(message.raw_instructions)
3434
set_preview_item_created_at(message.created_at)
3535
set_fix_all_automatically(message.fix_all_automatically ?? false)
36-
set_chatbot_url(message.chatbot_url)
36+
set_url(message.url)
3737
set_api_configuration(message.api_configuration)
3838
} else if (message.command == 'UPDATE_FILE_IN_PREVIEW') {
3939
set_items_in_preview((current_items) => {
@@ -98,7 +98,7 @@ export const use_preview_manager = (vscode: any) => {
9898
set_items_in_preview(undefined)
9999
set_raw_instructions(undefined)
100100
set_preview_item_created_at(undefined)
101-
set_chatbot_url(undefined)
101+
set_url(undefined)
102102
set_api_configuration(undefined)
103103
}
104104
}
@@ -111,7 +111,7 @@ export const use_preview_manager = (vscode: any) => {
111111
items_in_preview,
112112
set_items_in_preview,
113113
raw_instructions,
114-
chatbot_url,
114+
url,
115115
preview_item_created_at,
116116
fix_all_automatically,
117117
handle_discard_user_changes_in_preview,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export interface ApplyResponseFromHistoryMessage extends BaseMessage {
398398
raw_instructions?: string
399399
files?: FileInPreview[]
400400
created_at: number
401-
chatbot_url?: string
401+
url?: string
402402
api_configuration?: ApiConfiguration
403403
}
404404

@@ -810,7 +810,7 @@ export interface ResponsePreviewStartedMessage extends BaseMessage {
810810
raw_instructions?: string
811811
created_at?: number
812812
fix_all_automatically?: boolean
813-
chatbot_url?: string
813+
url?: string
814814
api_configuration?: ApiConfiguration
815815
}
816816

0 commit comments

Comments
 (0)