diff --git a/core/core.ts b/core/core.ts index 1bbafbf82..918471d2f 100644 --- a/core/core.ts +++ b/core/core.ts @@ -252,6 +252,7 @@ export class Core { this.registerMessageHandlers(ideSettingsPromise); } + /* eslint-disable max-lines-per-function */ private registerMessageHandlers(ideSettingsPromise: Promise) { const on = this.messenger.on.bind(this.messenger); @@ -626,14 +627,18 @@ export class Core { }); on("didChangeSelectedProfile", async (msg) => { - await this.configHandler.setSelectedProfileId(msg.data.id); + if (msg.data.id) { + await this.configHandler.setSelectedProfileId(msg.data.id); + } }); on("didChangeSelectedOrg", async (msg) => { - await this.configHandler.setSelectedOrgId( - msg.data.id, - msg.data.profileId, - ); + if (msg.data.id) { + await this.configHandler.setSelectedOrgId( + msg.data.id, + msg.data.profileId || undefined, + ); + } }); on("didChangeControlPlaneSessionInfo", async (msg) => { @@ -686,7 +691,7 @@ export class Core { toolCallId: string, contextItems: any[] }) => { - this.messenger.send("toolCallPartialOutput", params); + this.messenger.send("toolCallPartialOutput" as any, params); }; const contextItems = await callTool( diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index e75abe57a..6140b50d3 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -8,6 +8,7 @@ import { // extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = [ + "toolCallPartialOutput", "ping", "abort", "history/list", diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index 74ce31559..5038dff18 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -40,4 +40,8 @@ export type ToWebviewFromIdeOrCoreProtocol = { getWebviewHistoryLength: [undefined, number]; getCurrentSessionId: [undefined, string]; "jetbrains/setColors": [Record, void]; + toolCallPartialOutput: [ + { toolCallId: string; contextItems: any[] }, + void, + ]; }; diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 3cdef6112..0420606b2 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -37,8 +37,7 @@ import { newSession, selectIsInEditMode, selectIsSingleRangeEditOrInsertion, - setInactive, - updateToolCallOutput, + updateToolCallOutput } from "../../redux/slices/sessionSlice"; import { setDialogEntryOn, @@ -278,14 +277,16 @@ export function Chat() { useWebviewListener( "toolCallPartialOutput", async (data) => { - console.log("toolCallPartialOutput", data); - // Update tool call output in Redux store - dispatch( - updateToolCallOutput({ - toolCallId: data.toolCallId, - contextItems: data.contextItems, - }), - ); + if (data && typeof data === "object" && "toolCallId" in data && "contextItems" in data) { + console.log("toolCallPartialOutput", data); + // Update tool call output in Redux store + dispatch( + updateToolCallOutput({ + toolCallId: data.toolCallId, + contextItems: data.contextItems, + }), + ); + } }, [dispatch], );