Skip to content

Commit

Permalink
fix(knowledge): opening file input window (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Bulánek <[email protected]>
  • Loading branch information
PetrBulanek authored Oct 25, 2024
1 parent 69eb291 commit 2690fc7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/modules/knowledge/files/KnowledgeFilesUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -92,6 +92,8 @@ export function KnowledgeFilesUpload({ files, disabled, onSetFiles }: Props) {
Drag & drop or <a role="button">attach files</a>
</p>

<input type="file" {...getInputProps()} />

<p className={classes.description}>
Supports files up to {HUMAN_MAX_SIZE}. Accepted formats: text (
{HUMAN_ALLOWED_EXTENSIONS_TEXT})
Expand Down

0 comments on commit 2690fc7

Please sign in to comment.