From 626c9c6049ae6687d543644f15b8f68a70458013 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Thu, 30 Apr 2026 20:18:10 +0800 Subject: [PATCH] refactor(ai): remove action type selector, let AI auto-detect intent --- src/components/editor/AiAssistant.vue | 29 ++++----------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/components/editor/AiAssistant.vue b/src/components/editor/AiAssistant.vue index ead7571b03..737cd13219 100644 --- a/src/components/editor/AiAssistant.vue +++ b/src/components/editor/AiAssistant.vue @@ -16,7 +16,7 @@ import { import { Label } from "@/components/ui/label"; import { ScrollArea } from "@/components/ui/scroll-area"; import { useSettingsStore, type AiProvider } from "@/stores/settingsStore"; -import { buildAiContext, extractSql, runAiAction, type AiAction } from "@/lib/ai"; +import { buildAiContext, extractSql, runAiAction } from "@/lib/ai"; import type { AiMessage } from "@/lib/tauri"; import type { ConnectionConfig, QueryTab } from "@/types/database"; @@ -26,7 +26,6 @@ const settings = useSettingsStore(); interface ChatMessage { role: "user" | "assistant"; content: string; - action?: AiAction; } const props = defineProps<{ @@ -39,7 +38,6 @@ const emit = defineEmits<{ close: []; }>(); -const action = ref("generate"); const prompt = ref(""); const messages = ref([]); const isGenerating = ref(false); @@ -57,15 +55,6 @@ const providerDefaults: Record custom: { endpoint: "", model: "" }, }; -const actionLabels: Record = { - generate: "ai.actions.generate", - explain: "ai.actions.explain", - optimize: "ai.actions.optimize", - fix: "ai.actions.fix", - convert: "ai.actions.convert", - sampleData: "ai.actions.sampleData", -}; - function openSettings() { tempProvider.value = settings.aiConfig.provider; tempApiKey.value = settings.aiConfig.apiKey; @@ -107,7 +96,7 @@ async function send() { return; } - messages.value.push({ role: "user", content: text, action: action.value }); + messages.value.push({ role: "user", content: text }); prompt.value = ""; scrollToBottom(); @@ -120,7 +109,7 @@ async function send() { })); const result = await runAiAction({ config: settings.aiConfig, - action: action.value, + action: "generate", instruction: text, context, }, history); @@ -215,20 +204,10 @@ function formatMessageContent(text: string): string {
-