diff --git a/client/src/components/Files/ActionButton.tsx b/client/src/components/Files/ActionButton.tsx deleted file mode 100644 index 9537c238a9..0000000000 --- a/client/src/components/Files/ActionButton.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import { Button } from '@librechat/client'; -import { useLocalize } from '~/hooks'; - -type ActionButtonProps = { - onClick: () => void; -}; - -export default function ActionButton({ onClick }: ActionButtonProps) { - const localize = useLocalize(); - return ( -
- -
- ); -} diff --git a/client/src/components/Files/DeleteIconButton.tsx b/client/src/components/Files/DeleteIconButton.tsx deleted file mode 100644 index a28b88e0d5..0000000000 --- a/client/src/components/Files/DeleteIconButton.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { Button, TrashIcon } from '@librechat/client'; - -type DeleteIconButtonProps = { - onClick: () => void; -}; - -export default function DeleteIconButton({ onClick }: DeleteIconButtonProps) { - return ( -
- -
- ); -} diff --git a/client/src/components/Files/FileDashboardView.tsx b/client/src/components/Files/FileDashboardView.tsx deleted file mode 100644 index 20d7a7800a..0000000000 --- a/client/src/components/Files/FileDashboardView.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react'; -import VectorStoreSidePanel from './VectorStore/VectorStoreSidePanel'; -import { Outlet, useNavigate, useParams } from 'react-router-dom'; -import { Button } from '../ui'; - -const FileDashboardView = () => { - const params = useParams(); - const navigate = useNavigate(); - return ( -
-
- {params.vectorStoreId && ( - - )} -
-
-
- -
-
-
- -
-
-
-
- ); -}; - -export default FileDashboardView; diff --git a/client/src/components/Files/FileList/DataTableFile.tsx b/client/src/components/Files/FileList/DataTableFile.tsx deleted file mode 100644 index c6ae258b5a..0000000000 --- a/client/src/components/Files/FileList/DataTableFile.tsx +++ /dev/null @@ -1,277 +0,0 @@ -import * as React from 'react'; -import { ListFilter } from 'lucide-react'; -import { useSetRecoilState } from 'recoil'; -import { FileContext } from 'librechat-data-provider'; -import { - flexRender, - getCoreRowModel, - getFilteredRowModel, - getPaginationRowModel, - getSortedRowModel, - useReactTable, -} from '@tanstack/react-table'; -import { - Input, - Table, - Button, - Spinner, - TableRow, - TableBody, - TableCell, - TableHead, - TrashIcon, - TableHeader, - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, - DropdownMenuCheckboxItem, -} from '@librechat/client'; -import type { - ColumnDef, - SortingState, - VisibilityState, - ColumnFiltersState, -} from '@tanstack/react-table'; -import type { TFile } from 'librechat-data-provider'; -import type { AugmentedColumnDef } from '~/common'; -import ActionButton from '~/components/Files/ActionButton'; -import { useDeleteFilesFromTable } from '~/hooks/Files'; -import UploadFileButton from './UploadFileButton'; -import { useLocalize } from '~/hooks'; -import store from '~/store'; - -interface DataTableProps { - columns: ColumnDef[]; - data: TData[]; -} - -const contextMap = { - [FileContext.filename]: 'com_ui_name', - [FileContext.updatedAt]: 'com_ui_date', - [FileContext.filterSource]: 'com_ui_storage', - [FileContext.context]: 'com_ui_context', - [FileContext.bytes]: 'com_ui_size', -}; - -type Style = { width?: number | string; maxWidth?: number | string; minWidth?: number | string }; - -export default function DataTableFile({ - columns, - data, -}: DataTableProps) { - const localize = useLocalize(); - const setFiles = useSetRecoilState(store.filesByIndex(0)); - const [isDeleting, setIsDeleting] = React.useState(false); - const { deleteFiles } = useDeleteFilesFromTable(() => setIsDeleting(false)); - - const [rowSelection, setRowSelection] = React.useState({}); - const [sorting, setSorting] = React.useState([]); - const [columnFilters, setColumnFilters] = React.useState([]); - const [columnVisibility, setColumnVisibility] = React.useState({}); - - const table = useReactTable({ - data, - columns, - onSortingChange: setSorting, - getCoreRowModel: getCoreRowModel(), - getSortedRowModel: getSortedRowModel(), - onColumnFiltersChange: setColumnFilters, - getFilteredRowModel: getFilteredRowModel(), - onColumnVisibilityChange: setColumnVisibility, - getPaginationRowModel: getPaginationRowModel(), - onRowSelectionChange: setRowSelection, - state: { - sorting, - columnFilters, - columnVisibility, - rowSelection, - }, - }); - - return ( - <> -
-

- {localize('com_ui_files')} -

-
-
- { - console.log('click'); - }} - /> - -
-
- {' '} - - - - - - {table - .getAllColumns() - .filter((column) => column.getCanHide()) - .map((column) => { - return ( - column.toggleVisibility(Boolean(value))} - > - {localize(contextMap[column.id])} - - ); - })} - - - table.getColumn('filename')?.setFilterValue(event.target.value)} - className="max-w-sm border-border-medium placeholder:text-text-secondary" - /> - console.log('click')} /> -
-
-
-
- - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header, index) => { - const style: Style = { maxWidth: '32px', minWidth: '125px' }; - if (header.id === 'filename') { - style.maxWidth = '25%'; - style.width = '25%'; - style.minWidth = '150px'; - } - if (header.id === 'icon') { - style.width = '25px'; - style.maxWidth = '25px'; - style.minWidth = '35px'; - } - if (header.id === 'vectorStores') { - style.maxWidth = '50%'; - style.width = '50%'; - style.minWidth = '300px'; - } - - if (index === 0 && header.id === 'select') { - style.width = '25px'; - style.maxWidth = '25px'; - style.minWidth = '35px'; - } - return ( - - {header.isPlaceholder - ? null - : flexRender(header.column.columnDef.header, header.getContext())} - - ); - })} - - ))} - - - {table.getRowModel().rows.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell, index) => { - const maxWidth = - (cell.column.columnDef as AugmentedColumnDef).meta?.size ?? - 'auto'; - - const style: Style = {}; - if (cell.column.id === 'filename') { - style.maxWidth = maxWidth; - } else if (index === 0) { - style.maxWidth = '20px'; - } - - return ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ); - })} - - )) - ) : ( - - - {localize('com_files_no_results')} - - - )} - -
-
-
-
- {localize('com_files_number_selected', { - 0: `${table.getFilteredSelectedRowModel().rows.length}`, - 1: `${table.getFilteredRowModel().rows.length}`, - })} -
- - -
- - ); -} diff --git a/client/src/components/Files/FileList/DataTableFilePreview.tsx b/client/src/components/Files/FileList/DataTableFilePreview.tsx deleted file mode 100644 index 938655c903..0000000000 --- a/client/src/components/Files/FileList/DataTableFilePreview.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react'; -import DataTableFile from './DataTableFile'; -import { TVectorStore } from '~/common'; -import { files } from '../../Chat/Input/Files/Table'; -import { fileTableColumns } from './../FileList/FileTableColumns'; - -const vectorStoresAttached: TVectorStore[] = [ - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, - { - name: 'vector 1 vector 1', - created_at: '2022-01-01T10:00:00', - _id: 'id', - object: 'vector_store', - }, -]; - -files.forEach((file) => { - file['vectorsAttached'] = vectorStoresAttached; -}); - -export default function DataTableFilePreview() { - return ( -
- -
-
- ); -} diff --git a/client/src/components/Files/FileList/EmptyFilePreview.tsx b/client/src/components/Files/FileList/EmptyFilePreview.tsx deleted file mode 100644 index 092d9c397b..0000000000 --- a/client/src/components/Files/FileList/EmptyFilePreview.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; - -export default function EmptyFilePreview() { - return ( -
- Select a file to view details. -
- ); -} diff --git a/client/src/components/Files/FileList/FileList.tsx b/client/src/components/Files/FileList/FileList.tsx deleted file mode 100644 index ae11e73997..0000000000 --- a/client/src/components/Files/FileList/FileList.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react'; -import type { TFile } from 'librechat-data-provider'; -import FileListItem2 from './FileListItem2'; - -type FileListProps = { - files: TFile[]; - deleteFile: (id: string | undefined) => void; - attachedVectorStores: { name: string }[]; -}; - -export default function FileList({ files, deleteFile, attachedVectorStores }: FileListProps) { - return ( -
- {files.map((file) => ( - - ))} -
- ); -} diff --git a/client/src/components/Files/FileList/FileListItem2.tsx b/client/src/components/Files/FileList/FileListItem2.tsx deleted file mode 100644 index be6bdc185d..0000000000 --- a/client/src/components/Files/FileList/FileListItem2.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import React from 'react'; -import { useNavigate } from 'react-router-dom'; -import { FileIcon, PlusIcon } from 'lucide-react'; -import { Button, DotsIcon, TrashIcon } from '@librechat/client'; -import type { TFile } from 'librechat-data-provider'; -import useLocalize from '~/hooks/useLocalize'; - -type FileListItemProps = { - file: TFile; - deleteFile: (id: string | undefined) => void; - attachedVectorStores: { name: string }[]; -}; - -export default function FileListItem2({ - file, - deleteFile, - attachedVectorStores, -}: FileListItemProps) { - const navigate = useNavigate(); - const localize = useLocalize(); - - return ( -
{ - navigate('file_id_abcdef'); - }} - className="mt-2 flex h-fit cursor-pointer flex-row rounded-md border border-0 bg-white p-4 transition duration-300 ease-in-out hover:bg-slate-200" - > -
-
-
- -
-
{file.filename}
-
-
- {attachedVectorStores.map((vectorStore, index) => { - if (index === 4) { - return ( - - -   - {localize('com_ui_more_count', { 0: attachedVectorStores.length - index })} - - ); - } - if (index > 4) { - return null; - } - return ( - - {vectorStore.name} - - ); - })} -
-
-
- - -
-
- ); -} diff --git a/client/src/components/Files/FileList/FilePreview.tsx b/client/src/components/Files/FileList/FilePreview.tsx deleted file mode 100644 index 0b416fa704..0000000000 --- a/client/src/components/Files/FileList/FilePreview.tsx +++ /dev/null @@ -1,179 +0,0 @@ -import React, { useState } from 'react'; -import { TFile } from 'librechat-data-provider/dist/types'; -import { CheckMark, TrashIcon, Button } from '@librechat/client'; -import VectorStoreButton from '../VectorStore/VectorStoreButton'; -import { CircleIcon, Clock3Icon, InfoIcon } from 'lucide-react'; -import DeleteIconButton from '../DeleteIconButton'; -import { TThread, TVectorStore } from '~/common'; -import { useParams } from 'react-router-dom'; - -const tempFile: TFile = { - filename: 'File1.jpg', - object: 'file', - bytes: 10000, - createdAt: '2022-01-01T10:00:00', - _id: '1', - type: 'image', - usage: 12, - user: 'abc', - file_id: 'file_id', - embedded: true, - filepath: 'filepath', -}; - -const tempThreads: TThread[] = [ - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, - { id: 'thead_id', createdAt: '2022-01-01T10:00:00' }, -]; - -const tempVectorStoresAttached: TVectorStore[] = [ - { name: 'vector 1', created_at: '2022-01-01T10:00:00', _id: 'id', object: 'vector_store' }, - { name: 'vector 1', created_at: '2022-01-01T10:00:00', _id: 'id', object: 'vector_store' }, - { name: 'vector 1', created_at: '2022-01-01T10:00:00', _id: 'id', object: 'vector_store' }, -]; - -export default function FilePreview() { - const [file, setFile] = useState(tempFile); - const [threads, setThreads] = useState(tempThreads); - const [vectorStoresAttached, setVectorStoresAttached] = useState(tempVectorStoresAttached); - const params = useParams(); - - return ( -
-
-
- FILE - - {file.filename} - -
-
-
- { - console.log('click'); - }} - /> -
-
- { - console.log('click'); - }} - /> -
-
-
- -
-
- - -   File ID - - {file._id} -
-
- - -   Status - -
- - -
{file.object}
-
-
-
-
- - -   Purpose - - {file.message} -
-
- - -   Size - - {file.bytes} -
-
- - -   Created At - - - {file.createdAt?.toString()} - -
-
- -
-
- Attached To -
-
-
-
- Vector Stores -
-
Uploaded
-
-
- {vectorStoresAttached.map((vectors, index) => ( -
-
{vectors.name}
-
-
{vectors.created_at.toString()}
- -
-
- ))} -
-
-
- -
-
-
-
Threads
-
Uploaded
-
-
- {threads.map((thread, index) => ( -
-
ID: {thread.id}
-
-
{thread.createdAt}
- -
-
- ))} -
-
-
-
- ); -} diff --git a/client/src/components/Files/FileList/FileSidePanel.tsx b/client/src/components/Files/FileList/FileSidePanel.tsx deleted file mode 100644 index 0db6de3993..0000000000 --- a/client/src/components/Files/FileList/FileSidePanel.tsx +++ /dev/null @@ -1,186 +0,0 @@ -import React from 'react'; -import { ListFilter } from 'lucide-react'; -import { Button, Input } from '@librechat/client'; -import { TFile } from 'librechat-data-provider/dist/types'; -import UploadFileButton from './UploadFileButton'; -import { useLocalize } from '~/hooks'; -import FileList from './FileList'; - -const fakeFiles = [ - { - filename: 'File1.jpg', - object: 'Description 1', - bytes: 10000, - createdAt: '2022-01-01T10:00:00', - _id: '1', - }, - { - filename: 'File2.jpg', - object: 'Description 2', - bytes: 15000, - createdAt: '2022-01-02T15:30:00', - _id: '2', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, - { - filename: 'File3.jpg', - object: 'Description 3', - bytes: 20000, - createdAt: '2022-01-03T09:45:00', - _id: '3', - }, -]; - -const attachedVectorStores = [ - { name: 'VectorStore1' }, - { name: 'VectorStore2' }, - { name: 'VectorStore3' }, - { name: 'VectorStore3' }, - { name: 'VectorStore3' }, - { name: 'VectorStore3' }, - { name: 'VectorStore3' }, - { name: 'VectorStore3' }, - { name: 'VectorStore3' }, -]; - -export default function FileSidePanel() { - const localize = useLocalize(); - const deleteFile = (id: string | undefined) => { - // Define delete functionality here - console.log(`Deleting File with id: ${id}`); - }; - - return ( -
-

- {localize('com_ui_files')} -

-
-
- - { - console.log('changed'); - }} - className="border-border-light placeholder:text-text-secondary max-w-sm" - /> -
-
- { - console.log('Upload'); - }} - /> -
-
-
- -
-
- ); -} diff --git a/client/src/components/Files/FileList/FileTableColumns.tsx b/client/src/components/Files/FileList/FileTableColumns.tsx deleted file mode 100644 index b074d9c379..0000000000 --- a/client/src/components/Files/FileList/FileTableColumns.tsx +++ /dev/null @@ -1,129 +0,0 @@ -/* eslint-disable react-hooks/rules-of-hooks */ -import { PlusIcon } from 'lucide-react'; -import { Button, Checkbox, DotsIcon, FileIcon } from '@librechat/client'; -import type { ColumnDef } from '@tanstack/react-table'; -import type { TFile } from 'librechat-data-provider'; -import type { TVectorStore } from '~/common'; -import { formatDate, getFileType } from '~/utils'; -import { useLocalize } from '~/hooks'; - -type TFileWithVectors = TFile & { vectorsAttached?: TVectorStore[] }; - -export const fileTableColumns: ColumnDef[] = [ - { - id: 'select', - header: ({ table }) => { - return ( - table.toggleAllPageRowsSelected(!!value)} - aria-label="Select all" - className="flex" - /> - ); - }, - cell: ({ row }) => { - return ( - row.toggleSelected(!!value)} - aria-label="Select row" - className="flex" - /> - ); - }, - enableSorting: false, - enableHiding: false, - }, - { - meta: { - size: '50px', - }, - accessorKey: 'icon', - header: () => { - return 'Icon'; - }, - cell: ({ row }) => { - const file = row.original; - return ; - }, - }, - { - meta: { - size: '150px', - }, - accessorKey: 'filename', - header: () => { - const localize = useLocalize(); - return <>{localize('com_ui_name')}; - }, - cell: ({ row }) => { - const file = row.original; - return {file.filename}; - }, - }, - { - accessorKey: 'vectorStores', - header: () => { - return 'Vector Stores'; - }, - cell: ({ row }) => { - const localize = useLocalize(); - const { vectorsAttached: attachedVectorStores = [] } = row.original; - return ( - <> - {attachedVectorStores.map((vectorStore, index) => { - if (index === 4) { - return ( - - -   - {localize('com_ui_more_count', { 0: attachedVectorStores.length - index })} - - ); - } - if (index > 4) { - return null; - } - return ( - - {vectorStore.name} - - ); - })} - - ); - }, - }, - { - accessorKey: 'updatedAt', - header: () => { - return 'Modified'; - }, - cell: ({ row }) => { - const { updatedAt } = row.original; - return formatDate(updatedAt instanceof Date ? updatedAt.toISOString() : (updatedAt ?? '')); - }, - }, - { - accessorKey: 'actions', - header: () => { - return 'Actions'; - }, - cell: () => { - return ( - <> - - - ); - }, - }, -]; diff --git a/client/src/components/Files/FileList/UploadFileButton.tsx b/client/src/components/Files/FileList/UploadFileButton.tsx deleted file mode 100644 index 0823f706e3..0000000000 --- a/client/src/components/Files/FileList/UploadFileButton.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { PlusIcon } from 'lucide-react'; -import { Button } from '@librechat/client'; - -type UploadFileProps = { - onClick: () => void; -}; - -export default function UploadFileButton({ onClick }: UploadFileProps) { - return ( -
- -
- ); -} diff --git a/client/src/components/Files/FileList/UploadFileModal.tsx b/client/src/components/Files/FileList/UploadFileModal.tsx deleted file mode 100644 index 7be59184a5..0000000000 --- a/client/src/components/Files/FileList/UploadFileModal.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import React, { useState, ChangeEvent } from 'react'; -import { Button, Dialog, DialogContent, DialogHeader, DialogTitle, Input } from '@librechat/client'; -import { useLocalize } from '~/hooks'; -import { cn } from '~/utils'; - -const UploadFileModal = ({ open, onOpenChange }) => { - const localize = useLocalize(); - const [file, setFile] = useState(null); - - const handleFileChange = (e: ChangeEvent) => { - if (e.target.files && e.target.files.length > 0) { - const selectedFile = e.target.files[0]; - setFile(selectedFile); - } - }; - - return ( - - - - - Upoad a File - - -
-
-
- -
-
-
Please upload square file, size less than 100KB
-
-
- -
-
No File Chosen
-
-
-
-
- - - -
- -
- - - -
- -
-
- Learn about file purpose -
-
- - -
-
-
-
-
- ); -}; - -export default UploadFileModal; diff --git a/client/src/components/Files/FilesListView.tsx b/client/src/components/Files/FilesListView.tsx deleted file mode 100644 index 3e9af7a657..0000000000 --- a/client/src/components/Files/FilesListView.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import { Outlet, useNavigate, useParams } from 'react-router-dom'; -import FilesSectionSelector from './FilesSectionSelector'; -import FileSidePanel from './FileList/FileSidePanel'; -import { useLocalize } from '~/hooks'; -import { Button } from '../ui'; - -export default function FilesListView() { - const params = useParams(); - const navigate = useNavigate(); - const localize = useLocalize(); - return ( -
-
- - {params.fileId != null && params.fileId && ( - - )} -
-
-
- -
-
- -
-
-
- ); -} diff --git a/client/src/components/Files/FilesSectionSelector.tsx b/client/src/components/Files/FilesSectionSelector.tsx deleted file mode 100644 index dc7fccf9b5..0000000000 --- a/client/src/components/Files/FilesSectionSelector.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, { useState } from 'react'; -import { Button } from '../ui'; -import { useLocation, useNavigate } from 'react-router-dom'; - -export default function FilesSectionSelector() { - const navigate = useNavigate(); - const location = useLocation(); - let selectedPage = '/vector-stores'; - - if (location.pathname.includes('vector-stores')) { - selectedPage = '/vector-stores'; - } - if (location.pathname.includes('files')) { - selectedPage = '/files'; - } - - const darkButton = { backgroundColor: 'black', color: 'white' }; - const lightButton = { backgroundColor: '#f9f9f9', color: 'black' }; - - return ( -
-
- -
-
- -
-
- ); -} diff --git a/client/src/components/Files/VectorStore/EmptyVectorStorePreview.tsx b/client/src/components/Files/VectorStore/EmptyVectorStorePreview.tsx deleted file mode 100644 index 032ea2164f..0000000000 --- a/client/src/components/Files/VectorStore/EmptyVectorStorePreview.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; - -export default function EmptyVectorStorePreview() { - return ( -
- Select a vector store to view details. -
- ); -} diff --git a/client/src/components/Files/VectorStore/VectorStoreButton.tsx b/client/src/components/Files/VectorStore/VectorStoreButton.tsx deleted file mode 100644 index 6eb0f35a26..0000000000 --- a/client/src/components/Files/VectorStore/VectorStoreButton.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { PlusIcon } from 'lucide-react'; -import { Button } from '@librechat/client'; - -type VectorStoreButtonProps = { - onClick: () => void; -}; - -export default function VectorStoreButton({ onClick }: VectorStoreButtonProps) { - return ( -
- -
- ); -} diff --git a/client/src/components/Files/VectorStore/VectorStoreFilter.tsx b/client/src/components/Files/VectorStore/VectorStoreFilter.tsx deleted file mode 100644 index 396491bc07..0000000000 --- a/client/src/components/Files/VectorStore/VectorStoreFilter.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; - -const VectorStoreFilter = () => { - return
VectorStoreFilter
; -}; - -export default VectorStoreFilter; diff --git a/client/src/components/Files/VectorStore/VectorStoreList.tsx b/client/src/components/Files/VectorStore/VectorStoreList.tsx deleted file mode 100644 index c081e7989a..0000000000 --- a/client/src/components/Files/VectorStore/VectorStoreList.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import VectorStoreListItem from './VectorStoreListItem'; -import { TVectorStore } from '~/common'; - -type VectorStoreListProps = { - vectorStores: TVectorStore[]; - deleteVectorStore: (id: string | undefined) => void; -}; - -export default function VectorStoreList({ vectorStores, deleteVectorStore }: VectorStoreListProps) { - return ( -
- {vectorStores.map((vectorStore, index) => ( - - ))} -
- ); -} diff --git a/client/src/components/Files/VectorStore/VectorStoreListItem.tsx b/client/src/components/Files/VectorStore/VectorStoreListItem.tsx deleted file mode 100644 index 0a808f0a57..0000000000 --- a/client/src/components/Files/VectorStore/VectorStoreListItem.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { useNavigate } from 'react-router-dom'; -import { Button, DotsIcon, TrashIcon } from '@librechat/client'; -import { TVectorStore } from '~/common'; -import { useLocalize } from '~/hooks'; - -type VectorStoreListItemProps = { - vectorStore: TVectorStore; - deleteVectorStore: (id: string) => void; -}; - -export default function VectorStoreListItem({ - vectorStore, - deleteVectorStore, -}: VectorStoreListItemProps) { - const navigate = useNavigate(); - const localize = useLocalize(); - return ( -
{ - navigate('vs_id_abcdef'); - }} - className="bg-surface-secondary hover:bg-surface-hover mt-2 flex cursor-pointer flex-row justify-around rounded-md border border-0 p-4 transition duration-300 ease-in-out" - > -
- {vectorStore.name} -

{vectorStore.object}

-
-
-

- {localize('com_ui_files_count_size', { - 0: vectorStore.file_counts?.total ?? 0, - 1: (vectorStore.bytes ?? 0) / 1000, - })} -

-

{vectorStore.created_at.toString()}

-
-
- - -
-
- ); -} diff --git a/client/src/components/Files/VectorStore/VectorStorePreview.tsx b/client/src/components/Files/VectorStore/VectorStorePreview.tsx deleted file mode 100644 index d75a827425..0000000000 --- a/client/src/components/Files/VectorStore/VectorStorePreview.tsx +++ /dev/null @@ -1,243 +0,0 @@ -import React, { useState } from 'react'; -import DeleteIconButton from '../DeleteIconButton'; -import { TrashIcon, Button } from '@librechat/client'; -import { TFile } from 'librechat-data-provider/dist/types'; -import UploadFileButton from '../FileList/UploadFileButton'; -import UploadFileModal from '../FileList/UploadFileModal'; -import { BarChart4Icon, Clock3, FileClock, FileIcon, InfoIcon, PlusIcon } from 'lucide-react'; -import { useParams } from 'react-router-dom'; - -const tempVectorStore = { - _id: 'vs_NeHK4JidLKJ2qo23dKLLK', - name: 'Vector Store 1', - usageThisMonth: '1,000,000', - bytes: 1000000, - lastActive: '2022-01-01T10:00:00', - expirationPolicy: 'Never', - expires: 'Never', - createdAt: '2022-01-01T10:00:00', -}; -const tempFilesAttached: TFile[] = [ - { - filename: 'File1.jpg', - object: 'file', - bytes: 10000, - createdAt: '2022-01-01T10:00:00', - _id: '1', - type: 'image', - usage: 12, - user: 'abc', - file_id: 'file_id', - embedded: true, - filepath: 'filepath', - }, - { - filename: 'File1.jpg', - object: 'file', - bytes: 10000, - createdAt: '2022-01-01T10:00:00', - _id: '1', - type: 'image', - usage: 12, - user: 'abc', - file_id: 'file_id', - embedded: true, - filepath: 'filepath', - }, - { - filename: 'File1.jpg', - object: 'file', - bytes: 10000, - createdAt: '2022-01-01T10:00:00', - _id: '1', - type: 'image', - usage: 12, - user: 'abc', - file_id: 'file_id', - embedded: true, - filepath: 'filepath', - }, - { - filename: 'File1.jpg', - object: 'file', - bytes: 10000, - createdAt: '2022-01-01T10:00:00', - _id: '1', - type: 'image', - usage: 12, - user: 'abc', - file_id: 'file_id', - embedded: true, - filepath: 'filepath', - }, -]; -const tempAssistants = [ - { - id: 'Lorum Ipsum', - resource: 'Lorum Ipsum', - }, - { - id: 'Lorum Ipsum', - resource: 'Lorum Ipsum', - }, - { - id: 'Lorum Ipsum', - resource: 'Lorum Ipsum', - }, - { - id: 'Lorum Ipsum', - resource: 'Lorum Ipsum', - }, -]; - -export default function VectorStorePreview() { - const [open, setOpen] = useState(false); - const [vectorStore, setVectorStore] = useState(tempVectorStore); - const [filesAttached, setFilesAttached] = useState(tempFilesAttached); - const [assistants, setAssistants] = useState(tempAssistants); - const params = useParams(); - - return ( -
-
-
- VECTOR STORE - - {vectorStore.name} - -
-
-
- { - console.log('click'); - }} - /> -
-
- { - setOpen(true); - }} - /> -
-
-
- -
-
- - -   ID - - {vectorStore._id} -
-
- - -  Usage this  month - -
-

- 0 KB hours -   Free until end of 2024 -

-
-
-
- - -  Size - - {vectorStore.bytes} bytes -
-
- - -  Last active - - {vectorStore.lastActive} -
-
- - -  Expiration policy - - {vectorStore.expirationPolicy} -
-
- - -  Expires - - {vectorStore.expires} -
-
- - -  Created At - - {vectorStore.createdAt.toString()} -
-
- -
-
- Files attached -
-
-
-
File
-
Uploaded
-
-
- {filesAttached.map((file, index) => ( -
-
- -
{file.filename}
-
-
-
{file.createdAt?.toString()}
- -
-
- ))} -
-
-
- -
-
- Used by - -
-
-
-
Resource
-
ID
-
-
- {assistants.map((assistant, index) => ( -
-
{assistant.resource}
-
-
{assistant.id}
-
-
- ))} -
-
-
- {open && } -
- ); -} diff --git a/client/src/components/Files/VectorStore/VectorStoreSidePanel.tsx b/client/src/components/Files/VectorStore/VectorStoreSidePanel.tsx deleted file mode 100644 index 0616bcc7ba..0000000000 --- a/client/src/components/Files/VectorStore/VectorStoreSidePanel.tsx +++ /dev/null @@ -1,249 +0,0 @@ -import React from 'react'; -import { ListFilter } from 'lucide-react'; -import { Button, Input } from '@librechat/client'; -import VectorStoreButton from './VectorStoreButton'; -import VectorStoreList from './VectorStoreList'; -import { TVectorStore } from '~/common'; -import { useLocalize } from '~/hooks'; - -const fakeVectorStores: TVectorStore[] = [ - { - name: 'VectorStore 1', - bytes: 10000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '1', - }, - { - name: 'VectorStore 2', - bytes: 10000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '2', - }, - { - name: 'VectorStore 3', - bytes: 10000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '3', - }, - { - name: 'VectorStore 4', - bytes: 10000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '4', - }, - { - name: 'VectorStore 5', - bytes: 10000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '5', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, - { - name: 'VectorStore 6', - bytes: 2000, - file_counts: { - total: 10, - in_progress: 0, - completed: 0, - failed: 0, - cancelled: 0, - }, - created_at: '2022-01-01T10:00:00', - object: 'vector_store', - _id: '6', - }, -]; - -export default function VectorStoreSidePanel() { - const localize = useLocalize(); - const deleteVectorStore = (id: string | undefined) => { - // Define delete functionality here - console.log(`Deleting VectorStore with id: ${id}`); - }; - - return ( -
-
-

- Vector Stores -

-
-
- - { - console.log('changed'); - }} - className="max-w-sm border-border-light placeholder:text-text-secondary" - /> -
-
- { - console.log('Add Vector Store'); - }} - /> -
-
-
-
- -
-
- ); -} diff --git a/client/src/components/Files/VectorStoreView.tsx b/client/src/components/Files/VectorStoreView.tsx deleted file mode 100644 index 63db286cff..0000000000 --- a/client/src/components/Files/VectorStoreView.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import VectorStoreSidePanel from './VectorStore/VectorStoreSidePanel'; -import FilesSectionSelector from './FilesSectionSelector'; -import { Button } from '../ui'; -import { Outlet, useNavigate, useParams } from 'react-router-dom'; - -export default function VectorStoreView() { - const params = useParams(); - const navigate = useNavigate(); - return ( -
-
- - -
-
-
- -
-
- -
-
-
- ); -} diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.json index 0533cf8bb0..8cde8e7d01 100644 --- a/client/src/locales/en/translation.json +++ b/client/src/locales/en/translation.json @@ -990,7 +990,6 @@ "com_ui_2fa_verification_required": "Enter your 2FA code to continue", "com_ui_2fa_verified": "Successfully verified Two-Factor Authentication", "com_ui_accept": "I accept", - "com_ui_action_button": "Action Button", "com_ui_active": "Active", "com_ui_active_chats": "Active chats", "com_ui_add": "Add", @@ -1599,8 +1598,6 @@ "com_ui_file_size": "File Size", "com_ui_file_token_limit": "File Token Limit", "com_ui_file_token_limit_desc": "Set maximum token limit for file processing to control costs and resource usage", - "com_ui_files": "Files", - "com_ui_files_count_size": "{{0}} Files ({{1}}KB)", "com_ui_filter_and_sort_chats": "Filter and sort chats", "com_ui_filter_by": "Filter by {{title}}", "com_ui_filter_mcp_servers": "Filter MCP servers by name", @@ -1642,7 +1639,6 @@ "com_ui_generating_image": "Generating image...", "com_ui_generation_settings": "Generation Settings", "com_ui_getting_started": "Getting Started", - "com_ui_go_back": "Go back", "com_ui_go_to_conversation": "Go to conversation", "com_ui_greeting_back_at_it": "Back at it", "com_ui_greeting_back_at_it_named": "Back at it, {{name}}", @@ -1923,7 +1919,6 @@ "com_ui_model_parameters_reset": "Model Parameters have been reset.", "com_ui_model_selected": "{{0}} selected", "com_ui_model_spec": "Model Spec", - "com_ui_more_count": "{{0}} more", "com_ui_more_info": "More info", "com_ui_more_options": "More options", "com_ui_moved_to_position": "Moved to position {{0}} of {{1}}", diff --git a/e2e/specs/mock/scenarios/files-tree-removal.spec.ts b/e2e/specs/mock/scenarios/files-tree-removal.spec.ts new file mode 100644 index 0000000000..481e527895 --- /dev/null +++ b/e2e/specs/mock/scenarios/files-tree-removal.spec.ts @@ -0,0 +1,31 @@ +import { expect, test } from '@playwright/test'; + +/** + * The unmounted Files component tree this change deleted was never reachable, + * which is exactly why its removal needs a scenario: the surfaces that LOOK + * like it, the chat input's file manager and the files side panel, are the ones + * a bad deletion would take with them. The panel nav sits behind the mobile + * drawer on a phone-width viewport, so the scenario states the desktop viewport + * it means rather than depending on which project runs it. + */ + +test.use({ viewport: { width: 1280, height: 800 } }); + +test.describe('files surfaces after the tree removal', () => { + test('the files panel and the composer attachment entry still work @scenario:files-tree-removal-leaves-live-surfaces-working', async ({ + page, + }) => { + test.setTimeout(60000); + await page.goto('/c/new', { timeout: 15000 }); + + await page.getByTestId('nav-panel-files').click(); + const panel = page.getByRole('region', { name: 'Files Table' }); + await expect(panel).toBeVisible({ timeout: 15000 }); + /** The panel's own filter field is part of the live tree that had to + * survive the deletion of the unreachable one beside it. */ + await expect(panel.locator('#filename-filter')).toBeVisible(); + + await page.keyboard.press('Escape'); + await expect(page.getByTestId('composer-surface')).toBeVisible(); + }); +}); diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 32c5869d21..a085daf5fa 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -1191,122 +1191,6 @@ "count": 4 } }, - "client/src/components/Files/ActionButton.tsx": { - "shadcn/no-restyle": { - "count": 8 - } - }, - "client/src/components/Files/DeleteIconButton.tsx": { - "shadcn/no-restyle": { - "count": 1 - } - }, - "client/src/components/Files/FileDashboardView.tsx": { - "shadcn/no-arbitrary-values": { - "count": 2 - } - }, - "client/src/components/Files/FileList/DataTableFile.tsx": { - "shadcn/no-inline-styles": { - "count": 2 - }, - "shadcn/no-restyle": { - "count": 40 - }, - "shadcn/no-unknown-classes": { - "count": 2 - } - }, - "client/src/components/Files/FileList/FileListItem2.tsx": { - "shadcn/no-arbitrary-values": { - "count": 4 - }, - "shadcn/no-raw-colors": { - "count": 5 - }, - "shadcn/no-restyle": { - "count": 7 - } - }, - "client/src/components/Files/FileList/FilePreview.tsx": { - "shadcn/no-arbitrary-values": { - "count": 4 - }, - "shadcn/no-raw-colors": { - "count": 11 - }, - "shadcn/no-restyle": { - "count": 11 - } - }, - "client/src/components/Files/FileList/FileSidePanel.tsx": { - "shadcn/no-restyle": { - "count": 3 - } - }, - "client/src/components/Files/FileList/FileTableColumns.tsx": { - "shadcn/no-arbitrary-values": { - "count": 2 - }, - "shadcn/no-restyle": { - "count": 5 - } - }, - "client/src/components/Files/FileList/UploadFileButton.tsx": { - "shadcn/no-restyle": { - "count": 3 - } - }, - "client/src/components/Files/FileList/UploadFileModal.tsx": { - "shadcn/no-arbitrary-values": { - "count": 3 - }, - "shadcn/no-raw-colors": { - "count": 3 - }, - "shadcn/no-restyle": { - "count": 19 - } - }, - "client/src/components/Files/FilesSectionSelector.tsx": { - "shadcn/no-inline-styles": { - "count": 8 - }, - "shadcn/no-restyle": { - "count": 6 - } - }, - "client/src/components/Files/VectorStore/VectorStoreButton.tsx": { - "shadcn/no-restyle": { - "count": 3 - } - }, - "client/src/components/Files/VectorStore/VectorStoreListItem.tsx": { - "shadcn/no-restyle": { - "count": 11 - } - }, - "client/src/components/Files/VectorStore/VectorStorePreview.tsx": { - "shadcn/no-arbitrary-values": { - "count": 2 - }, - "shadcn/no-raw-colors": { - "count": 15 - }, - "shadcn/no-restyle": { - "count": 5 - } - }, - "client/src/components/Files/VectorStore/VectorStoreSidePanel.tsx": { - "shadcn/no-restyle": { - "count": 3 - } - }, - "client/src/components/Files/VectorStoreView.tsx": { - "shadcn/no-arbitrary-values": { - "count": 1 - } - }, "client/src/components/Input/Generations/Button.tsx": { "shadcn/no-arbitrary-values": { "count": 1