Ver código fonte

refac: max file count behaviour

Timothy Jaeryang Baek 3 meses atrás
pai
commit
d802c718a4
1 arquivos alterados com 13 adições e 0 exclusões
  1. 13 0
      src/lib/components/chat/MessageInput.svelte

+ 13 - 0
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,