mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 14:08:21 +00:00
- refactor: Render Pending Turn and Steers from the Package - refactor: Keep Package Pending Rows Inert Without a Steer Host - fix: Read the Host Thread Mode on Every Render - fix: Point the Hosts Guard at the Messages Loader - fix: Follow the Moved Pending Rows in the Guard and Lazy Chunk Specs - fix: Ship Message Body Typography With the Shared Theme Styles - fix: Keep the App Message Typography Cascade With the Shared Styles
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
import { MessagesHostProvider } from '@librechat/chat/react';
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
import type { MessagesHost } from '@librechat/chat/react';
|
|
|
|
/** A messages host for specs whose subject is not the rows: inert scrolling, no forking,
|
|
* copying or read-aloud, and rows that render nothing. */
|
|
export const testMessagesHost: MessagesHost = {
|
|
useHour12: () => undefined,
|
|
renderFiles: () => null,
|
|
useForkPreferences: () => ({
|
|
option: '',
|
|
setOption: () => undefined,
|
|
splitAtTarget: false,
|
|
setSplitAtTarget: () => undefined,
|
|
rememberOption: false,
|
|
setRememberOption: () => undefined,
|
|
}),
|
|
useForkConversation: () => null,
|
|
useMessageCopy: () => ({ copyToClipboard: () => undefined, canCopy: false }),
|
|
useGetMessages: () => () => undefined,
|
|
useHasPendingTurn: () => false,
|
|
renderMessageAudio: () => null,
|
|
useScreenshotTarget: () => undefined,
|
|
useAutoScroll: () => false,
|
|
useConversationMessages: () => undefined,
|
|
useAssistant: () => undefined,
|
|
useGetAddedConvo: () => () => null,
|
|
useStreamedAttachments: () => undefined,
|
|
useMessageFeedback: () => () => undefined,
|
|
useSeenSource: () => ({
|
|
readReply: () => undefined,
|
|
hasReplyProof: () => false,
|
|
markSeen: () => undefined,
|
|
consumeFocusSuppression: () => false,
|
|
}),
|
|
renderMessageIcon: () => null,
|
|
useMaximizeChatSpace: () => false,
|
|
useFlatThread: () => true,
|
|
useHideSelectedAuthor: () => false,
|
|
useAgentsMap: () => undefined,
|
|
renderMessageBody: () => null,
|
|
renderWakeup: () => null,
|
|
renderPrivateText: () => null,
|
|
renderActivity: () => null,
|
|
useFileMap: () => undefined,
|
|
};
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
/** Mounts `testMessagesHost` for specs that render a chat pane's message list, with the query
|
|
* client its seen reporting reads. */
|
|
export function MessagesHostTestProvider({ children }: { children?: React.ReactNode }) {
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<MessagesHostProvider host={testMessagesHost}>{children}</MessagesHostProvider>
|
|
</QueryClientProvider>
|
|
);
|
|
}
|