import React, { useCallback, useState } from 'react'; import { ErrorBoundary as ReactErrorBoundary } from 'react-error-boundary'; function ErrorFallback({ error, resetErrorBoundary, showDetails, componentStack }) { return (

Something went wrong

An error occurred while loading the chat interface.

{showDetails && error && (
Error Details
                {error.toString()}
                {componentStack}
              
)}
); } function ErrorBoundary({ children, showDetails = false, onRetry = undefined, resetKeys = undefined }) { const [componentStack, setComponentStack] = useState(null); const handleError = useCallback((error, errorInfo) => { console.error('ErrorBoundary caught an error:', error, errorInfo); setComponentStack(errorInfo?.componentStack || null); }, []); const handleReset = useCallback(() => { setComponentStack(null); onRetry?.(); }, [onRetry]); const renderFallback = useCallback(({ error, resetErrorBoundary }) => ( ), [showDetails, componentStack]); return ( {children} ); } export default ErrorBoundary;