diff --git a/web/src/App.jsx b/web/src/App.jsx index b57da89..8743d54 100644 --- a/web/src/App.jsx +++ b/web/src/App.jsx @@ -18,6 +18,38 @@ For commercial licensing, please contact support@quantumnous.com */ import React, { lazy, Suspense, useContext, useMemo } from 'react'; + +class ErrorBoundary extends React.Component { + constructor(props) { + super(props); + this.state = { hasError: false, error: null, info: null }; + } + static getDerivedStateFromError(error) { + return { hasError: true, error }; + } + componentDidCatch(error, info) { + this.setState({ info }); + console.error('ErrorBoundary caught:', error, info); + } + render() { + if (this.state.hasError) { + return ( +
{this.state.error?.stack}
+ {this.state.info?.componentStack}
+ +
当前协议:{format === 'anthropic' ? 'Anthropic Messages' : 'OpenAI Chat Completions'} · 请求地址 {finalEndpoint}