From b2390fa977d15a6d1ef8bd0d53c3de82147295c3 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Fri, 11 Apr 2025 09:51:25 +0530 Subject: [PATCH] Allow attaching typescript files to chat on web app --- src/interface/web/app/common/chatFunctions.ts | 6 +++++- .../web/app/components/chatInputArea/chatInputArea.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/interface/web/app/common/chatFunctions.ts b/src/interface/web/app/common/chatFunctions.ts index be64acf1..3bf365e4 100644 --- a/src/interface/web/app/common/chatFunctions.ts +++ b/src/interface/web/app/common/chatFunctions.ts @@ -288,7 +288,7 @@ export async function packageFilesForUpload(files: FileList): Promise fileType = "text/org"; } else if (fileExtension === "md") { fileType = "text/markdown"; - } else if (fileExtension === "txt") { + } else if (fileExtension === "txt" || fileExtension === "tsx") { fileType = "text/plain"; } else if (fileExtension === "html") { fileType = "text/html"; @@ -299,12 +299,16 @@ export async function packageFilesForUpload(files: FileList): Promise "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; } else { // Skip this file if its type is not supported + console.warn( + `File type ${fileType} not supported. Skipping file: ${fileName}`, + ); resolve(); return; } } if (fileContents === null) { + console.warn(`Could not read file content. Skipping file: ${fileName}`); reject(); return; } diff --git a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx index 5f6e3515..8c247912 100644 --- a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx +++ b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx @@ -643,7 +643,7 @@ export const ChatInputArea = forwardRef((pr >