Skip to content

Commit cb2642f

Browse files
committed
Remove prompt type from make api call message
- 'make api call' handler should rely on the provider to get the propmpt type, not message └── apps └── editor └── src └── views └── prompt ├── backend │ └── message-handlers │ ├── handle-autofill.ts │ ├── handle-copy-prompt.ts │ ├── handle-make-api-call.ts │ ├── handle-preview-web-configuration.ts │ └── index.ts ├── frontend │ ├── Main │ │ ├── Main.tsx │ │ └── MainView │ │ └── MainView.tsx │ ├── Prompt.tsx │ └── hooks │ └── use-prompt │ └── use-prompt.ts └── types └── messages.ts
1 parent fcce9f1 commit cb2642f

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎apps/editor/src/views/prompt/backend/message-handlers/handle-make-api-call.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const handle_make_api_call = async (
148148
): Promise<void> => {
149149
await vscode.workspace.saveAll()
150150

151-
const { prompt_type } = message
151+
const prompt_type = prompt_view_provider.prompt_type as ApiPromptType
152152
const model_providers_manager = new ModelProvidersManager(
153153
prompt_view_provider.extension_context
154154
)

‎apps/editor/src/views/prompt/frontend/Main/Main.tsx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,16 +367,15 @@ export const Main: React.FC<Props> = (props) => {
367367
}
368368

369369
const handle_make_api_call = (use_quick_pick: boolean) => {
370-
const instruction = get_current_instructions()
370+
const instructions = get_current_instructions()
371371

372372
post_message(props.vscode, {
373373
command: 'MAKE_API_CALL',
374-
prompt_type: current_prompt_type as ApiPromptType,
375374
use_quick_pick
376375
})
377376

378-
if (instruction.trim()) {
379-
update_chat_history(instruction)
377+
if (instructions.trim()) {
378+
update_chat_history(instructions)
380379
}
381380
}
382381

@@ -403,7 +402,6 @@ export const Main: React.FC<Props> = (props) => {
403402

404403
post_message(props.vscode, {
405404
command: 'MAKE_API_CALL',
406-
prompt_type: props.api_prompt_type,
407405
use_quick_pick: false,
408406
api_configuration_id: id
409407
})

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ export interface GetModeMessage extends BaseMessage {
211211

212212
export interface MakeApiCallMessage extends BaseMessage {
213213
command: 'MAKE_API_CALL'
214-
prompt_type: ApiPromptType
215214
use_quick_pick: boolean
216215
api_configuration_id?: string
217216
}

0 commit comments

Comments
 (0)