feat: support multiple file upload

This commit is contained in:
Zhang Minghan 2024-03-18 10:00:17 +08:00
parent d183ed3224
commit 9151fdf8ee
3 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -51,7 +51,7 @@ function fileReducer(state: FileArray, action: Record<string, any>): 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: