diff --git a/src/app/api/ai/pipeline/route.ts b/src/app/api/ai/pipeline/route.ts index 574d45a..30c18cd 100644 --- a/src/app/api/ai/pipeline/route.ts +++ b/src/app/api/ai/pipeline/route.ts @@ -5,7 +5,7 @@ import { prisma } from "@/lib/prisma"; import { streamCompletion } from "@/server/services/ai"; import { buildPipelineSystemPrompt } from "@/lib/ai/prompts"; import { writeAuditLog } from "@/server/services/audit"; -import type { AiReviewResponse } from "@/lib/ai/types"; + import { Prisma } from "@/generated/prisma"; export async function POST(request: Request) { @@ -184,8 +184,9 @@ export async function POST(request: Request) { if (body.mode === "review" && conversationId) { let parsedSuggestions = null; try { - const parsed: AiReviewResponse = JSON.parse(fullResponse); - if (parsed.summary && Array.isArray(parsed.suggestions)) { + const { parseAiReviewResponse } = await import("@/lib/ai/suggestion-validator"); + const parsed = parseAiReviewResponse(fullResponse); + if (parsed) { parsedSuggestions = parsed.suggestions; } } catch { diff --git a/src/app/api/ai/vrl-chat/route.ts b/src/app/api/ai/vrl-chat/route.ts index 19ce91a..c4d757c 100644 --- a/src/app/api/ai/vrl-chat/route.ts +++ b/src/app/api/ai/vrl-chat/route.ts @@ -5,7 +5,7 @@ import { prisma } from "@/lib/prisma"; import { streamCompletion } from "@/server/services/ai"; import { buildVrlChatSystemPrompt } from "@/lib/ai/prompts"; import { writeAuditLog } from "@/server/services/audit"; -import type { VrlChatResponse } from "@/lib/ai/vrl-suggestion-types"; + import { Prisma } from "@/generated/prisma"; export async function POST(request: Request) { @@ -174,8 +174,9 @@ export async function POST(request: Request) { // Persist assistant response let parsedSuggestions = null; try { - const parsed: VrlChatResponse = JSON.parse(fullResponse); - if (parsed.summary && Array.isArray(parsed.suggestions)) { + const { parseVrlChatResponse } = await import("@/lib/ai/vrl-suggestion-types"); + const parsed = parseVrlChatResponse(fullResponse); + if (parsed) { parsedSuggestions = parsed.suggestions; } } catch { diff --git a/src/components/flow/ai-pipeline-dialog.tsx b/src/components/flow/ai-pipeline-dialog.tsx index 31a827f..0d6ed06 100644 --- a/src/components/flow/ai-pipeline-dialog.tsx +++ b/src/components/flow/ai-pipeline-dialog.tsx @@ -13,7 +13,7 @@ import { DialogTitle, } from "@/components/ui/dialog"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { ScrollArea } from "@/components/ui/scroll-area"; + import { useTeamStore } from "@/stores/team-store"; import { useFlowStore } from "@/stores/flow-store"; import { generateVectorYaml, importVectorConfig } from "@/lib/config-generator"; @@ -400,7 +400,7 @@ export function AiPipelineDialog({ ) : ( <> {/* Message thread */} - +
{conversation.messages.length === 0 && !conversation.isStreaming && (

@@ -439,7 +439,7 @@ export function AiPipelineDialog({

- +
{conversation.error && (
diff --git a/src/components/vrl-editor/vrl-editor.tsx b/src/components/vrl-editor/vrl-editor.tsx index 4c5ebd0..15074f0 100644 --- a/src/components/vrl-editor/vrl-editor.tsx +++ b/src/components/vrl-editor/vrl-editor.tsx @@ -577,7 +577,7 @@ export function VrlEditor({ value, onChange, sourceTypes, pipelineId, componentK e.stopPropagation()} - onFocusOutside={(e) => e.preventDefault()} + onInteractOutside={(e) => e.preventDefault()} > VRL Editor @@ -616,7 +616,7 @@ export function VrlEditor({ value, onChange, sourceTypes, pipelineId, componentK {pipelineId && upstreamSourceKeys && upstreamSourceKeys.length > 0 && ( <>