From 2690fc7f1dca5b40a97b378ac74077a191e649a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Bul=C3=A1nek?=
Date: Fri, 25 Oct 2024 08:48:30 +0200
Subject: [PATCH] fix(knowledge): opening file input window (#27)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Bulánek
---
.../knowledge/files/KnowledgeFilesUpload.tsx | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/modules/knowledge/files/KnowledgeFilesUpload.tsx b/src/modules/knowledge/files/KnowledgeFilesUpload.tsx
index 9ed8a92e..38781f7e 100644
--- a/src/modules/knowledge/files/KnowledgeFilesUpload.tsx
+++ b/src/modules/knowledge/files/KnowledgeFilesUpload.tsx
@@ -14,17 +14,17 @@
* limitations under the License.
*/
+import { useToast } from '@/layout/providers/ToastProvider';
+import { FeatureName, isFeatureEnabled } from '@/utils/isFeatureEnabled';
+import { FileUploaderItem } from '@carbon/react';
import { CloudUpload } from '@carbon/react/icons';
-import classes from './KnowledgeFilesUpload.module.scss';
-import { useDropzone, ErrorCode, FileRejection } from 'react-dropzone';
+import clsx from 'clsx';
+import mimeType from 'mime-types';
import { Dispatch, SetStateAction, SyntheticEvent, useCallback } from 'react';
+import { ErrorCode, FileRejection, useDropzone } from 'react-dropzone';
import { v4 as uuid } from 'uuid';
-import mimeType from 'mime-types';
-import clsx from 'clsx';
-import { FileUploaderItem } from '@carbon/react';
-import { useToast } from '@/layout/providers/ToastProvider';
+import classes from './KnowledgeFilesUpload.module.scss';
import { VectoreStoreFileUpload } from './VectorStoreFilesUploadProvider';
-import { FeatureName, isFeatureEnabled } from '@/utils/isFeatureEnabled';
interface Props {
files: VectoreStoreFileUpload[];
@@ -62,7 +62,7 @@ export function KnowledgeFilesUpload({ files, disabled, onSetFiles }: Props) {
[addToast],
);
- const { getRootProps, isDragActive } = useDropzone({
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDropAccepted,
onDropRejected,
accept: DROPZONE_ALLOWED_MIME_TYPES,
@@ -92,6 +92,8 @@ export function KnowledgeFilesUpload({ files, disabled, onSetFiles }: Props) {
Drag & drop or attach files
+
+
Supports files up to {HUMAN_MAX_SIZE}. Accepted formats: text (
{HUMAN_ALLOWED_EXTENSIONS_TEXT})