diff --git a/components/AIAssist.tsx b/components/AIAssist.tsx index cf20cec..0e3a0ba 100644 --- a/components/AIAssist.tsx +++ b/components/AIAssist.tsx @@ -18,7 +18,6 @@ import { Input } from "@/components/ui/input"; import useStore from "@/lib/store"; import { translations } from "@/lib/i18n/translations"; import modelAdapter from "@/lib/services/adapter-instance"; -import { safeJsonFetch } from "@/lib/safeJsonFetch"; // --- Types --- @@ -346,42 +345,12 @@ export default function AIAssist() { setAIAssistHistory(prev => [...prev, assistantMsg]); try { - // First, get the plan orchestrator prompt from our new API - type AiAssistApiResponse = { - prompt?: string; - step?: string; - requestId?: string; - success?: boolean; - error?: string; - }; - - const apiResult = await safeJsonFetch("/api/ai-assist", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ - request: finalInput, - step: assistStep === "plan" ? "generate" : "plan", - plan: aiPlan - }), - }); - - if (!apiResult.ok) { - console.error("AI Assist API failed:", apiResult.error); - throw new Error(apiResult.error.message); - } - - if (apiResult.data.error) { - throw new Error(apiResult.data.error); - } - - const prompt = apiResult.data.prompt ?? ""; - let accumulated = ""; let lastParsedPreview: PreviewData | null = null; const response = await modelAdapter.generateAIAssistStream( { - messages: [...aiAssistHistory, { role: "system", content: prompt } as any], + messages: [...aiAssistHistory, { role: "user" as const, content: finalInput, timestamp: new Date() }], currentAgent, onChunk: (chunk) => { accumulated += chunk;