Skip to content

Commit 369d2e0

Browse files
committed
Rename mode field to prompt_type across all message interfaces and implementations
1 parent 1507d9e commit 369d2e0

26 files changed

Lines changed: 107 additions & 102 deletions

‎packages/browser/src/background/message-handler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const process_next_chat = async () => {
8282
},
8383
client_id: current_chat_message.client_id,
8484
raw_instructions: current_chat_message.raw_instructions,
85-
mode: current_chat_message.mode
85+
prompt_type: current_chat_message.prompt_type
8686
}
8787
})
8888

‎packages/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const main = async () => {
196196
client_id: number
197197
raw_instructions?: string
198198
edit_format?: string
199-
mode?:
199+
prompt_type?:
200200
| 'ask-about-context'
201201
| 'edit-context'
202202
| 'code-at-cursor'
@@ -235,9 +235,9 @@ const main = async () => {
235235

236236
if (
237237
chatbot?.inject_apply_response_button &&
238-
(stored_data.mode == 'edit-context' ||
239-
stored_data.mode == 'code-at-cursor' ||
240-
stored_data.mode == 'prune-context')
238+
(stored_data.prompt_type == 'edit-context' ||
239+
stored_data.prompt_type == 'code-at-cursor' ||
240+
stored_data.prompt_type == 'prune-context')
241241
) {
242242
sessionStorage.setItem(
243243
session_data_key,

‎packages/shared/src/types/websocket-message.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type InitializeChatMessage = {
2323
options?: string[]
2424
raw_instructions?: string
2525
edit_format?: string
26-
mode?: any
26+
prompt_type?: any
2727
}
2828

2929
export type Website = {

‎packages/vscode/src/services/websocket-manager.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export class WebSocketManager {
267267
preset_name: string
268268
raw_instructions?: string
269269
edit_format?: string
270-
mode: any
270+
prompt_type: any
271271
}>
272272
presets_config_key: string
273273
}): Promise<void> {
@@ -345,7 +345,7 @@ export class WebSocketManager {
345345
client_id: this.client_id || 0, // 0 is a temporary fallback and should be removed few weeks from 28.03.25
346346
raw_instructions: chat.raw_instructions,
347347
edit_format: chat.edit_format,
348-
mode: chat.mode
348+
prompt_type: chat.prompt_type
349349
}
350350

351351
Logger.info({
@@ -362,7 +362,7 @@ export class WebSocketManager {
362362
instruction: string
363363
preset: Preset
364364
raw_instructions: string
365-
mode: any
365+
prompt_type: any
366366
}): Promise<void> {
367367
if (!this.has_connected_browsers) {
368368
throw new Error('Does not have connected browsers.')
@@ -433,7 +433,7 @@ export class WebSocketManager {
433433
options: params.preset.options,
434434
client_id: this.client_id || 0, // 0 is a temporary fallback and should be removed few weeks from 28.03.25
435435
raw_instructions: params.raw_instructions,
436-
mode: params.mode
436+
prompt_type: params.prompt_type
437437
}
438438

439439
Logger.info({

‎packages/vscode/src/views/panel/backend/message-handlers/handle-at-sign-quick-pick/handle-at-sign-quick-pick.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,19 @@ export const handle_at_sign_quick_pick = async (
274274

275275
let current_text = ''
276276

277-
const mode =
277+
const prompt_type =
278278
panel_provider.mode == MODE.WEB
279279
? panel_provider.web_prompt_type
280280
: panel_provider.api_prompt_type
281-
if (mode == 'ask-about-context') {
281+
if (prompt_type == 'ask-about-context') {
282282
current_text = panel_provider.ask_about_context_instructions
283-
} else if (mode == 'edit-context') {
283+
} else if (prompt_type == 'edit-context') {
284284
current_text = panel_provider.edit_context_instructions
285-
} else if (mode == 'no-context') {
285+
} else if (prompt_type == 'no-context') {
286286
current_text = panel_provider.no_context_instructions
287-
} else if (mode == 'code-at-cursor') {
287+
} else if (prompt_type == 'code-at-cursor') {
288288
current_text = panel_provider.code_at_cursor_instructions
289-
} else if (mode == 'prune-context') {
289+
} else if (prompt_type == 'prune-context') {
290290
current_text = panel_provider.prune_context_instructions
291291
}
292292

‎packages/vscode/src/views/panel/backend/message-handlers/handle-code-completion.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const get_code_completion_config = async (
6161
if (panel_provider) {
6262
panel_provider.send_message({
6363
command: 'SELECTED_CONFIGURATION_CHANGED',
64-
mode: 'code-at-cursor',
64+
prompt_type: 'code-at-cursor',
6565
id: config_id
6666
})
6767
}
@@ -210,7 +210,7 @@ const get_code_completion_config = async (
210210
if (panel_provider) {
211211
panel_provider.send_message({
212212
command: 'SELECTED_CONFIGURATION_CHANGED',
213-
mode: 'code-at-cursor',
213+
prompt_type: 'code-at-cursor',
214214
id: selected.id
215215
})
216216
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const get_edit_context_config = async (
7171
if (panel_provider) {
7272
panel_provider.send_message({
7373
command: 'SELECTED_CONFIGURATION_CHANGED',
74-
mode: 'edit-context',
74+
prompt_type: 'edit-context',
7575
id: config_id
7676
})
7777
}
@@ -221,7 +221,7 @@ const get_edit_context_config = async (
221221
if (panel_provider) {
222222
panel_provider.send_message({
223223
command: 'SELECTED_CONFIGURATION_CHANGED',
224-
mode: 'edit-context',
224+
prompt_type: 'edit-context',
225225
id: selected.id!
226226
})
227227
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-get-api-prompt-type.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export const handle_get_api_prompt_type = (
55
): void => {
66
panel_provider.send_message({
77
command: 'API_PROMPT_TYPE',
8-
mode: panel_provider.api_prompt_type
8+
prompt_type: panel_provider.api_prompt_type
99
})
1010
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-get-web-prompt-type.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export const handle_get_web_prompt_type = (
55
): void => {
66
panel_provider.send_message({
77
command: 'WEB_PROMPT_TYPE',
8-
mode: panel_provider.web_prompt_type
8+
prompt_type: panel_provider.web_prompt_type
99
})
1010
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-hash-sign-quick-pick/handle-hash-sign-quick-pick.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,19 @@ export const handle_hash_sign_quick_pick = async (
169169

170170
let current_text = ''
171171

172-
const mode =
172+
const prompt_type =
173173
panel_provider.mode == MODE.WEB
174174
? panel_provider.web_prompt_type
175175
: panel_provider.api_prompt_type
176-
if (mode == 'ask-about-context') {
176+
if (prompt_type == 'ask-about-context') {
177177
current_text = panel_provider.ask_about_context_instructions
178-
} else if (mode == 'edit-context') {
178+
} else if (prompt_type == 'edit-context') {
179179
current_text = panel_provider.edit_context_instructions
180-
} else if (mode == 'no-context') {
180+
} else if (prompt_type == 'no-context') {
181181
current_text = panel_provider.no_context_instructions
182-
} else if (mode == 'code-at-cursor') {
182+
} else if (prompt_type == 'code-at-cursor') {
183183
current_text = panel_provider.code_at_cursor_instructions
184-
} else if (mode == 'prune-context') {
184+
} else if (prompt_type == 'prune-context') {
185185
current_text = panel_provider.prune_context_instructions
186186
}
187187

0 commit comments

Comments
 (0)