From 59557a46eb29e48281db1e987bb946eeefb87e8b Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Thu, 29 Oct 2026 20:38:24 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8E=20refactor:=20Move=20Composer=20At?= =?UTF-8?q?tachment=20Components=20Into=20the=20Chat=20Package=20(#17533)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: Move Composer Attachment Components Into @librechat/chat * test: Cover the Pasted Text Editor From Paste to Saved Edit * test: Keep the Real Data Provider Enums in the ChatView Subagent Spec * refactor: Build the Source Badge Styles at Render Time * test: Reopen the Pasted Text Correction From Its Replacement Chip * chore: Re-record the Attachment Design Suppressions on Dev * test: Merge the SteerPart Package Mocks Into One Factory --- bun.lock | 2 + client/src/App.jsx | 5 +- client/src/Providers/FilesHostContext.tsx | 11 ++ client/src/components/Chat/Input/ChatForm.tsx | 2 +- .../components/Chat/Input/Composer/Files.tsx | 4 +- .../Chat/Input/Composer/Palette.tsx | 4 +- .../Composer/__tests__/semanticTokens.spec.ts | 2 +- .../Chat/Input/Files/DragDropWrapper.tsx | 2 +- .../components/Chat/Input/Files/FileRow.tsx | 3 +- .../Chat/Input/Files/Table/Columns.tsx | 5 +- .../Input/Files/__tests__/FileRow.spec.tsx | 16 ++- .../__tests__/ChatForm.attachments.spec.tsx | 10 +- .../Chat/Messages/Content/EditFiles.tsx | 3 +- .../Chat/Messages/Content/Files.tsx | 2 +- .../Messages/Content/Parts/Attachment.tsx | 2 +- .../Chat/Messages/Content/Parts/SteerPart.tsx | 8 +- .../Parts/__tests__/ArtifactRouting.test.tsx | 12 +- .../Parts/__tests__/LogContent.test.tsx | 6 +- .../Parts/__tests__/SteerPart.test.tsx | 14 +-- .../Parts/__tests__/TextAttachment.test.tsx | 12 +- .../Messages/Content/__tests__/Files.test.tsx | 24 ++-- .../Chat/__tests__/ChatView.subagent.spec.tsx | 1 + .../Input/SetKeyDialog/GoogleConfig.tsx | 2 +- .../components/SidePanel/Builder/Images.tsx | 2 +- .../Files/__tests__/useFileDeletion.spec.tsx | 16 ++- client/src/hooks/Files/usePastedTextEdit.ts | 11 +- client/src/utils/files.ts | 107 ----------------- .../scenarios/composer-attachments.spec.ts | 65 +++++++++++ eslint-suppressions.json | 72 ++++++------ package-lock.json | 2 + packages/chat/package.json | 2 + packages/chat/src/components.ts | 14 +++ .../composer/files}/DragDropOverlay.tsx | 5 +- .../composer/files}/FileContainer.tsx | 7 +- .../composer/files}/FilePreview.tsx | 10 +- .../components/composer/files}/FileUpload.tsx | 4 +- .../src/components/composer/files}/Image.tsx | 2 +- .../composer/files}/ImagePreview.tsx | 6 +- .../composer/files}/PastedTextDialog.tsx | 16 ++- .../composer/files}/ProgressCircle.tsx | 2 +- .../components/composer/files}/RemoveFile.tsx | 4 +- .../components/composer/files}/SourceIcon.tsx | 36 +++--- .../files}/__tests__/FileContainer.spec.tsx | 8 +- .../files}/__tests__/ImagePreview.spec.tsx | 3 + .../__tests__/PastedTextDialog.spec.tsx | 10 +- .../files/__tests__/RemoveFile.spec.tsx | 24 ++++ .../files/__tests__/SourceIcon.spec.tsx | 41 +++++++ .../composer/files/__tests__/kinds.spec.ts | 17 +++ .../src/components/composer/files/kinds.ts | 109 ++++++++++++++++++ packages/chat/src/react.ts | 2 + packages/chat/src/react/files.tsx | 32 +++++ 51 files changed, 500 insertions(+), 281 deletions(-) create mode 100644 client/src/Providers/FilesHostContext.tsx create mode 100644 e2e/specs/mock/scenarios/composer-attachments.spec.ts rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/DragDropOverlay.tsx (96%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/FileContainer.tsx (97%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/FilePreview.tsx (76%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/FileUpload.tsx (96%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/Image.tsx (97%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/ImagePreview.tsx (98%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/PastedTextDialog.tsx (80%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/ProgressCircle.tsx (97%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/RemoveFile.tsx (94%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/SourceIcon.tsx (65%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/__tests__/FileContainer.spec.tsx (97%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/__tests__/ImagePreview.spec.tsx (98%) rename {client/src/components/Chat/Input/Files => packages/chat/src/components/composer/files}/__tests__/PastedTextDialog.spec.tsx (92%) create mode 100644 packages/chat/src/components/composer/files/__tests__/RemoveFile.spec.tsx create mode 100644 packages/chat/src/components/composer/files/__tests__/SourceIcon.spec.tsx create mode 100644 packages/chat/src/components/composer/files/__tests__/kinds.spec.ts create mode 100644 packages/chat/src/components/composer/files/kinds.ts create mode 100644 packages/chat/src/react/files.tsx diff --git a/bun.lock b/bun.lock index 4b77fe18f8..162a43f8b9 100644 --- a/bun.lock +++ b/bun.lock @@ -448,6 +448,7 @@ "@babel/preset-react": "^7.22.15", "@babel/preset-typescript": "^7.21.0", "@librechat/client": "*", + "@radix-ui/react-dialog": "^1.1.23", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", "@types/jest": "^29.5.2", @@ -470,6 +471,7 @@ }, "peerDependencies": { "@librechat/client": "*", + "@radix-ui/react-dialog": "^1.1.23", "jotai": "^2.12.5", "librechat-data-provider": "*", "lucide": "^0.528.0", diff --git a/client/src/App.jsx b/client/src/App.jsx index a6a0c9f0db..19318aae21 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -5,6 +5,7 @@ import { RouterProvider } from 'react-router-dom'; import { HTML5Backend } from 'react-dnd-html5-backend'; import { Toast, ToastViewport, ToastProvider, useInputModality } from '@librechat/client'; import { QueryClient, QueryClientProvider, QueryCache, MutationCache } from '@tanstack/react-query'; +import { FilesHostProvider, appFilesHost } from '~/Providers/FilesHostContext'; import Direction, { ToastSwipeProvider } from '~/Providers/Direction'; import { ScreenshotProvider, useApiErrorBoundary } from './hooks'; import WakeLockManager from '~/components/System/WakeLockManager'; @@ -81,7 +82,9 @@ const App = () => { transition-safe reads are gated behind `_TRANSITION_SUPPORT_UNSTABLE` hooks this app does not use. Worth revisiting once that state has moved to Jotai. */} - + + + diff --git a/client/src/Providers/FilesHostContext.tsx b/client/src/Providers/FilesHostContext.tsx new file mode 100644 index 0000000000..88a7fd4f43 --- /dev/null +++ b/client/src/Providers/FilesHostContext.tsx @@ -0,0 +1,11 @@ +import type { FilesHost } from '@librechat/chat/react'; +import { MinimalIcon } from '~/components/Endpoints'; + +/** The app's capabilities for the attachment components in `@librechat/chat`. */ +export const appFilesHost: FilesHost = { + renderEndpointIcon: (endpoint) => ( + + ), +}; + +export { FilesHostProvider, useFilesHost } from '@librechat/chat/react'; diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx index 0555e73e9d..f845f3d7a4 100644 --- a/client/src/components/Chat/Input/ChatForm.tsx +++ b/client/src/components/Chat/Input/ChatForm.tsx @@ -4,6 +4,7 @@ import { useWatch } from 'react-hook-form'; import { useAtom, useAtomValue } from 'jotai'; import { useNavigate } from 'react-router-dom'; import { useDirection } from '@radix-ui/react-direction'; +import { PastedTextDialog } from '@librechat/chat/components'; import { useSteering, showStopButtonByIndex, useComposerRestoreHost } from '@librechat/chat/react'; import { submitFromComposer, @@ -70,7 +71,6 @@ import useComposerItems from '~/hooks/Input/useComposerItems'; import useAttachTarget from '~/hooks/Input/useAttachTarget'; import { chatDirectionAtom } from '~/store/chatDirection'; import Hints, { composerHintId } from './Composer/Hints'; -import PastedTextDialog from './Files/PastedTextDialog'; import DuringRunSendButton from './DuringRunSendButton'; import ProjectLandingChip from '../ProjectLandingChip'; import useHasAccess from '~/hooks/Roles/useHasAccess'; diff --git a/client/src/components/Chat/Input/Composer/Files.tsx b/client/src/components/Chat/Input/Composer/Files.tsx index e9893fabe3..59ebc74ab3 100644 --- a/client/src/components/Chat/Input/Composer/Files.tsx +++ b/client/src/components/Chat/Input/Composer/Files.tsx @@ -1,6 +1,7 @@ import { memo, useRef, useMemo, useState, useEffect } from 'react'; import { Eye, Search } from 'lucide-react'; import { apiBaseUrl } from 'librechat-data-provider'; +import { FilePreview, getFileType } from '@librechat/chat/components'; import { Button, IconButton, Spinner, useToastContext } from '@librechat/client'; import type { TFile } from 'librechat-data-provider'; import type { TranslationKeys } from '~/hooks'; @@ -9,10 +10,9 @@ import FilePreviewDialog, { getDisplayType, } from '~/components/Chat/Messages/Content/FilePreviewDialog'; import { getPreviewKind } from '~/components/Chat/Messages/Content/preview'; -import { getFileType, toAbsoluteFilePath, triggerDownload } from '~/utils'; import DialogImage from '~/components/Chat/Messages/Content/DialogImage'; -import FilePreview from '~/components/Chat/Input/Files/FilePreview'; import { useGetFiles, useFilePreviewBlob } from '~/data-provider'; +import { toAbsoluteFilePath, triggerDownload } from '~/utils'; import { useLocalize, useAuthContext } from '~/hooks'; export type FileView = 'all' | 'images' | 'documents'; diff --git a/client/src/components/Chat/Input/Composer/Palette.tsx b/client/src/components/Chat/Input/Composer/Palette.tsx index 30a0e47ed5..ea3792d262 100644 --- a/client/src/components/Chat/Input/Composer/Palette.tsx +++ b/client/src/components/Chat/Input/Composer/Palette.tsx @@ -12,6 +12,7 @@ import * as Ariakit from '@ariakit/react'; import { AutoSizer, List } from 'react-virtualized'; import { composerLiftFamily } from '@librechat/chat/react'; import { Star, Plus, Search, ChevronDown } from 'lucide-react'; +import { FilePreview, getFileType } from '@librechat/chat/components'; import { Button, FileUpload, IconButton, TooltipAnchor, useMediaQuery } from '@librechat/client'; import type { TFile, @@ -24,15 +25,14 @@ import type { AttachEntry } from '~/hooks/Input/useAttachItems'; import type { ExtendedFile, FileSetter } from '~/common'; import type { CatalogSection } from './Catalog'; import type { TranslationKeys } from '~/hooks'; -import FilePreview from '~/components/Chat/Input/Files/FilePreview'; import { SharePointPickerDialog } from '~/components/SharePoint'; import useReducedMotion from '~/hooks/Generic/useReducedMotion'; -import { getFileType, isUnifiedUploadMode, cn } from '~/utils'; import useToolFavorites from '~/hooks/Input/useToolFavorites'; import useElementSize from '~/hooks/Generic/useElementSize'; import useRecentFiles from '~/hooks/Input/useRecentFiles'; import useAttachItems from '~/hooks/Input/useAttachItems'; import { useMCPRefresh } from '~/hooks/MCP/useMCPRefresh'; +import { isUnifiedUploadMode, cn } from '~/utils'; import { isMacPlatform } from '~/utils/shortcuts'; import { useBadgeRowContext } from '~/Providers'; import { useLocalize } from '~/hooks'; diff --git a/client/src/components/Chat/Input/Composer/__tests__/semanticTokens.spec.ts b/client/src/components/Chat/Input/Composer/__tests__/semanticTokens.spec.ts index f4274c0e24..f55c880bdb 100644 --- a/client/src/components/Chat/Input/Composer/__tests__/semanticTokens.spec.ts +++ b/client/src/components/Chat/Input/Composer/__tests__/semanticTokens.spec.ts @@ -17,7 +17,7 @@ const collectSourceModules = (directory: string): string[] => const composerModules = [ ...collectSourceModules(composerRoot), ...collectSourceModules( - join(__dirname, '../../../../../../../packages/chat/src/components/composer'), + join(__dirname, '../../../../../../../packages/chat/src/components/composer/bar'), ), ]; diff --git a/client/src/components/Chat/Input/Files/DragDropWrapper.tsx b/client/src/components/Chat/Input/Files/DragDropWrapper.tsx index 2538315554..f5a4b6ebd4 100644 --- a/client/src/components/Chat/Input/Files/DragDropWrapper.tsx +++ b/client/src/components/Chat/Input/Files/DragDropWrapper.tsx @@ -1,4 +1,4 @@ -import DragDropOverlay from '~/components/Chat/Input/Files/DragDropOverlay'; +import { DragDropOverlay } from '@librechat/chat/components'; import DragDropModal from '~/components/Chat/Input/Files/DragDropModal'; import { DragDropProvider, UploadModalProvider } from '~/Providers'; import { useDragHelpers } from '~/hooks'; diff --git a/client/src/components/Chat/Input/Files/FileRow.tsx b/client/src/components/Chat/Input/Files/FileRow.tsx index bee3166100..7a46bbc810 100644 --- a/client/src/components/Chat/Input/Files/FileRow.tsx +++ b/client/src/components/Chat/Input/Files/FileRow.tsx @@ -1,13 +1,12 @@ import { useEffect } from 'react'; import { useToastContext } from '@librechat/client'; import { EToolResources } from 'librechat-data-provider'; +import { FileContainer, AttachmentImage as Image } from '@librechat/chat/components'; import type { ExtendedFile } from '~/common'; import { useDeleteFilesMutation } from '~/data-provider'; import { logger, getCachedPreview } from '~/utils'; import { useFileDeletion } from '~/hooks/Files'; -import FileContainer from './FileContainer'; import { useLocalize } from '~/hooks'; -import Image from './Image'; /** * Shared wrapper with a stable module-scope identity. Passing an inline arrow as diff --git a/client/src/components/Chat/Input/Files/Table/Columns.tsx b/client/src/components/Chat/Input/Files/Table/Columns.tsx index 2f8b6c7543..ec50fb8089 100644 --- a/client/src/components/Chat/Input/Files/Table/Columns.tsx +++ b/client/src/components/Chat/Input/Files/Table/Columns.tsx @@ -1,6 +1,7 @@ /* eslint-disable react-hooks/rules-of-hooks */ import { FileSources, FileContext } from 'librechat-data-provider'; import { ArrowUpDown, ArrowUp, ArrowDown, Database } from 'lucide-react'; +import { ImagePreview, FilePreview, getFileType } from '@librechat/chat/components'; import { Button, Checkbox, @@ -11,11 +12,9 @@ import { } from '@librechat/client'; import type { ColumnDef } from '@tanstack/react-table'; import type { TFile } from 'librechat-data-provider'; -import ImagePreview from '~/components/Chat/Input/Files/ImagePreview'; -import FilePreview from '~/components/Chat/Input/Files/FilePreview'; import { TranslationKeys, useLocalize } from '~/hooks'; import { SortFilterHeader } from './SortFilterHeader'; -import { formatDate, getFileType } from '~/utils'; +import { formatDate } from '~/utils'; const contextMap: Record = { [FileContext.avatar]: 'com_ui_avatar', diff --git a/client/src/components/Chat/Input/Files/__tests__/FileRow.spec.tsx b/client/src/components/Chat/Input/Files/__tests__/FileRow.spec.tsx index c4cb734091..8ed712495d 100644 --- a/client/src/components/Chat/Input/Files/__tests__/FileRow.spec.tsx +++ b/client/src/components/Chat/Input/Files/__tests__/FileRow.spec.tsx @@ -25,8 +25,9 @@ jest.mock('~/utils', () => ({ getCachedPreview: jest.fn(() => undefined), })); -jest.mock('../Image', () => { - return function MockImage({ url, progress, source }: any) { +jest.mock('@librechat/chat/components', () => ({ + ...jest.requireActual('@librechat/chat/components'), + AttachmentImage: function MockImage({ url, progress, source }: any) { return (
{url} @@ -34,11 +35,8 @@ jest.mock('../Image', () => { {source}
); - }; -}); - -jest.mock('../FileContainer', () => { - return function MockFileContainer({ file, onClick, ariaLabel, subtitleAction }: any) { + }, + FileContainer: function MockFileContainer({ file, onClick, ariaLabel, subtitleAction }: any) { return (
{file.filename} @@ -54,8 +52,8 @@ jest.mock('../FileContainer', () => { )}
); - }; -}); + }, +})); const mockUseLocalize = jest.requireMock('~/hooks').useLocalize; const mockUseDeleteFilesMutation = jest.requireMock('~/data-provider').useDeleteFilesMutation; diff --git a/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx b/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx index 4cb40b37c6..f2ec40ef18 100644 --- a/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx +++ b/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx @@ -8,6 +8,7 @@ import { RecoilRoot, useRecoilState } from 'recoil'; import userEvent from '@testing-library/user-event'; import { HTML5Backend } from 'react-dnd-html5-backend'; import { BrowserRouter as Router } from 'react-router-dom'; +import { FileContainer } from '@librechat/chat/components'; import { pendingQuotesByConvoId } from '@librechat/chat/react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { QueryKeys, FileSources, EModelEndpoint } from 'librechat-data-provider'; @@ -18,7 +19,6 @@ import type { TranslationKeys } from '~/hooks/useLocalize'; import { getDraft, getPendingDraftId, setDraft } from '~/utils'; import { ChatContext, ChatFormProvider } from '~/Providers'; import { AuthContextProvider } from '~/hooks/AuthContext'; -import * as FileContainer from '../Files/FileContainer'; import { SteerHostTestProvider } from 'test/steerHost'; import ChatForm from '../ChatForm'; import store from '~/store'; @@ -27,6 +27,11 @@ const mockUpload = jest.fn(); const mockAsk = jest.fn(); // Production keeps `t` stable between language changes; the global test double does not. +jest.mock('@librechat/chat/components', () => { + const actual = jest.requireActual('@librechat/chat/components'); + return { ...actual, FileContainer: jest.fn(actual.FileContainer) }; +}); + jest.mock('react-i18next', () => { const actual = jest.requireActual('react-i18next'); const t = (key: TranslationKeys, options?: import('i18next').TOptions) => @@ -473,7 +478,8 @@ describe('ChatForm attachments', () => { expect(await screen.findByRole('button', { name: 'report.pdf' })).toBeVisible(); const textarea = screen.getByTestId('text-input'); await userEvent.click(textarea); - const preview = jest.spyOn(FileContainer, 'default'); + const preview = jest.mocked(FileContainer); + preview.mockClear(); await userEvent.type(textarea, 'read this document'); diff --git a/client/src/components/Chat/Messages/Content/EditFiles.tsx b/client/src/components/Chat/Messages/Content/EditFiles.tsx index 5077d8e191..3d6e186aa2 100644 --- a/client/src/components/Chat/Messages/Content/EditFiles.tsx +++ b/client/src/components/Chat/Messages/Content/EditFiles.tsx @@ -1,7 +1,6 @@ import { useEffect, useRef } from 'react'; +import { FileContainer, AttachmentImage as Image } from '@librechat/chat/components'; import type { TFile } from 'librechat-data-provider'; -import FileContainer from '~/components/Chat/Input/Files/FileContainer'; -import Image from '~/components/Chat/Input/Files/Image'; import { getCachedPreview } from '~/utils'; import { useLocalize } from '~/hooks'; diff --git a/client/src/components/Chat/Messages/Content/Files.tsx b/client/src/components/Chat/Messages/Content/Files.tsx index 097acb007b..cfa2a4e84b 100644 --- a/client/src/components/Chat/Messages/Content/Files.tsx +++ b/client/src/components/Chat/Messages/Content/Files.tsx @@ -1,7 +1,7 @@ import { useMemo, useState, useCallback, memo } from 'react'; +import { FileContainer } from '@librechat/chat/components'; import type { TFile, TMessage } from 'librechat-data-provider'; import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext'; -import FileContainer from '~/components/Chat/Input/Files/FileContainer'; import { usesImagePreview, hydrateFileDeliveryMetadata } from '~/utils'; import FilePreviewDialog from './FilePreviewDialog'; import { useShareContext } from '~/Providers'; diff --git a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx index de94a205d5..2fcc84cdbe 100644 --- a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx @@ -1,6 +1,7 @@ import { memo, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'; import { Tools } from 'librechat-data-provider'; import { Button, useRemScale } from '@librechat/client'; +import { FileContainer } from '@librechat/chat/components'; import { Loader2, AlertCircle, Download, ChevronDown, Files as FilesIcon } from 'lucide-react'; import { ARTIFACT_ROW_NAV_SPACING, @@ -20,7 +21,6 @@ import { renderAttachmentKey, } from './attachmentTypes'; import { useLocalize, useAttachmentPreviewSync, useExpandCollapse } from '~/hooks'; -import FileContainer from '~/components/Chat/Input/Files/FileContainer'; import { fileToArtifact, TOOL_ARTIFACT_TYPES } from '~/utils/artifacts'; import Image from '~/components/Chat/Messages/Content/Image'; import ToolMermaidArtifact from './ToolMermaidArtifact'; diff --git a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx index 57b6d86925..ccb24ff3cd 100644 --- a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx @@ -1,5 +1,10 @@ import { memo, useMemo, useState, useEffect, useCallback } from 'react'; -import { SteerReceipt, CollapsibleText, MessageTimestamp } from '@librechat/chat/components'; +import { + SteerReceipt, + FileContainer, + CollapsibleText, + MessageTimestamp, +} from '@librechat/chat/components'; import type { SteerReceiptState } from '@librechat/chat/components'; import type { TFile, TMessage } from 'librechat-data-provider'; import FilePreviewDialog from '~/components/Chat/Messages/Content/FilePreviewDialog'; @@ -7,7 +12,6 @@ import MessageQuotes from '~/components/Chat/Messages/Content/MessageQuotes'; import { cn, hydrateFileDeliveryMetadata, usesImagePreview } from '~/utils'; import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite'; import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext'; -import FileContainer from '~/components/Chat/Input/Files/FileContainer'; import Image from '~/components/Chat/Messages/Content/Image'; import { useShareContext } from '~/Providers'; import { useLocalize } from '~/hooks'; diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/ArtifactRouting.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/ArtifactRouting.test.tsx index a4f9b52aae..6aeb918c58 100644 --- a/client/src/components/Chat/Messages/Content/Parts/__tests__/ArtifactRouting.test.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/ArtifactRouting.test.tsx @@ -29,16 +29,12 @@ jest.mock('../LogLink', () => ({ useAttachmentLink: () => ({ handleDownload: jest.fn() }), })); -jest.mock('~/components/Chat/Input/Files/FileContainer', () => ({ - __esModule: true, - default: ({ file, displayName }: { file: { filename?: string }; displayName?: string }) => ( +jest.mock('@librechat/chat/components', () => ({ + ...jest.requireActual('@librechat/chat/components'), + FileContainer: ({ file, displayName }: { file: { filename?: string }; displayName?: string }) => (
{displayName ?? file.filename ?? ''}
), -})); - -jest.mock('~/components/Chat/Input/Files/FilePreview', () => ({ - __esModule: true, - default: () =>
, + FilePreview: () =>
, })); jest.mock('~/components/Chat/Messages/Content/Image', () => ({ diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/LogContent.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/LogContent.test.tsx index f98b4e4eb3..ce5e78455e 100644 --- a/client/src/components/Chat/Messages/Content/Parts/__tests__/LogContent.test.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/LogContent.test.tsx @@ -32,9 +32,9 @@ jest.mock('../LogLink', () => ({ useAttachmentLink: () => ({ handleDownload: jest.fn() }), })); -jest.mock('~/components/Chat/Input/Files/FilePreview', () => ({ - __esModule: true, - default: () =>
, +jest.mock('@librechat/chat/components', () => ({ + ...jest.requireActual('@librechat/chat/components'), + FilePreview: () =>
, })); jest.mock('~/components/Chat/Messages/Content/Image', () => ({ diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx index 319901739a..71d93c2c03 100644 --- a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx @@ -30,6 +30,11 @@ jest.mock('~/Providers', () => ({ jest.mock('@librechat/chat/components', () => ({ ...jest.requireActual('@librechat/chat/components'), MessageTimestamp: () =>