From 96fc5724efd406cee1cfbe163b2b20692a98305d Mon Sep 17 00:00:00 2001 From: LDD19 <25827839+LDD19@users.noreply.github.com> Date: Mon, 12 Aug 2024 11:55:50 -0400 Subject: [PATCH] Fix CSV MIME type issue when uploading Upload wasn't working so I added a few more file types: -'text/csv', -'application/vnd.ms-excel', -'application/csv', -'text/plain' --- apps/postgres-new/components/chat.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/postgres-new/components/chat.tsx b/apps/postgres-new/components/chat.tsx index cecdf0ae..3ad6945b 100644 --- a/apps/postgres-new/components/chat.tsx +++ b/apps/postgres-new/components/chat.tsx @@ -73,7 +73,16 @@ export default function Chat() { const sendCsv = useCallback( async (file: File) => { - if (file.type !== 'text/csv') { + + // List of acceptable MIME types for CSV files + const validCsvMimeTypes = [ + 'text/csv', + 'application/vnd.ms-excel', + 'application/csv', + 'text/plain' + ]; + + if (!validCsvMimeTypes.includes(file.type)) { // Add an artificial tool call requesting the CSV // with an error indicating the file wasn't a CSV appendMessage({