Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(ai): make reasoning expand/collapse consistent across messages

Abeautifulsnow09f9e446616c
diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue
index d34bfb33cf..726fe2b581 100644
--- a/apps/desktop/src/components/editor/AiAssistant.vue
+++ b/apps/desktop/src/components/editor/AiAssistant.vue
@@ -511,7 +511,7 @@ function appendAssistantReasoning(assistantIdx: number, delta: string) {
scrollToBottom();
}
-const expandedReasoning = ref<Set<number>>(new Set());
+const reasoningExpanded = ref(false);
const expandedSteps = ref<Set<string>>(new Set());
function toggleStep(key: string) {
@@ -626,14 +626,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 scrollToBottom() {
@@ -1324,16 +1318,16 @@ async function openExternalUrl(url: string) {
<div v-else-if="msg.content || msg.reasoning || msg.isThinking" class="flex">
<div class="max-w-[95%] min-w-0 rounded-lg bg-muted px-3 py-2 text-xs leading-relaxed">
<div v-if="msg.reasoning || msg.isThinking" class="mb-2">
- <button class="flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors" @click="toggleReasoning(i)">
- <ChevronRight class="h-3 w-3 transition-transform duration-200" :class="{ 'rotate-90': expandedReasoning.has(i) || msg.isThinking }" />
+ <button class="flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors" @click="toggleReasoning()">
+ <ChevronRight class="h-3 w-3 transition-transform duration-200" :class="{ 'rotate-90': reasoningExpanded }" />
<Loader2 v-if="msg.isThinking" class="h-3 w-3 animate-spin" />
<span>{{ t("ai.reasoningProcess") }}</span>
</button>
<div
class="overflow-hidden transition-[max-height,opacity] duration-200 ease-in-out"
:style="{
- maxHeight: expandedReasoning.has(i) || msg.isThinking ? '20000px' : '0px',
- opacity: expandedReasoning.has(i) || msg.isThinking ? '1' : '0',
+ maxHeight: reasoningExpanded ? '20000px' : '0px',
+ opacity: reasoningExpanded ? '1' : '0',
}"
>
<div class="mt-1.5 pl-4 border-l-2 border-muted-foreground/20 text-[11px] text-muted-foreground whitespace-pre-wrap">