From c040db6d71dbf20a407b07e6a522b4ee01780e15 Mon Sep 17 00:00:00 2001 From: celestial-vault <58194240+celestial-vault@users.noreply.github.com> Date: Mon, 21 Jul 2025 13:56:32 -0700 Subject: [PATCH] Fix options to buildApiHandler (#5064) * add missing taskId to buildApiHandler * remove console log --- src/core/controller/index.ts | 5 +++-- src/core/controller/models/updateApiConfigurationProto.ts | 2 +- src/core/controller/state/updateSettings.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/controller/index.ts b/src/core/controller/index.ts index 65fd0e11..b919996d 100644 --- a/src/core/controller/index.ts +++ b/src/core/controller/index.ts @@ -258,7 +258,7 @@ export class Controller { // Update API handler with new mode (buildApiHandler now selects provider based on mode) if (this.task) { const { apiConfiguration } = await getAllExtensionState(this.context) - this.task.api = buildApiHandler(apiConfiguration, chatSettings.mode) + this.task.api = buildApiHandler({ ...apiConfiguration, taskId: this.task.taskId }, chatSettings.mode) } // Save only non-mode properties to global storage @@ -353,7 +353,7 @@ export class Controller { await updateGlobalState(this.context, "welcomeViewCompleted", true) if (this.task) { - this.task.api = buildApiHandler(updatedConfig, currentMode) + this.task.api = buildApiHandler({ ...updatedConfig, taskId: this.task.taskId }, currentMode) } await this.postStateToWebview() @@ -521,6 +521,7 @@ export class Controller { const updatedConfig = { ...apiConfiguration, openRouterApiKey: apiKey, + taskId: this.task.taskId, } this.task.api = buildApiHandler(updatedConfig, currentMode) } diff --git a/src/core/controller/models/updateApiConfigurationProto.ts b/src/core/controller/models/updateApiConfigurationProto.ts index fa758fdf..33f883dd 100644 --- a/src/core/controller/models/updateApiConfigurationProto.ts +++ b/src/core/controller/models/updateApiConfigurationProto.ts @@ -30,7 +30,7 @@ export async function updateApiConfigurationProto( // Update the task's API handler if there's an active task if (controller.task) { const currentMode = await controller.getCurrentMode() - controller.task.api = buildApiHandler(appApiConfiguration, currentMode) + controller.task.api = buildApiHandler({ ...appApiConfiguration, taskId: controller.task.taskId }, currentMode) } // Post updated state to webview diff --git a/src/core/controller/state/updateSettings.ts b/src/core/controller/state/updateSettings.ts index 5c7fffb5..4f6cc96e 100644 --- a/src/core/controller/state/updateSettings.ts +++ b/src/core/controller/state/updateSettings.ts @@ -22,7 +22,7 @@ export async function updateSettings(controller: Controller, request: UpdateSett if (controller.task) { const currentMode = await controller.getCurrentMode() - controller.task.api = buildApiHandler(apiConfiguration, currentMode) + controller.task.api = buildApiHandler({ ...apiConfiguration, taskId: controller.task.taskId }, currentMode) } }