From 1cfb39a7b07b45d361f37fbb35b0a880e904621d Mon Sep 17 00:00:00 2001 From: Abeautifulsnow Date: Thu, 9 Jul 2026 13:17:23 +0800 Subject: [PATCH] fix(ai): restore global reasoning toggle accidentally reverted by d90847bb fix(ai): restore global reasoning toggle accidentally reverted by d90847bb Commit 09f9e446 replaced per-message expandedReasoning (Set) with a global reasoningExpanded boolean ref, defaulting to collapsed so all messages share the same toggle state. This avoided the flip-flop where reasoning auto-expanded during streaming and collapsed afterward. Commit d90847bb (SQL file references) inadvertently reverted this when resolving merge conflicts during its large template restructure. Changes: - Replace expandedReasoning (Set) with reasoningExpanded (ref(false)) - Replace per-index toggleReasoning(i) with global toggleReasoning() - Template uses reasoningExpanded instead of expandedReasoning.has(i) || msg.isThinking @ --- .../src/components/editor/AiAssistant.vue | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue index 896be7c9d..75e21db60 100644 --- a/apps/desktop/src/components/editor/AiAssistant.vue +++ b/apps/desktop/src/components/editor/AiAssistant.vue @@ -611,7 +611,7 @@ function appendAssistantReasoning(assistantIdx: number, delta: string) { scrollToBottom(); } -const expandedReasoning = ref>(new Set()); +const reasoningExpanded = ref(false); const expandedSteps = ref>(new Set()); function toggleStep(key: string) { @@ -726,14 +726,8 @@ function agentEventToStep(event: AgentEvent, index: number): AiAgentStepItem | u }; } -function toggleReasoning(index: number) { - const next = new Set(expandedReasoning.value); - if (next.has(index)) { - next.delete(index); - } else { - next.add(index); - } - expandedReasoning.value = next; +function toggleReasoning() { + reasoningExpanded.value = !reasoningExpanded.value; } function getMessageScrollViewport(): HTMLElement | null { @@ -1800,16 +1794,16 @@ async function openExternalUrl(url: string) {
-