Skip to content

Commit

Permalink
Image filetype support, 100% of what openai allows, ignore caps
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed Dec 7, 2023
1 parent d41c58c commit b54926e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"availble"
]
}
4 changes: 2 additions & 2 deletions src/components/Chat/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export const ChatInput = ({
const validImageTypes = ['.jpg', '.jpeg', '.png'];

const isImageValid = (fileName: string): boolean => {
const ext = fileName.slice(((fileName.lastIndexOf(".") - 1) >>> 0) + 2);
const ext = fileName.slice(((fileName.lastIndexOf(".") - 1) >>> 0) + 2).toLowerCase();
return validImageTypes.includes(`.${ext}`);
}

Expand Down Expand Up @@ -467,7 +467,7 @@ export const ChatInput = ({
withCloseButton: true,
onClose: () => console.log('error unmounted'),
onOpen: () => console.log('error mounted'),
autoClose: 4000,
autoClose: 8000,
title: 'Invalid Image Type',
message: 'Unsupported file type. Please upload .jpg or .png images.',
color: 'red',
Expand Down

0 comments on commit b54926e

Please sign in to comment.