diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue index 29b36147f..9b9dc8861 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 3b32d0764..83dddfde2 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 { Ok(dbx_core::ai::cancel_stream(&session_id).await)