Skip to content

Commit 47058be

Browse files
committed
fix: when user submits edit - join all steered messages together
AdminForth/1786/ability-to-edit-agent-prompt-a
1 parent 6778937 commit 47058be

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

custom/composables/agentStore/useAgentChat.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,16 @@ export function createAgentChatManager({
313313
return;
314314
}
315315
await stopActiveTurnAndWaitForIdle();
316+
// The edited text already folds in the turn's steer sub-messages, so drop those extra
317+
// user messages first — otherwise they linger after the edit as duplicate bubbles.
318+
const withoutTurnSteers = chat.messages.filter((message: any) =>
319+
message.id === messageId
320+
|| message.role !== 'user'
321+
|| message.metadata?.turnId !== turnId
322+
);
323+
if (withoutTurnSteers.length !== chat.messages.length) {
324+
chat.messages = withoutTurnSteers;
325+
}
316326
editingTurnId.value = turnId;
317327
lastMessage.value = text;
318328
try {

0 commit comments

Comments
 (0)