From cef3e122ff284e25edb7d5b339bc7456113a4dbc Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Thu, 14 Aug 2025 13:39:38 +0700 Subject: [PATCH] chore: send attachment file when send message --- web-app/src/containers/ChatInput.tsx | 17 ++- web-app/src/containers/ThreadContent.tsx | 152 ++++++++++++++++++++--- web-app/src/hooks/useChat.ts | 16 ++- web-app/src/lib/completion.ts | 68 +++++++--- web-app/src/lib/messages.ts | 117 ++++++++++++++--- 5 files changed, 316 insertions(+), 54 deletions(-) diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx index 0cd9c523e..e711804a8 100644 --- a/web-app/src/containers/ChatInput.tsx +++ b/web-app/src/containers/ChatInput.tsx @@ -100,11 +100,16 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => { setMessage('Please select a model to start chatting.') return } - if (!prompt.trim()) { + if (!prompt.trim() && uploadedFiles.length === 0) { return } setMessage('') - sendMessage(prompt) + sendMessage( + prompt, + true, + uploadedFiles.length > 0 ? uploadedFiles : undefined + ) + setUploadedFiles([]) } useEffect(() => { @@ -629,9 +634,13 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => { ) : (