File tree Expand file tree Collapse file tree
client/packages/lowcoder/src/comps/comps/chatComp/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type {
55 Attachment ,
66 ThreadUserContentPart
77 } from "@assistant-ui/react" ;
8+ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances" ;
89
910 const MAX_FILE_SIZE = 10 * 1024 * 1024 ; // 10 MB
1011
@@ -13,6 +14,9 @@ import type {
1314
1415 async add ( { file } ) : Promise < PendingAttachment > {
1516 if ( file . size > MAX_FILE_SIZE ) {
17+ messageInstance . error (
18+ `File "${ file . name } " exceeds the 10 MB size limit (${ ( file . size / 1024 / 1024 ) . toFixed ( 1 ) } MB).`
19+ ) ;
1620 throw new Error (
1721 `File "${ file . name } " exceeds the 10 MB size limit (${ ( file . size / 1024 / 1024 ) . toFixed ( 1 ) } MB).`
1822 ) ;
@@ -48,9 +52,9 @@ import type {
4852 mimeType : attachment . file . type ,
4953 } ] ;
5054 } catch ( err ) {
51- throw new Error (
52- `Failed to process attachment " ${ attachment . name } ": ${ err instanceof Error ? err . message : "unknown error" } `
53- ) ;
55+ const errorMessage = `Failed to process attachment " ${ attachment . name } ": ${ err instanceof Error ? err . message : "unknown error" } ` ;
56+ messageInstance . error ( errorMessage ) ;
57+ throw new Error ( errorMessage ) ;
5458 }
5559
5660 return {
You can’t perform that action at this time.
0 commit comments