From d802c718a445f1e387417cf1b79ce4387d146a82 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 16 Jun 2025 13:28:31 +0400 Subject: [PATCH] refac: max file count behaviour --- src/lib/components/chat/MessageInput.svelte | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 78090c7bd..867db32a6 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -307,6 +307,19 @@ const inputFilesHandler = async (inputFiles) => { console.log('Input files handler called with:', inputFiles); + + if ( + ($config?.file?.max_count ?? null) !== null && + files.length + inputFiles.length > $config?.file?.max_count + ) { + toast.error( + $i18n.t(`You can only chat with a maximum of {{maxCount}} file(s) at a time.`, { + maxCount: $config?.file?.max_count + }) + ); + return; + } + inputFiles.forEach((file) => { console.log('Processing file:', { name: file.name,