Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(conversation): stop duplicating AskUserQuestion answers in client runtime (#17939)

YuTengjing7ea48ad9a7ac
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.test.ts b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.test.ts
index deedcd3f12d..d9eb825b582 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.test.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.test.ts
@@ -95,7 +95,10 @@ describe('customInteractionHandlers', () => {
const result = await prepareCustomInteractionSubmit(identifier, payload, { apiName });
expect(result).toEqual({
- options: { pluginState: { askUserAnswers: payload } },
+ // createUserMessage must stay false: the completed tool card already
+ // renders the answers, so a synthetic user message would duplicate them
+ // in the client runtime (LOBE-12835).
+ options: { createUserMessage: false, pluginState: { askUserAnswers: payload } },
payload,
});
});
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts
index 10440ac4238..8266ae6e79c 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts
@@ -134,8 +134,13 @@ const customInteractionSubmitHandlers: Array<{
match: (identifier: string, apiName?: string) => boolean;
}> = [
{
+ // `createUserMessage: false` — the completed tool card already renders the
+ // answers from `pluginState.askUserAnswers`, so the client runtime must
+ // resume from the tool result instead of synthesizing a `role: 'user'`
+ // message (which duplicated the answer as a user bubble). This also aligns
+ // with the Gateway resume path, which never creates a user turn here.
handler: async (payload) => ({
- options: { pluginState: { askUserAnswers: payload } },
+ options: { createUserMessage: false, pluginState: { askUserAnswers: payload } },
payload,
}),
match: isAskUserQuestionCall,