From 9151fdf8ee5589751e87e7e8a61a8f33ccf559dc Mon Sep 17 00:00:00 2001 From: Zhang Minghan Date: Mon, 18 Mar 2024 10:00:17 +0800 Subject: [PATCH] feat: support multiple file upload --- README.md | 3 ++- app/src/components/FileProvider.tsx | 1 + app/src/components/home/ChatWrapper.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a4e3856..bab895c4 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,7 @@ Translated with DeepL.com (free version) - [Golang SDK](https://github.com/Deeptrain-Community/chatnio-api-go) - [Java SDK](https://github.com/hujiayucc/ChatNio-SDK-Java) (Thanks to [@hujiayucc](https://github.com/hujiayucc)) - [PHP SDK](https://github.com/hujiayucc/ChatNio-SDK-Php) (Thanks to [@hujiayucc](https://github.com/hujiayucc)) + ## ✨ Some EXCELLENT Open-source Projects > **Frontend projects here refer to projects that focus on user chat interfaces, backend projects refer to projects that focus on API transfer and management, and one-stop projects refer to projects that include user chat interfaces and API transfer and management** - [Next Chat @yidadaa](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web) (Front-end Oriented Projects) @@ -296,7 +297,7 @@ Translated with DeepL.com (free version) - [FastGPT @labring](https://github.com/labring/FastGPT) (Knowledge Base) - [Quivr @quivrhq](https://github.com/StanGirard/quivr) (Knowledge Base) - [Bingo @weaigc](https://github.com/weaigc/bingo) (Knowledge Base) -- [Midjourney Proxy @novicezk](https://github.com/novicezk/midjourney-proxy) (Knowledge Base) +- [Midjourney Proxy @novicezk](https://github.com/novicezk/midjourney-proxy) (Model Library) ## 📄 Open Source License diff --git a/app/src/components/FileProvider.tsx b/app/src/components/FileProvider.tsx index 0ed5a1a2..ab927952 100644 --- a/app/src/components/FileProvider.tsx +++ b/app/src/components/FileProvider.tsx @@ -276,6 +276,7 @@ function FileInput({ id, loading, className, handleEvent }: FileInputProps) { onChange={(e) => handleEvent(Array.from(e.target?.files || []))} accept="*" style={{ display: "none" }} + multiple={true} // on transfer file onPaste={(e) => { const items = e.clipboardData.items; diff --git a/app/src/components/home/ChatWrapper.tsx b/app/src/components/home/ChatWrapper.tsx index f014cdfd..012d1ca9 100644 --- a/app/src/components/home/ChatWrapper.tsx +++ b/app/src/components/home/ChatWrapper.tsx @@ -51,7 +51,7 @@ function fileReducer(state: FileArray, action: Record): FileArray { case "add": return [...state, action.payload]; case "remove": - return state.filter((file) => file !== action.payload); + return state.filter((_, i) => i !== action.payload); case "clear": return []; default: