mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 21:29:12 +00:00
Allow attaching typescript files to chat on web app
This commit is contained in:
@@ -288,7 +288,7 @@ export async function packageFilesForUpload(files: FileList): Promise<FormData>
|
|||||||
fileType = "text/org";
|
fileType = "text/org";
|
||||||
} else if (fileExtension === "md") {
|
} else if (fileExtension === "md") {
|
||||||
fileType = "text/markdown";
|
fileType = "text/markdown";
|
||||||
} else if (fileExtension === "txt") {
|
} else if (fileExtension === "txt" || fileExtension === "tsx") {
|
||||||
fileType = "text/plain";
|
fileType = "text/plain";
|
||||||
} else if (fileExtension === "html") {
|
} else if (fileExtension === "html") {
|
||||||
fileType = "text/html";
|
fileType = "text/html";
|
||||||
@@ -299,12 +299,16 @@ export async function packageFilesForUpload(files: FileList): Promise<FormData>
|
|||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||||
} else {
|
} else {
|
||||||
// Skip this file if its type is not supported
|
// Skip this file if its type is not supported
|
||||||
|
console.warn(
|
||||||
|
`File type ${fileType} not supported. Skipping file: ${fileName}`,
|
||||||
|
);
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileContents === null) {
|
if (fileContents === null) {
|
||||||
|
console.warn(`Could not read file content. Skipping file: ${fileName}`);
|
||||||
reject();
|
reject();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ export const ChatInputArea = forwardRef<HTMLTextAreaElement, ChatInputProps>((pr
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
accept=".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp,.py,.js,.json,.html,.css"
|
accept=".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp,.py,.tsx,.js,.json,.html,.css"
|
||||||
multiple={true}
|
multiple={true}
|
||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
onChange={handleFileChange}
|
onChange={handleFileChange}
|
||||||
|
|||||||
Reference in New Issue
Block a user