From 80df49478713d6df0b42d5441e6e5df712335e16 Mon Sep 17 00:00:00 2001 From: Aamer Aryan Date: Sat, 31 Aug 2024 04:37:56 +0530 Subject: [PATCH 1/2] fix: add .csv support to file upload input --- frontend/src/locale/en.json | 2 +- frontend/src/upload/Upload.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/locale/en.json b/frontend/src/locale/en.json index d064c6fba..773768bd8 100644 --- a/frontend/src/locale/en.json +++ b/frontend/src/locale/en.json @@ -71,7 +71,7 @@ "remote": "Remote", "name": "Name", "choose": "Choose Files", - "info": "Please upload .pdf, .txt, .rst, .docx, .md, .zip limited to 25mb", + "info": "Please upload .pdf, .txt, .rst, .csv, .docx, .md, .zip limited to 25mb", "uploadedFiles": "Uploaded Files", "cancel": "Cancel", "train": "Train", diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index 5d5d1ac5a..c5eed6d80 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -259,6 +259,7 @@ function Upload({ 'application/zip': ['.zip'], 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['.docx'], + 'text/csv': ['.csv'], }, }); From 5c9e6404cc0ff8cd7253777ec8a5761122f0ef42 Mon Sep 17 00:00:00 2001 From: Aamer Aryan Date: Sat, 31 Aug 2024 04:45:25 +0530 Subject: [PATCH 2/2] fix: bump eslint-plugin-prettier from 4.2.1 to 5.2.1 Committer: Aamer Aryan --- frontend/package-lock.json | 65 +++++++++++++++---- frontend/package.json | 2 +- frontend/src/Navigation.tsx | 16 ++--- frontend/src/components/Dropdown.tsx | 32 ++++----- frontend/src/conversation/Conversation.tsx | 4 +- .../src/conversation/ConversationBubble.tsx | 10 +-- frontend/src/modals/DeleteConvModal.tsx | 14 ++-- frontend/src/preferences/APIKeyModal.tsx | 14 ++-- 8 files changed, 95 insertions(+), 62 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 92a2c1328..0f7675fa1 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -37,7 +37,7 @@ "eslint-config-standard-with-typescript": "^34.0.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-n": "^15.7.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-promise": "^6.6.0", "eslint-plugin-react": "^7.35.0", "eslint-plugin-unused-imports": "^2.0.0", @@ -893,6 +893,18 @@ "node": ">= 8" } }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@reduxjs/toolkit": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.2.tgz", @@ -3469,21 +3481,30 @@ "dev": true }, "node_modules/eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", "dev": true, "dependencies": { - "prettier-linter-helpers": "^1.0.0" + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.9.1" }, "engines": { - "node": ">=12.0.0" + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" }, "peerDependencies": { - "eslint": ">=7.28.0", - "prettier": ">=2.0.0" + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" }, "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, "eslint-config-prettier": { "optional": true } @@ -6434,9 +6455,9 @@ ] }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { "braces": "^3.0.3", @@ -8214,6 +8235,28 @@ "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==", "dev": true }, + "node_modules/synckit": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.1.tgz", + "integrity": "sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/synckit/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true + }, "node_modules/tailwindcss": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.2.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index bb8d2974d..e45fbd36a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -48,7 +48,7 @@ "eslint-config-standard-with-typescript": "^34.0.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-n": "^15.7.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-promise": "^6.6.0", "eslint-plugin-react": "^7.35.0", "eslint-plugin-unused-imports": "^2.0.0", diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 56342ead2..6514ba41d 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -174,16 +174,12 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { console.error(err); }); } - useOutsideAlerter( - navRef, - () => { - if (isMobile && navOpen && apiKeyModalState === 'INACTIVE') { - setNavOpen(false); - setIsDocsListOpen(false); - } - }, - [navOpen, isDocsListOpen, apiKeyModalState], - ); + useOutsideAlerter(navRef, () => { + if (isMobile && navOpen && apiKeyModalState === 'INACTIVE') { + setNavOpen(false); + setIsDocsListOpen(false); + } + }, [navOpen, isDocsListOpen, apiKeyModalState]); /* Needed to fix bug where if mobile nav was closed and then window was resized to desktop, nav would still be closed but the button to open would be gone, as per #1 on issue #146 diff --git a/frontend/src/components/Dropdown.tsx b/frontend/src/components/Dropdown.tsx index 17516aaab..adf17889c 100644 --- a/frontend/src/components/Dropdown.tsx +++ b/frontend/src/components/Dropdown.tsx @@ -91,14 +91,14 @@ function Dropdown({ {selectedValue && 'label' in selectedValue ? selectedValue.label : selectedValue && 'description' in selectedValue - ? `${ - selectedValue.value < 1e9 - ? selectedValue.value + ` (${selectedValue.description})` - : selectedValue.description - }` - : placeholder - ? placeholder - : 'From URL'} + ? `${ + selectedValue.value < 1e9 + ? selectedValue.value + ` (${selectedValue.description})` + : selectedValue.description + }` + : placeholder + ? placeholder + : 'From URL'} )} {showEdit && onEdit && ( { + useEffect(() => { fetchStream.current && fetchStream.current.abort(); - },[conversationId]); + }, [conversationId]); useEffect(() => { const observerCallback: IntersectionObserverCallback = (entries) => { diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index a21e352d0..7ec98820d 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -235,10 +235,11 @@ const ConversationBubble = forwardRef< + > + {String(children).replace(/\n$/, '')} +
{ setIsSidebarOpen(state); }} - children={} - /> + > + + )}
); diff --git a/frontend/src/modals/DeleteConvModal.tsx b/frontend/src/modals/DeleteConvModal.tsx index c2fc5e380..43ec2a650 100644 --- a/frontend/src/modals/DeleteConvModal.tsx +++ b/frontend/src/modals/DeleteConvModal.tsx @@ -19,15 +19,11 @@ export default function DeleteConvModal({ const dispatch = useDispatch(); const { isMobile } = useMediaQuery(); const { t } = useTranslation(); - useOutsideAlerter( - modalRef, - () => { - if (isMobile && modalState === 'ACTIVE') { - dispatch(setModalState('INACTIVE')); - } - }, - [modalState], - ); + useOutsideAlerter(modalRef, () => { + if (isMobile && modalState === 'ACTIVE') { + dispatch(setModalState('INACTIVE')); + } + }, [modalState]); function handleSubmit() { handleDeleteAllConv(); diff --git a/frontend/src/preferences/APIKeyModal.tsx b/frontend/src/preferences/APIKeyModal.tsx index 166bd62b8..43698fe1a 100644 --- a/frontend/src/preferences/APIKeyModal.tsx +++ b/frontend/src/preferences/APIKeyModal.tsx @@ -22,15 +22,11 @@ export default function APIKeyModal({ const modalRef = useRef(null); const { isMobile } = useMediaQuery(); - useOutsideAlerter( - modalRef, - () => { - if (isMobile && modalState === 'ACTIVE') { - setModalState('INACTIVE'); - } - }, - [modalState], - ); + useOutsideAlerter(modalRef, () => { + if (isMobile && modalState === 'ACTIVE') { + setModalState('INACTIVE'); + } + }, [modalState]); function handleSubmit() { if (key.length <= 1) {