Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🧹 chore: Remove the Unmounted Files Component Tree (#16243)

Marco Berettab89ed0a32ce7
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 (
- <div className="w-32">
- <Button
- className="w-full rounded-md border border-text-primary bg-surface-primary p-0 text-text-primary hover:bg-surface-inverted hover:text-text-inverted"
- onClick={onClick}
- >
- {/* Action Button */}
- {localize('com_ui_action_button')}
- </Button>
- </div>
- );
-}
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 (
- <div className="w-fit">
- <Button variant="destructive" className="p-3" onClick={onClick}>
- <TrashIcon />
- </Button>
- </div>
- );
-}
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 (
- <div className="bg-[#f9f9f9] p-0 lg:p-7">
- <div className="ml-3 mt-3 flex flex-row justify-between">
- {params.vectorStoreId && (
- <Button
- className="block lg:hidden"
- variant={'outline'}
- size={'sm'}
- onClick={() => {
- navigate('/d');
- }}
- >
- Go back
- </Button>
- )}
- </div>
- <div className="flex h-screen max-w-full flex-row divide-x bg-[#f9f9f9]">
- <div className={`w-full lg:w-1/3 ${params.vectorStoreId ? 'hidden lg:block' : ''}`}>
- <VectorStoreSidePanel />
- </div>
- <div className={`w-full lg:w-2/3 ${params.vectorStoreId ? '' : 'hidden lg:block'}`}>
- <div className="m-2 overflow-x-auto">
- <Outlet />
- </div>
- </div>
- </div>
- </div>
- );
-};
-
-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<TData, TValue> {
- columns: ColumnDef<TData, TValue>[];
- 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<TData, TValue>({
- columns,
- data,
-}: DataTableProps<TData, TValue>) {
- 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<SortingState>([]);
- const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([]);
- const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({});
-
- 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 (
- <>
- <div className="mt-2 flex flex-col items-start">
- <h2 className="text-lg">
- <strong>{localize('com_ui_files')}</strong>
- </h2>
- <div className="mt-3 flex w-full flex-col-reverse justify-between md:flex-row">
- <div className="mt-3 flex w-full flex-row justify-center gap-x-3 md:m-0 md:justify-start">
- <ActionButton
- onClick={() => {
- console.log('click');
- }}
- />
- <Button
- variant="ghost"
- onClick={() => {
- setIsDeleting(true);
- const filesToDelete = table
- .getFilteredSelectedRowModel()
- .rows.map((row) => row.original);
- deleteFiles({ files: filesToDelete as TFile[], setFiles });
- setRowSelection({});
- }}
- className="ml-1 gap-2 hover:bg-surface-hover sm:ml-0"
- disabled={!table.getFilteredSelectedRowModel().rows.length || isDeleting}
- >
- {isDeleting ? (
- <Spinner className="h-4 w-4" />
- ) : (
- <TrashIcon className="h-4 w-4 text-text-destructive" />
- )}
- {localize('com_ui_delete')}
- </Button>
- </div>
- <div className="flex w-full flex-row gap-x-3">
- {' '}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" className="ml-auto border border-border-medium">
- <ListFilter className="h-4 w-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- align="end"
- className="z-[1001] border-border-light bg-surface-dialog"
- >
- {table
- .getAllColumns()
- .filter((column) => column.getCanHide())
- .map((column) => {
- return (
- <DropdownMenuCheckboxItem
- key={column.id}
- className="cursor-pointer capitalize text-text-primary hover:bg-surface-hover"
- checked={column.getIsVisible()}
- onCheckedChange={(value) => column.toggleVisibility(Boolean(value))}
- >
- {localize(contextMap[column.id])}
- </DropdownMenuCheckboxItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenu>
- <Input
- placeholder={localize('com_files_filter')}
- value={(table.getColumn('filename')?.getFilterValue() as string | undefined) ?? ''}
- onChange={(event) => table.getColumn('filename')?.setFilterValue(event.target.value)}
- className="max-w-sm border-border-medium placeholder:text-text-secondary"
- />
- <UploadFileButton onClick={() => console.log('click')} />
- </div>
- </div>
- </div>
- <div className="relative mt-3 max-h-[25rem] min-h-0 overflow-y-auto rounded-md border border-border-light pb-4 sm:min-h-[28rem]">
- <Table className="w-full min-w-[600px] border-separate border-spacing-0">
- <TableHeader>
- {table.getHeaderGroups().map((headerGroup) => (
- <TableRow key={headerGroup.id}>
- {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 (
- <TableHead
- key={header.id}
- className="align-start sticky top-0 rounded-t border-b border-border-light bg-surface-secondary px-2 py-1 text-left font-medium text-text-secondary sm:px-4 sm:py-2"
- style={style}
- >
- {header.isPlaceholder
- ? null
- : flexRender(header.column.columnDef.header, header.getContext())}
- </TableHead>
- );
- })}
- </TableRow>
- ))}
- </TableHeader>
- <TableBody>
- {table.getRowModel().rows.length ? (
- table.getRowModel().rows.map((row) => (
- <TableRow
- key={row.id}
- data-state={row.getIsSelected() && 'selected'}
- className="border-b border-border-light text-left text-text-secondary [tr:last-child_&]:border-b-0"
- >
- {row.getVisibleCells().map((cell, index) => {
- const maxWidth =
- (cell.column.columnDef as AugmentedColumnDef<TData, TValue>).meta?.size ??
- 'auto';
-
- const style: Style = {};
- if (cell.column.id === 'filename') {
- style.maxWidth = maxWidth;
- } else if (index === 0) {
- style.maxWidth = '20px';
- }
-
- return (
- <TableCell
- key={cell.id}
- className="align-start overflow-x-auto px-2 py-1 text-xs sm:px-4 sm:py-2 sm:text-sm [tr[data-disabled=true]_&]:opacity-50"
- style={style}
- >
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
- </TableCell>
- );
- })}
- </TableRow>
- ))
- ) : (
- <TableRow>
- <TableCell colSpan={columns.length} className="h-24 text-center">
- {localize('com_files_no_results')}
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
- </div>
- <div className="ml-4 mr-4 mt-4 flex h-auto items-center justify-end space-x-2 py-4 sm:ml-0 sm:mr-0 sm:h-0">
- <div className="ml-2 flex-1 text-sm text-text-secondary">
- {localize('com_files_number_selected', {
- 0: `${table.getFilteredSelectedRowModel().rows.length}`,
- 1: `${table.getFilteredRowModel().rows.length}`,
- })}
- </div>
- <Button
- className="border-border-medium hover:bg-surface-hover"
- variant="outline"
- size="sm"
- onClick={() => table.previousPage()}
- disabled={!table.getCanPreviousPage()}
- >
- {localize('com_ui_prev')}
- </Button>
- <Button
- className="border-border-medium hover:bg-surface-hover"
- variant="outline"
- size="sm"
- onClick={() => table.nextPage()}
- disabled={!table.getCanNextPage()}
- >
- {localize('com_ui_next')}
- </Button>
- </div>
- </>
- );
-}
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 (
- <div>
- <DataTableFile columns={fileTableColumns} data={files} />
- <div className="mt-5 sm:mt-4" />
- </div>
- );
-}
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 (
- <div className="h-full w-full content-center text-center font-bold">
- Select a file to view details.
- </div>
- );
-}
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 (
- <div className="h-[85vh] overflow-y-auto">
- {files.map((file) => (
- <FileListItem2
- key={file._id}
- file={file}
- deleteFile={deleteFile}
- attachedVectorStores={attachedVectorStores}
- />
- ))}
- </div>
- );
-}
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 (
- <div
- onClick={() => {
- 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"
- >
- <div className="flex w-10/12 flex-col justify-around md:flex-row">
- <div className="flex w-2/5 flex-row">
- <div className="w-1/4 content-center">
- <FileIcon className="m-0 size-5 p-0" />
- </div>
- <div className="w-3/4 content-center">{file.filename}</div>
- </div>
- <div className="flex w-fit flex-row flex-wrap text-gray-500 md:w-3/5">
- {attachedVectorStores.map((vectorStore, index) => {
- if (index === 4) {
- return (
- <span
- key={index}
- className="mt-1 ml-2 flex flex-row items-center rounded-full bg-[#f5f5f5] px-2 text-xs"
- >
- <PlusIcon className="h-3 w-3" />
- &nbsp;
- {localize('com_ui_more_count', { 0: attachedVectorStores.length - index })}
- </span>
- );
- }
- if (index > 4) {
- return null;
- }
- return (
- <span
- key={index}
- className="mt-1 ml-2 content-center rounded-full bg-[#f2f8ec] px-2 text-xs text-[#91c561]"
- >
- {vectorStore.name}
- </span>
- );
- })}
- </div>
- </div>
- <div className="mr-0 flex w-2/12 flex-col items-center justify-evenly sm:mr-4 md:flex-row">
- <Button className="w-min content-center bg-transparent text-gray-500 hover:bg-slate-200">
- <DotsIcon className="text-text-tertiary" />
- </Button>
- <Button
- className="w-min bg-transparent text-[#666666] hover:bg-slate-200"
- onClick={() => deleteFile(file._id)}
- >
- <TrashIcon className="" />
- </Button>
- </div>
- </div>
- );
-}
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 (
- <div className="m-3 bg-white p-2 sm:p-4 md:p-6 lg:p-10">
- <div className="flex flex-col justify-between md:flex-row">
- <div className="flex flex-col">
- <b className="hidden text-sm md:text-base lg:block lg:text-lg">FILE</b>
- <b className="text-center text-xl md:text-2xl lg:text-left lg:text-3xl">
- {file.filename}
- </b>
- </div>
- <div className="mt-3 flex flex-row gap-x-3 md:mt-0">
- <div>
- <DeleteIconButton
- onClick={() => {
- console.log('click');
- }}
- />
- </div>
- <div className="w-40">
- <VectorStoreButton
- onClick={() => {
- console.log('click');
- }}
- />
- </div>
- </div>
- </div>
-
- <div className="mt-3 flex flex-col">
- <div className="flex flex-row">
- <span className="flex w-1/2 flex-row items-center sm:w-1/4 md:w-2/5">
- <InfoIcon className="size-4 text-gray-500" />
- &nbsp; File ID
- </span>
- <span className="w-1/2 text-gray-500 sm:w-3/4 md:w-3/5">{file._id}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center sm:w-1/4 md:w-2/5">
- <CircleIcon className="m-0 size-4 p-0 text-gray-500" />
- &nbsp; Status
- </span>
- <div className="w-1/2 sm:w-3/4 md:w-3/5">
- <span className="flex w-20 flex-row items-center justify-evenly rounded-full bg-[#f2f8ec] p-1 text-[#91c561]">
- <CheckMark className="m-0 p-0" />
- <div>{file.object}</div>
- </span>
- </div>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center sm:w-1/4 md:w-2/5">
- <Clock3Icon className="m-0 size-4 p-0 text-gray-500" />
- &nbsp; Purpose
- </span>
- <span className="w-1/2 text-gray-500 sm:w-3/4 md:w-3/5">{file.message}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center sm:w-1/4 md:w-2/5">
- <Clock3Icon className="m-0 size-4 p-0 text-gray-500" />
- &nbsp; Size
- </span>
- <span className="w-1/2 text-gray-500 sm:w-3/4 md:w-3/5">{file.bytes}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center sm:w-1/4 md:w-2/5">
- <Clock3Icon className="m-0 size-4 p-0 text-gray-500" />
- &nbsp; Created At
- </span>
- <span className="w-1/2 text-gray-500 sm:w-3/4 md:w-3/5">
- {file.createdAt?.toString()}
- </span>
- </div>
- </div>
-
- <div className="mt-10 flex flex-col">
- <div>
- <b className="text-sm md:text-base lg:text-lg">Attached To</b>
- </div>
- <div className="flex flex-col divide-y">
- <div className="mt-2 flex flex-row">
- <div className="w-2/5 text-sm md:w-1/2 md:text-base lg:text-lg xl:w-2/3">
- Vector Stores
- </div>
- <div className="w-3/5 text-sm md:w-1/2 md:text-base lg:text-lg xl:w-1/3">Uploaded</div>
- </div>
- <div>
- {vectorStoresAttached.map((vectors, index) => (
- <div key={index} className="mt-2 flex flex-row">
- <div className="ml-4 w-2/5 content-center md:w-1/2 xl:w-2/3">{vectors.name}</div>
- <div className="flex w-3/5 flex-row md:w-1/2 xl:w-1/3">
- <div className="content-center text-nowrap">{vectors.created_at.toString()}</div>
- <Button
- className="m-0 ml-3 h-full bg-transparent p-0 text-[#666666] hover:bg-slate-200"
- onClick={() => {
- console.log('Remove from vector store');
- }}
- variant={'ghost'}
- >
- <TrashIcon className="m-0 p-0" />
- </Button>
- </div>
- </div>
- ))}
- </div>
- </div>
- </div>
-
- <div className="mt-10 flex flex-col">
- <div className="flex flex-col divide-y">
- <div className="flex flex-row">
- <div className="w-2/5 text-sm md:w-1/2 md:text-base lg:text-lg xl:w-2/3">Threads</div>
- <div className="w-3/5 text-sm md:w-1/2 md:text-base lg:text-lg xl:w-1/3">Uploaded</div>
- </div>
- <div>
- {threads.map((thread, index) => (
- <div key={index} className="mt-2 flex flex-row">
- <div className="ml-4 w-2/5 content-center md:w-1/2 xl:w-2/3">ID: {thread.id}</div>
- <div className="flex w-3/5 flex-row md:w-1/2 xl:w-1/3">
- <div className="content-center text-nowrap">{thread.createdAt}</div>
- <Button
- className="m-0 ml-3 h-full bg-transparent p-0 text-[#666666] hover:bg-slate-200"
- onClick={() => {
- console.log('Remove from thread');
- }}
- >
- <TrashIcon className="m-0 p-0" />
- </Button>
- </div>
- </div>
- ))}
- </div>
- </div>
- </div>
- </div>
- );
-}
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 (
- <div>
- <h2 className="m-3 text-lg">
- <strong>{localize('com_ui_files')}</strong>
- </h2>
- <div className="m-3 mt-2 flex w-full flex-row justify-between gap-x-2 lg:m-0">
- <div className="flex w-2/3 flex-row">
- <Button variant="ghost" className="m-0 mr-2 p-0">
- <ListFilter className="h-4 w-4" aria-hidden="true" />
- </Button>
- <Input
- placeholder={localize('com_files_filter')}
- value={''}
- onChange={() => {
- console.log('changed');
- }}
- className="border-border-light placeholder:text-text-secondary max-w-sm"
- />
- </div>
- <div className="w-1/3">
- <UploadFileButton
- onClick={() => {
- console.log('Upload');
- }}
- />
- </div>
- </div>
- <div className="mt-3">
- <FileList
- files={fakeFiles as TFile[]}
- deleteFile={deleteFile}
- attachedVectorStores={attachedVectorStores}
- />
- </div>
- </div>
- );
-}
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<TFileWithVectors>[] = [
- {
- id: 'select',
- header: ({ table }) => {
- return (
- <Checkbox
- checked={
- table.getIsAllPageRowsSelected() ||
- (table.getIsSomePageRowsSelected() && 'indeterminate')
- }
- onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
- aria-label="Select all"
- className="flex"
- />
- );
- },
- cell: ({ row }) => {
- return (
- <Checkbox
- checked={row.getIsSelected()}
- onCheckedChange={(value) => 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 <FileIcon file={file} fileType={getFileType(file.type)} />;
- },
- },
- {
- meta: {
- size: '150px',
- },
- accessorKey: 'filename',
- header: () => {
- const localize = useLocalize();
- return <>{localize('com_ui_name')}</>;
- },
- cell: ({ row }) => {
- const file = row.original;
- return <span className="self-center truncate">{file.filename}</span>;
- },
- },
- {
- 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 (
- <span
- key={index}
- className="ml-2 mt-2 flex w-fit flex-row items-center rounded-full bg-surface-tertiary px-2 text-text-tertiary"
- >
- <PlusIcon className="h-3 w-3" />
- &nbsp;
- {localize('com_ui_more_count', { 0: attachedVectorStores.length - index })}
- </span>
- );
- }
- if (index > 4) {
- return null;
- }
- return (
- <span key={index} className="ml-2 mt-2 rounded-full bg-[#f2f8ec] px-2 text-[#91c561]">
- {vectorStore.name}
- </span>
- );
- })}
- </>
- );
- },
- },
- {
- 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 (
- <>
- <Button className="w-min content-center bg-transparent text-text-tertiary hover:bg-surface-hover">
- <DotsIcon className="m-0 size-5 p-0 text-text-tertiary" />
- </Button>
- </>
- );
- },
- },
-];
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 (
- <div className="w-full">
- <Button className="w-full bg-black px-3 text-white" onClick={onClick}>
- <PlusIcon className="h-4 w-4 font-bold" />
- &nbsp; <span className="text-nowrap">Upload New File</span>
- </Button>
- </div>
- );
-}
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<File | null>(null);
-
- const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {
- if (e.target.files && e.target.files.length > 0) {
- const selectedFile = e.target.files[0];
- setFile(selectedFile);
- }
- };
-
- return (
- <Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent
- className={cn(
- 'w-11/12 overflow-x-auto p-3 shadow-2xl dark:bg-gray-700 dark:text-white lg:w-2/3 xl:w-2/5',
- )}
- >
- <DialogHeader>
- <DialogTitle className="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
- Upoad a File
- </DialogTitle>
- </DialogHeader>
- <div className="flex w-full flex-col p-0 sm:p-6 sm:pb-0 sm:pt-4">
- <div className="flex w-full flex-row">
- <div className="hidden w-1/5 sm:block">
- <img />
- </div>
- <div className="flex w-full flex-col text-center sm:w-4/5 sm:text-left">
- <div className="italic">Please upload square file, size less than 100KB</div>
- <div className="mt-4 flex w-full flex-row items-center bg-[#f9f9f9] p-2">
- <div className="w-1/2 sm:w-1/3">
- <Button>Choose File</Button>
- </div>
- <div className="w-1/2 sm:w-1/3"> No File Chosen</div>
- </div>
- </div>
- </div>
- <div className="mt-3 flex w-full flex-col">
- <label htmlFor="name">Name</label>
- <label className="hidden text-[#808080] sm:block">The name of the uploaded file</label>
- <Input type="text" id="name" name="name" placeholder="Name" />
- </div>
-
- <div className="mt-3 flex w-full flex-col">
- <label htmlFor="purpose">Purpose</label>
- <label className="hidden text-[#808080] sm:block">
- The purpose of the uploaded file
- </label>
- <Input type="text" id="purpose" name="purpose" placeholder="Purpose" />
- </div>
-
- <div className="mt-3 flex w-full flex-row justify-between">
- <div className="hidden w-1/3 sm:block">
- <span className="font-bold">Learn about file purpose</span>
- </div>
- <div className="flex w-full flex-row justify-evenly sm:w-1/3">
- <Button
- className="mr-3 w-full rounded-md border border-black bg-white p-0 text-black hover:bg-white"
- onClick={() => {
- onOpenChange(false);
- }}
- >
- Cancel
- </Button>
- <Button
- className="w-full rounded-md border border-black bg-black p-0 text-white"
- onClick={() => {
- console.log('upload file');
- }}
- >
- Upload
- </Button>
- </div>
- </div>
- </div>
- </DialogContent>
- </Dialog>
- );
-};
-
-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 (
- <div className="bg-surface-primary p-0 lg:p-7">
- <div className="m-4 flex w-full flex-row justify-between md:m-2">
- <FilesSectionSelector />
- {params.fileId != null && params.fileId && (
- <Button
- className="block lg:hidden"
- variant={'outline'}
- size={'sm'}
- onClick={() => {
- navigate('/d/files');
- }}
- >
- {localize('com_ui_go_back')}
- </Button>
- )}
- </div>
- <div className="flex w-full flex-row divide-x">
- <div
- className={`mr-2 w-full xl:w-1/3 ${
- params.fileId != null && params.fileId ? 'hidden w-1/2 lg:block lg:w-1/2' : 'md:w-full'
- }`}
- >
- <FileSidePanel />
- </div>
- <div
- className={`h-[85vh] w-full overflow-y-auto xl:w-2/3 ${
- params.fileId != null && params.fileId ? 'lg:w-1/2' : 'hidden md:w-1/2 lg:block'
- }`}
- >
- <Outlet />
- </div>
- </div>
- </div>
- );
-}
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 (
- <div className="flex h-12 w-52 flex-row justify-center rounded border bg-white p-1">
- <div className="flex w-2/3 items-center pr-1">
- <Button
- className="w-full rounded rounded-lg border"
- style={selectedPage === '/vector-stores' ? darkButton : lightButton}
- onClick={() => {
- selectedPage = '/vector-stores';
- navigate('/d/vector-stores');
- }}
- >
- Vector Stores
- </Button>
- </div>
- <div className="flex w-1/3 items-center">
- <Button
- className="w-full rounded rounded-lg border"
- style={selectedPage === '/files' ? darkButton : lightButton}
- onClick={() => {
- selectedPage = '/files';
- navigate('/d/files');
- }}
- >
- Files
- </Button>
- </div>
- </div>
- );
-}
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 (
- <div className="h-full w-full content-center text-center font-bold">
- Select a vector store to view details.
- </div>
- );
-}
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 (
- <div className="w-full">
- <Button className="w-full bg-black p-0 text-white" onClick={onClick}>
- <PlusIcon className="h-4 w-4 font-bold" />
- &nbsp; <span className="text-nowrap">Add Store</span>
- </Button>
- </div>
- );
-}
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 <div>VectorStoreFilter</div>;
-};
-
-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 (
- <div>
- {vectorStores.map((vectorStore, index) => (
- <VectorStoreListItem
- key={index}
- vectorStore={vectorStore}
- deleteVectorStore={deleteVectorStore}
- />
- ))}
- </div>
- );
-}
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 (
- <div
- onClick={() => {
- 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"
- >
- <div className="flex w-1/2 flex-col justify-around align-middle">
- <strong>{vectorStore.name}</strong>
- <p className="text-text-tertiary text-sm">{vectorStore.object}</p>
- </div>
- <div className="text-text-tertiary w-2/6">
- <p>
- {localize('com_ui_files_count_size', {
- 0: vectorStore.file_counts?.total ?? 0,
- 1: (vectorStore.bytes ?? 0) / 1000,
- })}
- </p>
- <p className="text-sm">{vectorStore.created_at.toString()}</p>
- </div>
- <div className="flex w-1/6 flex-col justify-around sm:flex-row">
- <Button className="text-text-tertiary hover:bg-surface-hover m-0 w-full content-center bg-transparent p-0 sm:w-min">
- <DotsIcon className="text-text-tertiary m-0 p-0" />
- </Button>
- <Button
- className="text-text-destructive hover:bg-surface-hover m-0 w-full bg-transparent p-0 sm:w-fit"
- onClick={() => deleteVectorStore(vectorStore._id)}
- >
- <TrashIcon className="m-0 p-0" />
- </Button>
- </div>
- </div>
- );
-}
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 (
- <div className="m-3 ml-1 mr-7 bg-white p-2 sm:p-4 md:p-6 lg:p-10">
- <div className="flex flex-col justify-between md:flex-row">
- <div className="flex flex-col">
- <b className="hidden text-base md:text-lg lg:block lg:text-xl">VECTOR STORE</b>
- <b className="text-center text-xl md:text-2xl lg:text-left lg:text-3xl">
- {vectorStore.name}
- </b>
- </div>
- <div className="mt-3 flex flex-row gap-x-3 md:mt-0">
- <div>
- <DeleteIconButton
- onClick={() => {
- console.log('click');
- }}
- />
- </div>
- <div>
- <UploadFileButton
- onClick={() => {
- setOpen(true);
- }}
- />
- </div>
- </div>
- </div>
-
- <div className="mt-3 flex flex-col">
- <div className="flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <InfoIcon className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp; ID
- </span>
- <span className="w-1/2 break-words text-gray-500 md:w-3/5">{vectorStore._id}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <BarChart4Icon className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp;Usage this &nbsp;month
- </span>
- <div className="w-1/2 md:w-3/5">
- <p className="text-gray-500">
- <span className="text-[#91c561]">0 KB hours</span>
- &nbsp; Free until end of 2024
- </p>
- </div>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <InfoIcon className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp;Size
- </span>
- <span className="w-1/2 text-gray-500 md:w-3/5">{vectorStore.bytes} bytes</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <Clock3 className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp;Last active
- </span>
- <span className="w-1/2 text-gray-500 md:w-3/5">{vectorStore.lastActive}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <InfoIcon className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp;Expiration policy
- </span>
- <span className="w-1/2 text-gray-500 md:w-3/5">{vectorStore.expirationPolicy}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <FileClock className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp;Expires
- </span>
- <span className="w-1/2 text-gray-500 md:w-3/5">{vectorStore.expires}</span>
- </div>
- <div className="mt-3 flex flex-row">
- <span className="flex w-1/2 flex-row items-center md:w-2/5">
- <Clock3 className="text-base text-gray-500 md:text-lg lg:text-xl" />
- &nbsp;Created At
- </span>
- <span className="w-1/2 text-gray-500 md:w-3/5">{vectorStore.createdAt.toString()}</span>
- </div>
- </div>
-
- <div className="mt-10 flex flex-col">
- <div>
- <b className="text-base md:text-lg lg:text-xl">Files attached</b>
- </div>
- <div className="flex flex-col divide-y">
- <div className="mt-2 flex flex-row">
- <div className="w-1/2 text-base md:text-lg lg:w-2/3 lg:text-xl">File</div>
- <div className="w-1/2 text-base md:text-lg lg:w-1/3 lg:text-xl">Uploaded</div>
- </div>
- <div>
- {filesAttached.map((file, index) => (
- <div key={index} className="my-2 flex h-5 flex-row">
- <div className="lg:w flex w-1/2 flex-row content-center lg:w-2/3">
- <FileIcon className="m-0 size-5 p-0" />
- <div className="ml-2 content-center">{file.filename}</div>
- </div>
- <div className="flex w-1/2 flex-row lg:w-1/3">
- <div className="content-center text-nowrap">{file.createdAt?.toString()}</div>
- <Button
- className="my-0 ml-3 h-min bg-transparent p-0 text-[#666666] hover:bg-slate-200"
- onClick={() => console.log('click')}
- >
- <TrashIcon className="m-0 p-0" />
- </Button>
- </div>
- </div>
- ))}
- </div>
- </div>
- </div>
-
- <div className="mt-10 flex flex-col">
- <div className="flex flex-row justify-between">
- <b className="text-base md:text-lg lg:text-xl">Used by</b>
- <Button variant={'default'}>
- <PlusIcon className="h-4 w-4 font-bold" />
- &nbsp; Create Assistant
- </Button>
- </div>
- <div className="flex flex-col divide-y">
- <div className="mt-2 flex flex-row">
- <div className="w-1/2 text-base md:text-lg lg:w-2/3 lg:text-xl">Resource</div>
- <div className="w-1/2 text-base md:text-lg lg:w-1/3 lg:text-xl">ID</div>
- </div>
- <div>
- {assistants.map((assistant, index) => (
- <div key={index} className="flex flex-row">
- <div className="w-1/2 content-center lg:w-2/3">{assistant.resource}</div>
- <div className="flex w-1/2 flex-row lg:w-1/3">
- <div className="content-center">{assistant.id}</div>
- </div>
- </div>
- ))}
- </div>
- </div>
- </div>
- {open && <UploadFileModal open={open} onOpenChange={setOpen} />}
- </div>
- );
-}
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 (
- <div className="flex flex-col">
- <div className="m-3 flex max-h-[10vh] flex-col">
- <h2 className="text-lg">
- <strong>Vector Stores</strong>
- </h2>
- <div className="m-1 mt-2 flex w-full flex-row justify-between gap-x-2 lg:m-0">
- <div className="flex w-2/3 flex-row">
- <Button variant="ghost" className="m-0 mr-2 p-0">
- <ListFilter className="h-4 w-4" />
- </Button>
- <Input
- placeholder={localize('com_files_filter')}
- value={''}
- onChange={() => {
- console.log('changed');
- }}
- className="max-w-sm border-border-light placeholder:text-text-secondary"
- />
- </div>
- <div className="w-1/3">
- <VectorStoreButton
- onClick={() => {
- console.log('Add Vector Store');
- }}
- />
- </div>
- </div>
- </div>
- <div className="mr-2 mt-2 max-h-[80vh] w-full overflow-y-auto">
- <VectorStoreList vectorStores={fakeVectorStores} deleteVectorStore={deleteVectorStore} />
- </div>
- </div>
- );
-}
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 (
- <div className="max-h-[100vh] bg-[#f9f9f9] p-0 lg:p-7">
- <div className="m-4 flex max-h-[10vh] w-full flex-row justify-between md:m-2">
- <FilesSectionSelector />
- <Button
- className="block lg:hidden"
- variant={'outline'}
- size={'sm'}
- onClick={() => {
- navigate('/d/vector-stores');
- }}
- >
- Go back
- </Button>
- </div>
- <div className="flex max-h-[90vh] w-full flex-row divide-x">
- <div
- className={`max-h-full w-full xl:w-1/3 ${
- params.vectorStoreId ? 'hidden w-1/2 lg:block lg:w-1/2' : 'md:w-full'
- }`}
- >
- <VectorStoreSidePanel />
- </div>
- <div
- className={`max-h-full w-full overflow-y-auto xl:w-2/3 ${
- params.vectorStoreId ? 'lg:w-1/2' : 'hidden md:w-1/2 lg:block'
- }`}
- >
- <Outlet />
- </div>
- </div>
- </div>
- );
-}
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