"use client" import { Network, Zap, HelpCircle } from "lucide-react" import { useDocuments } from "@/contexts/document-context" import { Loader2 } from "lucide-react" import { useState } from "react" import { Switch } from "@/components/ui/switch" import { Label } from "@/components/ui/label" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" export function GraphActions() { const { documents, processDocuments, isProcessing, openGraphVisualization } = useDocuments() const [useLangChain, setUseLangChain] = useState(false) const hasNewDocuments = documents.some((doc) => doc.status === "New") const hasProcessedDocuments = documents.some( (doc) => doc.status === "Processed" && doc.triples && doc.triples.length > 0, ) const handleProcessDocuments = async () => { try { // Get IDs of documents with "New" status const newDocumentIds = documents .filter(doc => doc.status === "New") .map(doc => doc.id); if (newDocumentIds.length === 0) { console.log("No new documents to process"); return; } await processDocuments(newDocumentIds, { useLangChain, useGraphTransformer: false, promptConfigs: undefined }); } catch (error) { console.error('Error processing documents:', error); } } return (
{ setUseLangChain(value); // Dispatch custom event to update other components window.dispatchEvent(new CustomEvent('langChainToggled', { detail: { useLangChain: value } })); }} />

Enabling LangChain uses AI-powered knowledge extraction for more accurate triple generation.

) }