💻 fix(client): Allow Code Filetypes and Suppress Known Vite Warnings (#2492)

* refactor(vite): suppress known warnings

* fix: allow known code filetypes if there is a mismatch of expected type, or originalFile.type is empty

* refactor(useFileHandling): naming, use variable
This commit is contained in:
Danny Avila 2024-04-22 20:08:34 -04:00 committed by GitHub
parent 738207de50
commit f94a782b4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 10 deletions

View file

@ -127,8 +127,24 @@ export const codeInterpreterMimeTypes = [
imageMimeTypes,
];
export const codeTypeMapping: { [key: string]: string } = {
c: 'text/x-c',
cs: 'text/x-csharp',
cpp: 'text/x-c++',
md: 'text/markdown',
php: 'text/x-php',
py: 'text/x-python',
rb: 'text/x-ruby',
tex: 'text/x-tex',
js: 'text/javascript',
sh: 'application/x-sh',
ts: 'application/typescript',
tar: 'application/x-tar',
zip: 'application/zip',
};
export const retrievalMimeTypes = [
/^(text\/(x-c|x-c\+\+|html|x-java|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain))$/,
/^(text\/(x-c|x-c\+\+|html|x-java|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|xml))$/,
/^(application\/(json|pdf|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation)))$/,
];