From 406bc6418e0ccf114a9317691d810028c50944c9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 24 Mar 2026 16:18:57 +0800 Subject: [PATCH] fix: send explicit agent composer context --- components/agents/AgentGenerationWorkspaceDarkV2.tsx | 8 +++++++- components/agents/AgentGenerationWorkspaceNew.tsx | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/agents/AgentGenerationWorkspaceDarkV2.tsx b/components/agents/AgentGenerationWorkspaceDarkV2.tsx index ac951876a..2cb4892d9 100644 --- a/components/agents/AgentGenerationWorkspaceDarkV2.tsx +++ b/components/agents/AgentGenerationWorkspaceDarkV2.tsx @@ -1079,10 +1079,16 @@ export function AgentGenerationWorkspaceDarkV2({ id: rawChatId, message: request.messages.at(-1), hiddenPrompt: hiddenPromptRef.current || undefined, - agentPresetId: transportState.selectedAgentPresetId || undefined, + agentPresetId: + transportState.selectedAgentPresetId || selectedAgentPresetId || undefined, selectedChatModel: transportState.selectedModelId, + composerMode: "agent" as const, selectedVisibilityType: "private", imageParams: transportState.imageParams, + contextPayload: { + source: "chat" as const, + projectId, + }, agentModePayload: replacementModePayload, }, }; diff --git a/components/agents/AgentGenerationWorkspaceNew.tsx b/components/agents/AgentGenerationWorkspaceNew.tsx index 34d5e1dee..815595ef3 100644 --- a/components/agents/AgentGenerationWorkspaceNew.tsx +++ b/components/agents/AgentGenerationWorkspaceNew.tsx @@ -363,10 +363,16 @@ export function AgentGenerationWorkspaceNew({ id: rawChatId, message: request.messages.at(-1), hiddenPrompt: hiddenPromptRef.current || undefined, - agentPresetId: transportState.selectedAgentPresetId || undefined, + agentPresetId: + transportState.selectedAgentPresetId || selectedAgentPresetId || undefined, selectedChatModel: transportState.selectedModelId, + composerMode: "agent" as const, selectedVisibilityType: "private", imageParams: transportState.imageParams, + contextPayload: { + source: "chat" as const, + projectId, + }, }, }; },