"use client"; import { motion, AnimatePresence } from "framer-motion"; import { useState, useEffect } from "react"; interface ExtractNodePanelProps { nodeData: any; onUpdate: (nodeId: string, updates: any) => void; onClose: () => void; onAddMCP: () => void; } export default function ExtractNodePanel({ nodeData, onUpdate, onClose, onAddMCP, }: ExtractNodePanelProps) { const [instructions, setInstructions] = useState(nodeData?.instructions || 'Extract information from the input'); const [model, setModel] = useState(nodeData?.model || 'gpt-4o'); const [customModel, setCustomModel] = useState(''); const [jsonSchema, setJsonSchema] = useState( nodeData?.jsonSchema || JSON.stringify({ type: "object", properties: { title: { type: "string", description: "The title" }, summary: { type: "string", description: "A brief summary" }, }, required: ["title"] }, null, 2) ); const [schemaError, setSchemaError] = useState(''); // Validate JSON schema useEffect(() => { try { JSON.parse(jsonSchema); setSchemaError(''); } catch (e) { setSchemaError('Invalid JSON'); } }, [jsonSchema]); useEffect(() => { onUpdate(nodeData?.id, { instructions, model, jsonSchema, nodeType: 'extract', }); }, [instructions, model, jsonSchema, nodeData?.id, onUpdate]); return ( {/* Header */}

Extract (Schema)

Use LLM to extract structured data with a JSON schema

{/* Content */}
{/* Instructions */}