22// SPDX-License-Identifier: Apache-2.0
33
44import { WaveUIMessagePart } from "@/app/aipanel/aitypes" ;
5+ import { ErrorBoundary } from "@/app/element/errorboundary" ;
56import { atoms , getSettingsKeyAtom } from "@/app/store/global" ;
67import { globalStore } from "@/app/store/jotaiStore" ;
78import { getWebServerEndpoint } from "@/util/endpoints" ;
@@ -24,7 +25,7 @@ interface AIPanelProps {
2425 onClose ?: ( ) => void ;
2526}
2627
27- const AIPanelComponent = memo ( ( { className, onClose } : AIPanelProps ) => {
28+ const AIPanelComponentInner = memo ( ( { className, onClose } : AIPanelProps ) => {
2829 const [ input , setInput ] = useState ( "" ) ;
2930 const [ isDragOver , setIsDragOver ] = useState ( false ) ;
3031 const model = WaveAIModel . getInstance ( ) ;
@@ -220,9 +221,11 @@ const AIPanelComponent = memo(({ className, onClose }: AIPanelProps) => {
220221
221222 if ( acceptableFiles . length < files . length ) {
222223 const rejectedCount = files . length - acceptableFiles . length ;
223- const rejectedFiles = files . filter ( f => ! isAcceptableFile ( f ) ) ;
224- const fileNames = rejectedFiles . map ( f => f . name ) . join ( ", " ) ;
225- model . setError ( `${ rejectedCount } file${ rejectedCount > 1 ? 's' : '' } rejected (unsupported type): ${ fileNames } . Supported: images, PDFs, and text/code files.` ) ;
224+ const rejectedFiles = files . filter ( ( f ) => ! isAcceptableFile ( f ) ) ;
225+ const fileNames = rejectedFiles . map ( ( f ) => f . name ) . join ( ", " ) ;
226+ model . setError (
227+ `${ rejectedCount } file${ rejectedCount > 1 ? "s" : "" } rejected (unsupported type): ${ fileNames } . Supported: images, PDFs, and text/code files.`
228+ ) ;
226229 }
227230 } ;
228231
@@ -332,6 +335,16 @@ const AIPanelComponent = memo(({ className, onClose }: AIPanelProps) => {
332335 ) ;
333336} ) ;
334337
338+ AIPanelComponentInner . displayName = "AIPanelInner" ;
339+
340+ const AIPanelComponent = ( { className, onClose } : AIPanelProps ) => {
341+ return (
342+ < ErrorBoundary >
343+ < AIPanelComponentInner className = { className } onClose = { onClose } />
344+ </ ErrorBoundary >
345+ ) ;
346+ } ;
347+
335348AIPanelComponent . displayName = "AIPanel" ;
336349
337350export { AIPanelComponent as AIPanel } ;
0 commit comments