From 4ed46e3fed28edafa90ddd21955128d81b5589c1 Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Fri, 20 Sep 2024 15:44:36 +0800 Subject: [PATCH] fix: uploader --- .../base/chat/chat/chat-input-area/index.tsx | 23 +++++++++-- .../chat/chat/chat-input-area/operation.tsx | 6 +-- .../file-from-link-or-local/index.tsx | 5 ++- .../components/base/file-uploader/hooks.ts | 39 ++++++++++++++++--- .../components/base/file-uploader/utils.ts | 16 ++++++++ web/i18n/en-US/common.ts | 3 ++ web/i18n/zh-Hans/common.ts | 3 ++ web/service/common.ts | 4 +- 8 files changed, 84 insertions(+), 15 deletions(-) diff --git a/web/app/components/base/chat/chat/chat-input-area/index.tsx b/web/app/components/base/chat/chat/chat-input-area/index.tsx index 34175bac01..8a1289a19e 100644 --- a/web/app/components/base/chat/chat/chat-input-area/index.tsx +++ b/web/app/components/base/chat/chat/chat-input-area/index.tsx @@ -15,6 +15,7 @@ import { useTextAreaHeight } from './hooks' import Operation from './operation' import cn from '@/utils/classnames' import { FileListInChatInput } from '@/app/components/base/file-uploader' +import { useFile } from '@/app/components/base/file-uploader/hooks' import { FileContextProvider, useStore, @@ -60,6 +61,14 @@ const ChatInputArea = ({ const [showVoiceInput, setShowVoiceInput] = useState(false) const files = useStore(s => s.files) const setFiles = useStore(s => s.setFiles) + const { + handleDragFileEnter, + handleDragFileLeave, + handleDragFileOver, + handleDropFile, + handleClipboardPasteFile, + isDragActive, + } = useFile(visionConfig!) const handleSend = () => { if (onSend) { @@ -105,7 +114,7 @@ const ChatInputArea = ({ const operation = (
@@ -134,8 +144,10 @@ const ChatInputArea = ({