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 error

runstone094412d9562a
diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue
index 29b36147fe..9b9dc8861f 100644
--- a/apps/desktop/src/components/editor/AiAssistant.vue
+++ b/apps/desktop/src/components/editor/AiAssistant.vue
@@ -203,9 +203,6 @@ async function changeConnection(connectionId: string) {
} catch (e: unknown) {
const message = e instanceof Error ? e.message : String(e);
toast(t("connection.connectFailed", { message: translateBackendError(t, message) }), 5000);
- } catch (e: unknown) {
- const message = e instanceof Error ? e.message : String(e);
- toast(t("connection.connectFailed", { message: translateBackendError(t, message) }), 5000);
}
}
@@ -374,13 +371,10 @@ async function loadMentionCandidates(query: string) {
mentionCache.value[key] = candidates.slice(0, 40);
mentionCandidates.value = mentionCache.value[key];
mentionSelectedIndex.value = 0;
- } catch (e: unknown) {
} catch (e: unknown) {
if (requestId !== mentionRequestId) return;
const message = e instanceof Error ? e.message : String(e);
mentionError.value = translateBackendError(t, message);
- const message = e instanceof Error ? e.message : String(e);
- mentionError.value = translateBackendError(t, message);
mentionCandidates.value = [];
} finally {
if (requestId === mentionRequestId) mentionLoading.value = false;
@@ -508,7 +502,6 @@ async function send() {
const sessionId = uuid();
currentSessionId.value = sessionId;
const agentEvents: AgentEvent[] = [];
- const agentEvents: AgentEvent[] = [];
try {
const context = await buildAiContext(props.tab, props.connection, {
mentionedTables,
@@ -517,7 +510,6 @@ async function send() {
role: m.role,
content: m.content,
}));
- await runAgentStream(
await runAgentStream(
{
config: settings.aiConfig,
@@ -562,9 +554,6 @@ async function send() {
} catch (e: unknown) {
const message = e instanceof Error ? e.message : String(e);
messages.value[assistantIdx].content = `Error: ${message}`;
- } catch (e: unknown) {
- const message = e instanceof Error ? e.message : String(e);
- messages.value[assistantIdx].content = `Error: ${message}`;
} finally {
const msg = messages.value[assistantIdx];
if (msg) msg.isThinking = false;
@@ -631,9 +620,6 @@ async function copyCode(code: string, key: string) {
} catch (e: unknown) {
const message = e instanceof Error ? e.message : String(e);
toast(t("grid.copyFailed", { message }), 5000);
- } catch (e: unknown) {
- const message = e instanceof Error ? e.message : String(e);
- toast(t("grid.copyFailed", { message }), 5000);
}
}
@@ -698,7 +684,6 @@ onMounted(async () => {
onUnmounted(() => {
clearTimeout(mentionTimer);
cancelStream();
- cancelStream();
});
function triggerAction(action: AiAction, instruction?: string) {
diff --git a/src-tauri/src/commands/ai.rs b/src-tauri/src/commands/ai.rs
index 3b32d07644..83dddfde23 100644
--- a/src-tauri/src/commands/ai.rs
+++ b/src-tauri/src/commands/ai.rs
@@ -46,10 +46,6 @@ use dbx_core::agent_events::AgentEvent;
use dbx_core::agent_loop::{run_agent_loop, AgentLoopContext};
use dbx_core::models::connection::DatabaseType;
-use dbx_core::agent_events::AgentEvent;
-use dbx_core::agent_loop::{run_agent_loop, AgentLoopContext};
-use dbx_core::models::connection::DatabaseType;
-
#[tauri::command]
pub async fn ai_cancel_stream(session_id: String) -> Result<bool, String> {
Ok(dbx_core::ai::cancel_stream(&session_id).await)