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
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🧹 refactor: Remove Dead Client Hooks, Store Modules and Utilities (#17111)
Marco Berettaa247a12a3d96
diff --git a/bun.lock b/bun.lockindex 8eb42917e3..875e4b24c9 100644--- a/bun.lock+++ b/bun.lock@@ -217,7 +217,6 @@"micromark-extension-math": "^3.1.0","monaco-editor": "^0.56.0","qrcode.react": "^4.2.0",- "rc-input-number": "^7.4.2","react": "^18.2.0","react-avatar-editor": "^13.0.2","react-dnd": "^16.0.1",diff --git a/client/package.json b/client/package.jsonindex d036828c14..a26e0cb9ae 100644--- a/client/package.json+++ b/client/package.json@@ -101,7 +101,6 @@"monaco-editor": "^0.56.0","morphicons": "^1.4.1","qrcode.react": "^4.2.0",- "rc-input-number": "^7.4.2","react": "^18.2.0","react-avatar-editor": "^13.0.2","react-dnd": "^16.0.1",diff --git a/client/src/common/index.ts b/client/src/common/index.tsindex 98ef815d58..8188e1125c 100644--- a/client/src/common/index.ts+++ b/client/src/common/index.ts@@ -2,7 +2,6 @@ export * from './a11y';export * from './artifacts';export * from './types';export * from './menus';-export * from './tools';export * from './ptc';export * from './selector';export * from './assistants-types';diff --git a/client/src/common/tools.ts b/client/src/common/tools.tsdeleted file mode 100644index 140f5678c1..0000000000--- a/client/src/common/tools.ts+++ /dev/null@@ -1,6 +0,0 @@-import type { AuthType } from 'librechat-data-provider';--export type ApiKeyFormData = {- apiKey: string;- authType?: string | AuthType;-};diff --git a/client/src/common/types.ts b/client/src/common/types.tsindex 5d44eb600a..f741ba17cc 100644--- a/client/src/common/types.ts+++ b/client/src/common/types.ts@@ -1,11 +1,9 @@import { RefObject } from 'react';-import { FileSources, EModelEndpoint, isEphemeralAgentId } from 'librechat-data-provider';+import { FileSources, isEphemeralAgentId } from 'librechat-data-provider';import type { UseMutationResult } from '@tanstack/react-query';-import type * as InputNumberPrimitive from 'rc-input-number';-import type { SetterOrUpdater, RecoilState } from 'recoil';-import type { ColumnDef } from '@tanstack/react-table';import type * as t from 'librechat-data-provider';import type { LucideIcon } from 'lucide-react';+import type { SetterOrUpdater } from 'recoil';import type { TranslationKeys } from '~/hooks';import { MCPServerDefinition } from '~/hooks/MCP/useMCPServerManager';@@ -44,29 +42,6 @@ export enum TTSEndpoints {external = 'external',}-export type AudioChunk = {- audio: string;- isFinal: boolean;- alignment: {- char_start_times_ms: number[];- chars_durations_ms: number[];- chars: string[];- };- normalizedAlignment: {- char_start_times_ms: number[];- chars_durations_ms: number[];- chars: string[];- };-};--export type BadgeItem = {- id: string;- icon: React.ComponentType<any>;- label: string;- atom: RecoilState<boolean>;- isAvailable: boolean;-};-export type AssistantListItem = {id: string;name: string;@@ -74,14 +49,6 @@ export type AssistantListItem = {model: string;};-export type AgentListItem = {- id: string;- name: string;- avatar: t.Agent['avatar'];-};--export type TPluginMap = Record<string, t.TPlugin>;-export type GenericSetter<T> = (value: T | ((currentValue: T) => T)) => void;export type LastSelectedModels = Record<t.EModelEndpoint, string>;@@ -96,13 +63,6 @@ export type ChatFormValues = { text: string };export const mainTextareaId = 'prompt-textarea';export const globalAudioId = 'global-audio';-export enum IconContext {- landing = 'landing',- menuItem = 'menu-item',- nav = 'nav',- message = 'message',-}-export type NavLink = {title: TranslationKeys;label?: string;@@ -114,14 +74,6 @@ export type NavLink = {id: string;};-export interface DataColumnMeta {- meta:- | {- size: number | string;- }- | undefined;-}-export enum Panel {advanced = 'advanced',builder = 'builder',@@ -233,8 +185,6 @@ export type AgentModelPanelProps = {setActivePanel: React.Dispatch<React.SetStateAction<Panel>>;};-export type AugmentedColumnDef<TData, TValue> = ColumnDef<TData, TValue> & DataColumnMeta;-export type TSetOption = t.TSetOption;export type TSetExample = (@@ -243,8 +193,6 @@ export type TSetExample = (newValue: number | string | boolean | null,) => void;-export type OnInputNumberChange = InputNumberPrimitive.InputNumberProps['onChange'];-export const defaultDebouncedDelay = 450;export enum ESide {@@ -304,14 +252,6 @@ export type TSetOptionsPayload = {setOptions?: TSetOptions;};-export type TPresetItemProps = {- preset: t.TPreset;- value: t.TPreset;- onSelect: (preset: t.TPreset) => void;- onChangePreset: (preset: t.TPreset) => void;- onDeletePreset: (preset: t.TPreset) => void;-};-export type TOnClick = (e: React.MouseEvent<HTMLButtonElement>) => void;export type TGenButtonProps = {@@ -607,21 +547,6 @@ export interface ExtendedFile {metadata?: t.TFile['metadata'];}-export interface ModelItemProps {- modelName: string;- endpoint: EModelEndpoint;- isSelected: boolean;- onSelect: () => void;- onNavigateBack: () => void;- icon?: JSX.Element;- className?: string;-}--export interface SwitcherProps {- endpoint?: t.EModelEndpoint | null;- endpointKeyProvided: boolean;- isCollapsed: boolean;-}export type TLoginLayoutContext = {startupConfig: t.TStartupConfig | null;startupConfigError: unknown;@@ -663,23 +588,6 @@ export type TFinalResData = Omit<TBaseResData, 'conversation'> & {responseMessage?: t.TMessage;};-export type TVectorStore = {- _id: string;- object: 'vector_store';- created_at: string | Date;- name: string;- bytes?: number;- file_counts?: {- in_progress: number;- completed: number;- failed: number;- cancelled: number;- total: number;- };-};--export type TThread = { id: string; createdAt: string };-declare global {interface Window {google_tag_manager?: unknown;diff --git a/client/src/components/Agents/tests/Accessibility.spec.tsx b/client/src/components/Agents/tests/Accessibility.spec.tsxindex 2e605bd9c9..1bacdb0cc7 100644--- a/client/src/components/Agents/tests/Accessibility.spec.tsx+++ b/client/src/components/Agents/tests/Accessibility.spec.tsx@@ -128,7 +128,6 @@ jest.mock('~/data-provider', () => ({// Mock utility functionsjest.mock('~/utils/agents', () => ({renderAgentAvatar: jest.fn(() => <div data-testid="agent-avatar" />),- getContactDisplayName: jest.fn((agent) => agent.authorName),}));// Mock SmartLoaderdiff --git a/client/src/components/Conversations/__tests__/Convo.pullRequest.spec.tsx b/client/src/components/Conversations/__tests__/Convo.pullRequest.spec.tsxindex 56e773e620..99d37862db 100644--- a/client/src/components/Conversations/__tests__/Convo.pullRequest.spec.tsx+++ b/client/src/components/Conversations/__tests__/Convo.pullRequest.spec.tsx@@ -41,7 +41,6 @@ jest.mock('recoil', () => ({ useRecoilValue: () => [] }));jest.mock('~/store', () => ({__esModule: true,default: {- allConversationsSelector: 'allConversationsSelector',conversationIdByIndex: () => 'conversationIdByIndex',},}));diff --git a/client/src/components/Conversations/__tests__/Convo.status.spec.tsx b/client/src/components/Conversations/__tests__/Convo.status.spec.tsxindex 92953265cd..4b7ac33920 100644--- a/client/src/components/Conversations/__tests__/Convo.status.spec.tsx+++ b/client/src/components/Conversations/__tests__/Convo.status.spec.tsx@@ -41,7 +41,6 @@ jest.mock('recoil', () => ({jest.mock('~/store', () => ({__esModule: true,default: {- allConversationsSelector: 'allConversationsSelector',conversationIdByIndex: () => 'conversationIdByIndex',},}));diff --git a/client/src/components/SidePanel/Agents/AgentPanel.test.tsx b/client/src/components/SidePanel/Agents/AgentPanel.test.tsxindex cd5c775b2b..caab6e9194 100644--- a/client/src/components/SidePanel/Agents/AgentPanel.test.tsx+++ b/client/src/components/SidePanel/Agents/AgentPanel.test.tsx@@ -45,13 +45,6 @@ jest.mock('~/common/types', () => ({},}));-// Mock store to prevent import errors-jest.mock('~/store/toast', () => ({- default: () => ({- showToast: jest.fn(),- }),-}));-jest.mock('~/store', () => {});// Mock the data service to control network responsesdiff --git a/client/src/components/SidePanel/Agents/Tools/__tests__/SkillsDialog.spec.tsx b/client/src/components/SidePanel/Agents/Tools/__tests__/SkillsDialog.spec.tsxindex 7c07a94b6d..563eda736c 100644--- a/client/src/components/SidePanel/Agents/Tools/__tests__/SkillsDialog.spec.tsx+++ b/client/src/components/SidePanel/Agents/Tools/__tests__/SkillsDialog.spec.tsx@@ -6,7 +6,6 @@ import SkillsDialog from '../SkillsDialog';const mockFetchNextPage = jest.fn();const mockRefetch = jest.fn();-const mockUseListSkillsQuery = jest.fn();const mockUseSkillsInfiniteQuery = jest.fn();let mockInfiniteResult: {@@ -48,7 +47,6 @@ jest.mock('~/hooks', () => ({}));jest.mock('~/data-provider', () => ({- useListSkillsQuery: (...args: unknown[]) => mockUseListSkillsQuery(...args),useSkillsInfiniteQuery: (...args: unknown[]) => mockUseSkillsInfiniteQuery(...args),}));@@ -137,11 +135,6 @@ beforeEach(() => {};mockFetchNextPage.mockReset();mockRefetch.mockReset();- mockUseListSkillsQuery.mockReset();- mockUseListSkillsQuery.mockReturnValue({- data: { skills: [makeSkill('first', 'first-skill')] },- isLoading: false,- });mockUseSkillsInfiniteQuery.mockReset();mockUseSkillsInfiniteQuery.mockImplementation(() => mockInfiniteResult);});diff --git a/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx b/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsxindex bc6aa93af1..0fa87f6f97 100644--- a/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx+++ b/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx@@ -67,7 +67,6 @@ jest.mock('@ariakit/react/menu', () => ({}));jest.mock('~/data-provider', () => ({- useListSkillsQuery: () => ({ data: { skills: [] }, isLoading: false }),useGetToolFavoritesQuery: () => ({ data: [] }),}));diff --git a/client/src/data-provider/Files/sharepoint.ts b/client/src/data-provider/Files/sharepoint.tsindex 9cc08938cb..cccd859741 100644--- a/client/src/data-provider/Files/sharepoint.ts+++ b/client/src/data-provider/Files/sharepoint.ts@@ -12,14 +12,6 @@ export interface SharePointFile {sharePointItem: any;}-export interface SharePointDownloadProgress {- fileId: string;- fileName: string;- loaded: number;- total: number;- progress: number;-}-export interface SharePointBatchProgress {completed: number;total: number;@@ -27,81 +19,6 @@ export interface SharePointBatchProgress {failed: string[];}-export const useSharePointFileDownload = (): UseMutationResult<- File,- unknown,- {- file: SharePointFile;- accessToken: string;- onProgress?: (progress: SharePointDownloadProgress) => void;- }-> => {- return useMutation({- mutationFn: async ({ file, accessToken, onProgress }) => {- const downloadUrl =- file.downloadUrl ||- `https://graph.microsoft.com/v1.0/drives/${file.driveId}/items/${file.itemId}/content`;-- const response = await fetch(downloadUrl, {- headers: {- Authorization: `Bearer ${accessToken}`,- },- });-- if (!response.ok) {- throw new Error(`Download failed: ${response.status} ${response.statusText}`);- }-- const contentLength = parseInt(response.headers.get('content-length') || '0');- const reader = response.body?.getReader();- if (!reader) {- throw new Error('Failed to get response reader');- }-- const chunks: Uint8Array[] = [];- let receivedLength = 0;-- while (true) {- const { done, value } = await reader.read();-- if (done) break;-- chunks.push(value);- receivedLength += value.length;-- if (onProgress) {- onProgress({- fileId: file.id,- fileName: file.name,- loaded: receivedLength,- total: contentLength || file.size,- progress: Math.round((receivedLength / (contentLength || file.size)) * 100),- });- }- }-- const allChunks = new Uint8Array(receivedLength);- let position = 0;- for (const chunk of chunks) {- allChunks.set(chunk, position);- position += chunk.length;- }-- const contentType =- response.headers.get('content-type') || getMimeTypeFromFileName(file.name);-- const blob = new Blob([allChunks], { type: contentType });- const downloadedFile = new File([blob], file.name, {- type: contentType,- lastModified: Date.now(),- });-- return downloadedFile;- },- retry: 2,- });-};-export const useSharePointBatchDownload = (): UseMutationResult<File[],unknown,@@ -229,5 +146,3 @@ function getMimeTypeFromFileName(fileName: string): string {return mimeTypes[extension || ''] || 'application/octet-stream';}--export { getMimeTypeFromFileName };diff --git a/client/src/data-provider/Skills/queries.ts b/client/src/data-provider/Skills/queries.tsindex c66fa15166..b4e9f72157 100644--- a/client/src/data-provider/Skills/queries.ts+++ b/client/src/data-provider/Skills/queries.ts@@ -14,32 +14,6 @@ import type {UseInfiniteQueryOptions,} from '@tanstack/react-query';-/**- * Paginated skill list (single page) — use this for small lists or when you want to- * control pagination manually.- */-export const useListSkillsQuery = (- params?: TSkillListRequest,- config?: UseQueryOptions<TSkillListResponse>,-): QueryObserverResult<TSkillListResponse> => {- return useQuery<TSkillListResponse>(- [- QueryKeys.skills,- params?.category ?? '',- params?.search ?? '',- params?.limit ?? 20,- params?.cursor ?? '',- ],- () => dataService.listSkills(params),- {- refetchOnWindowFocus: false,- refetchOnReconnect: false,- refetchOnMount: false,- ...config,- },- );-};-/*** Cursor-paginated infinite query for skills. Use this for the main skills listing UI.*/diff --git a/client/src/data-provider/queries.ts b/client/src/data-provider/queries.tsindex a42e33cb4a..ba61985330 100644--- a/client/src/data-provider/queries.ts+++ b/client/src/data-provider/queries.ts@@ -15,7 +15,6 @@ import type {ConversationListParams,MessagesListParams,MessagesListResponse,- Assistant,AssistantListParams,AssistantListResponse,AssistantDocument,@@ -447,73 +446,6 @@ export const useListAssistantsQuery = <TData = AssistantListResponse>();};-/*-export const useListAssistantsInfiniteQuery = (- params?: AssistantListParams,- config?: UseInfiniteQueryOptions<AssistantListResponse, Error>,-) => {- const queryClient = useQueryClient();- const endpointsConfig = queryClient.getQueryData<TEndpointsConfig>([QueryKeys.endpoints]);- const keyExpiry = queryClient.getQueryData<TCheckUserKeyResponse>([- QueryKeys.name,- EModelEndpoint.assistants,- ]);- const userProvidesKey = !!endpointsConfig?.[EModelEndpoint.assistants]?.userProvide;- const keyProvided = userProvidesKey ? !!keyExpiry?.expiresAt : true;- const enabled = !!endpointsConfig?.[EModelEndpoint.assistants] && keyProvided;- return useInfiniteQuery<AssistantListResponse, Error>(- ['assistantsList', params],- ({ pageParam = '' }) => dataService.listAssistants({ ...params, after: pageParam }),- {- getNextPageParam: (lastPage) => {- // lastPage is of type AssistantListResponse, you can use the has_more and last_id from it directly- if (lastPage.has_more) {- return lastPage.last_id;- }- return undefined;- },- ...config,- enabled: config?.enabled !== undefined ? config?.enabled && enabled : enabled,- },- );-};-*/--/**- * Hook for retrieving details about a single assistant- */-export const useGetAssistantByIdQuery = (- endpoint: t.AssistantsEndpoint,- assistant_id: string,- config?: UseQueryOptions<Assistant>,-): QueryObserverResult<Assistant> => {- const queryClient = useQueryClient();- const endpointsConfig = queryClient.getQueryData<TEndpointsConfig>([QueryKeys.endpoints]);- const keyExpiry = queryClient.getQueryData<TCheckUserKeyResponse>([QueryKeys.name, endpoint]);- const userProvidesKey = endpointsConfig?.[endpoint]?.userProvide ?? false;- const keyProvided = userProvidesKey ? !!keyExpiry?.expiresAt : true;- const enabled = !!endpointsConfig?.[endpoint] && keyProvided;- const version = endpointsConfig?.[endpoint]?.version ?? defaultAssistantsVersion[endpoint];- return useQuery<Assistant>(- [QueryKeys.assistant, assistant_id],- () =>- dataService.getAssistantById({- endpoint,- assistant_id,- version,- }),- {- refetchOnWindowFocus: false,- refetchOnReconnect: false,- refetchOnMount: false,- retry: false,- ...config,- // Query will not execute until the assistant_id exists- enabled: config?.enabled !== undefined ? config.enabled && enabled : enabled,- },- );-};-/*** Hook for retrieving user's saved Assistant Actions*/@@ -585,23 +517,6 @@ export const useVoicesQuery = (});};-/* Custom config speech */-export const useCustomConfigSpeechQuery = (- config?: UseQueryOptions<t.TCustomConfigSpeechResponse>,-): QueryObserverResult<t.TCustomConfigSpeechResponse> => {- return useQuery<t.TCustomConfigSpeechResponse>(- [QueryKeys.customConfigSpeech],- () => dataService.getCustomConfigSpeech(),- {- refetchOnWindowFocus: false,- refetchOnReconnect: false,- refetchOnMount: false,- retry: false,- ...config,- },- );-};-/** Prompt */export const usePromptGroupsInfiniteQuery = (@@ -708,24 +623,6 @@ export const useGetCategories = <TData = t.TGetCategoriesResponse>();};-export const useGetRandomPrompts = (- filter: t.TGetRandomPromptsRequest,- config?: UseQueryOptions<t.TGetRandomPromptsResponse>,-): QueryObserverResult<t.TGetRandomPromptsResponse> => {- return useQuery<t.TGetRandomPromptsResponse>(- [QueryKeys.randomPrompts],- () => dataService.getRandomPrompts(filter),- {- refetchOnWindowFocus: false,- refetchOnReconnect: false,- refetchOnMount: false,- retry: false,- ...config,- enabled: config?.enabled !== undefined ? config.enabled : true,- },- );-};-export const useUserTermsQuery = (config?: UseQueryOptions<t.TUserTermsResponse>,): QueryObserverResult<t.TUserTermsResponse> => {diff --git a/client/src/hooks/Audio/useCustomAudioRef.ts b/client/src/hooks/Audio/useCustomAudioRef.tsindex e2163567e3..aa75e41bf9 100644--- a/client/src/hooks/Audio/useCustomAudioRef.ts+++ b/client/src/hooks/Audio/useCustomAudioRef.ts@@ -1,24 +1,13 @@import { useEffect, useRef } from 'react';-interface CustomAudioElement extends HTMLAudioElement {- customStarted?: boolean;- customEnded?: boolean;- customPaused?: boolean;- customProps?: {- customStarted?: boolean;- customEnded?: boolean;- customPaused?: boolean;- };-}--type TCustomAudioResult = { audioRef: React.MutableRefObject<CustomAudioElement | null> };+type TCustomAudioResult = { audioRef: React.MutableRefObject<HTMLAudioElement | null> };export default function useCustomAudioRef({setIsPlaying,}: {setIsPlaying: (isPlaying: boolean) => void;}): TCustomAudioResult {- const audioRef = useRef<CustomAudioElement | null>(null);+ const audioRef = useRef<HTMLAudioElement | null>(null);useEffect(() => {let lastTimeUpdate: number | null = null;let sameTimeUpdateCount = 0;@@ -27,7 +16,6 @@ export default function useCustomAudioRef({setIsPlaying(false);console.log('global audio ended');if (audioRef.current) {- audioRef.current.customEnded = true;URL.revokeObjectURL(audioRef.current.src);}};@@ -35,22 +23,15 @@ export default function useCustomAudioRef({const handleStart = () => {setIsPlaying(true);console.log('global audio started');- if (audioRef.current) {- audioRef.current.customStarted = true;- }};const handlePause = () => {console.log('global audio paused');- if (audioRef.current) {- audioRef.current.customPaused = true;- }};const handleTimeUpdate = () => {if (audioRef.current) {const currentTime = audioRef.current.currentTime;- // console.log('Current time: ', currentTime);if (currentTime === lastTimeUpdate) {sameTimeUpdateCount += 1;@@ -75,12 +56,6 @@ export default function useCustomAudioRef({audioRef.current.addEventListener('play', handleStart);audioRef.current.addEventListener('pause', handlePause);audioRef.current.addEventListener('timeupdate', handleTimeUpdate);-- audioRef.current.customProps = {- customStarted: false,- customEnded: false,- customPaused: false,- };}return () => {diff --git a/client/src/hooks/Chat/useChatHelpers.ts b/client/src/hooks/Chat/useChatHelpers.tsindex 02a6905e00..902b6d9d3d 100644--- a/client/src/hooks/Chat/useChatHelpers.ts+++ b/client/src/hooks/Chat/useChatHelpers.ts@@ -128,25 +128,6 @@ export default function useChatHelpers(index = 0, paramId?: string): ChatContrac[queryParam, queryClient],);- /* Conversation */- // const setActiveConvos = useSetRecoilState(store.activeConversations);-- // const setConversation = useCallback(- // (convoUpdate: TConversation) => {- // _setConversation(prev => {- // const { conversationId: convoId } = prev ?? { conversationId: null };- // const { conversationId: currentId } = convoUpdate;- // if (currentId && convoId && convoId !== 'new' && convoId !== currentId) {- // // for now, we delete the prev convoId from activeConversations- // const newActiveConvos = { [currentId]: true };- // setActiveConvos(newActiveConvos);- // }- // return convoUpdate;- // });- // },- // [_setConversation, setActiveConvos],- // );-const setSubmission = useSetRecoilState(store.submissionByIndex(index));const { ask: _ask, regenerate: _regenerate } = useChatFunctions({diff --git a/client/src/hooks/Config/useClearStates.ts b/client/src/hooks/Config/useClearStates.tsindex 8450f056a6..04e3e0fb1c 100644--- a/client/src/hooks/Config/useClearStates.ts+++ b/client/src/hooks/Config/useClearStates.ts@@ -48,7 +48,6 @@ export default function useClearStates() {reset(store.filesByIndex(key));reset(store.presetByIndex(key));- reset(store.textByIndex(key));jotaiStore.set(showStopButtonByIndex(key), false);jotaiStore.set(abortScrollFamily(key), false);jotaiStore.set(submissionStartFamily(key), null);diff --git a/client/src/hooks/Conversations/index.ts b/client/src/hooks/Conversations/index.tsindex 8b99b22fd4..ecb2922adf 100644--- a/client/src/hooks/Conversations/index.ts+++ b/client/src/hooks/Conversations/index.ts@@ -14,7 +14,6 @@ export {export { default as useReplyWatcher } from './useReplyWatcher';export { default as useDefaultConvo } from './useDefaultConvo';export { default as useSearchEnabled } from './useSearchEnabled';-export { default as useGenerateConvo } from './useGenerateConvo';export { default as useDebouncedInput } from './useDebouncedInput';export { default as useGetConversation } from './useGetConversation';export { default as useBookmarkSuccess } from './useBookmarkSuccess';diff --git a/client/src/hooks/Conversations/useGenerateConvo.ts b/client/src/hooks/Conversations/useGenerateConvo.tsdeleted file mode 100644index abe3215753..0000000000--- a/client/src/hooks/Conversations/useGenerateConvo.ts+++ /dev/null@@ -1,157 +0,0 @@-import { useRecoilValue } from 'recoil';-import { useCallback, useRef, useEffect } from 'react';-import { useGetModelsQuery } from 'librechat-data-provider/react-query';-import {- getEndpointField,- LocalStorageKeys,- isAssistantsEndpoint,- getDefaultParamsEndpoint,-} from 'librechat-data-provider';-import type {- TEndpointsConfig,- EModelEndpoint,- TModelsConfig,- TConversation,- TPreset,-} from 'librechat-data-provider';-import type { AssistantListItem } from '~/common';-import type { SetterOrUpdater } from 'recoil';-import useAssistantListMap from '~/hooks/Assistants/useAssistantListMap';-import { buildDefaultConvo, getDefaultEndpoint, logger } from '~/utils';-import { useGetEndpointsQuery } from '~/data-provider';-import { mainTextareaId } from '~/common';-import store from '~/store';--const useGenerateConvo = ({- index = 0,- rootIndex,- setConversation,-}: {- index?: number;- rootIndex: number;- setConversation?: SetterOrUpdater<TConversation | null>;-}) => {- const modelsQuery = useGetModelsQuery();- const assistantsListMap = useAssistantListMap();- const { data: endpointsConfig = {} as TEndpointsConfig } = useGetEndpointsQuery();-- const timeoutIdRef = useRef<NodeJS.Timeout>();- const rootConvo = useRecoilValue(store.conversationByKeySelector(rootIndex));-- useEffect(() => {- if (rootConvo?.conversationId != null && setConversation) {- setConversation((prevState) => {- if (!prevState) {- return prevState;- }- const update = {- ...prevState,- conversationId: rootConvo.conversationId,- } as TConversation;-- logger.log('conversation', 'Setting conversation from `useNewConvo`', update);- return update;- });- }- }, [rootConvo?.conversationId, setConversation]);-- const generateConversation = useCallback(- ({- template = {},- preset,- modelsData,- }: {- template?: Partial<TConversation>;- preset?: Partial<TPreset>;- modelsData?: TModelsConfig;- } = {}) => {- let conversation = {- conversationId: 'new',- title: 'New Chat',- endpoint: null,- ...template,- createdAt: '',- updatedAt: '',- };-- if (rootConvo?.conversationId) {- conversation.conversationId = rootConvo.conversationId;- }-- const modelsConfig = modelsData ?? modelsQuery.data;-- const defaultEndpoint = getDefaultEndpoint({- convoSetup: preset ?? conversation,- endpointsConfig,- });-- const endpointType = getEndpointField(endpointsConfig, defaultEndpoint, 'type');- if (!conversation.endpointType && endpointType) {- conversation.endpointType = endpointType;- } else if (conversation.endpointType && !endpointType) {- conversation.endpointType = undefined;- }-- const isAssistantEndpoint = isAssistantsEndpoint(defaultEndpoint);- const assistants: AssistantListItem[] = assistantsListMap[defaultEndpoint ?? ''] ?? [];-- if (- conversation.assistant_id &&- !assistantsListMap[defaultEndpoint ?? '']?.[conversation.assistant_id]- ) {- conversation.assistant_id = undefined;- }-- if (!conversation.assistant_id && isAssistantEndpoint) {- conversation.assistant_id =- localStorage.getItem(`${LocalStorageKeys.ASST_ID_PREFIX}${index}${defaultEndpoint}`) ??- assistants[0]?.id;- }-- if (- conversation.assistant_id != null &&- isAssistantEndpoint &&- conversation.conversationId === 'new'- ) {- const assistant = assistants.find((asst) => asst.id === conversation.assistant_id);- conversation.model = assistant?.model;- }-- if (conversation.assistant_id != null && !isAssistantEndpoint) {- conversation.assistant_id = undefined;- }-- const models = modelsConfig?.[defaultEndpoint ?? ''] ?? [];- const defaultParamsEndpoint = getDefaultParamsEndpoint(endpointsConfig, defaultEndpoint);- conversation = buildDefaultConvo({- conversation,- lastConversationSetup: preset as TConversation,- endpoint: defaultEndpoint ?? ('' as EModelEndpoint),- models,- defaultParamsEndpoint,- });-- if (preset?.title != null && preset.title !== '') {- conversation.title = preset.title;- }-- if (setConversation) {- setConversation(conversation);- }-- clearTimeout(timeoutIdRef.current);- timeoutIdRef.current = setTimeout(() => {- const textarea = document.getElementById(mainTextareaId);- if (textarea) {- textarea.focus();- }- }, 150);- return conversation;- },- [assistantsListMap, endpointsConfig, index, modelsQuery.data, rootConvo, setConversation],- );-- return { generateConversation };-};--export default useGenerateConvo;diff --git a/client/src/hooks/Generic/useUnsavedChangesPrompt.ts b/client/src/hooks/Generic/useUnsavedChangesPrompt.tsdeleted file mode 100644index cf285a0375..0000000000--- a/client/src/hooks/Generic/useUnsavedChangesPrompt.ts+++ /dev/null@@ -1,39 +0,0 @@-import { useCallback } from 'react';-import { unstable_usePrompt, useBeforeUnload } from 'react-router-dom';--interface UseUnsavedChangesPromptParams {- when: boolean;- message: string;-}--export default function useUnsavedChangesPrompt({ when, message }: UseUnsavedChangesPromptParams) {- useBeforeUnload(- useCallback(- (event: BeforeUnloadEvent) => {- if (!when) {- return;- }-- event.preventDefault();- event.returnValue = message;- },- [message, when],- ),- { capture: true },- );-- unstable_usePrompt({- message,- when: ({ currentLocation, nextLocation }) => {- if (!when) {- return false;- }-- return (- currentLocation.pathname !== nextLocation.pathname ||- currentLocation.search !== nextLocation.search ||- currentLocation.hash !== nextLocation.hash- );- },- });-}diff --git a/client/src/hooks/Input/index.ts b/client/src/hooks/Input/index.tsindex dc959e3577..4e6e93e6bd 100644--- a/client/src/hooks/Input/index.ts+++ b/client/src/hooks/Input/index.ts@@ -7,5 +7,4 @@ export { default as useHandleKeyUp } from './useHandleKeyUp';export { default as useRequiresKey } from './useRequiresKey';export { default as useMultipleKeys } from './useMultipleKeys';export { default as useSpeechToText } from './useSpeechToText';-export { default as useTextToSpeech } from './useTextToSpeech';export { default as useGetAudioSettings } from './useGetAudioSettings';diff --git a/client/src/hooks/Input/useTextToSpeech.ts b/client/src/hooks/Input/useTextToSpeech.tsdeleted file mode 100644index c5eff56a5b..0000000000--- a/client/src/hooks/Input/useTextToSpeech.ts+++ /dev/null@@ -1,161 +0,0 @@-import { useRef, useMemo, useEffect, useState } from 'react';-import { useRecoilState, useRecoilValue } from 'recoil';-import { parseTextParts } from 'librechat-data-provider';-import type { TMessageContentParts } from 'librechat-data-provider';-import type { Option } from '~/common';-import useTextToSpeechExternal from '~/hooks/Input/useTextToSpeechExternal';-import useTextToSpeechBrowser from '~/hooks/Input/useTextToSpeechBrowser';-import useGetAudioSettings from '~/hooks/Input/useGetAudioSettings';-import useAudioRef from '~/hooks/Audio/useAudioRef';-import { usePauseGlobalAudio } from '../Audio';-import { logger } from '~/utils';-import store from '~/store';--type TUseTextToSpeech = {- messageId?: string;- content?: TMessageContentParts[] | string;- isLast?: boolean;- index?: number;-};--const useTextToSpeech = (props?: TUseTextToSpeech) => {- const { messageId, content, isLast = false, index = 0 } = props ?? {};-- const isMouseDownRef = useRef(false);- const timerRef = useRef<number | undefined>(undefined);- const [isSpeakingState, setIsSpeaking] = useState(false);- const { audioRef } = useAudioRef({ setIsPlaying: setIsSpeaking });-- const { textToSpeechEndpoint } = useGetAudioSettings();- const { pauseGlobalAudio } = usePauseGlobalAudio(index);- const [voice, setVoice] = useRecoilState(store.voice);- const globalIsPlaying = useRecoilValue(store.globalAudioPlayingFamily(index));-- const isSpeaking = isSpeakingState || (isLast && globalIsPlaying);-- const {- generateSpeechLocal,- cancelSpeechLocal,- voices: voicesLocal,- } = useTextToSpeechBrowser({ setIsSpeaking });-- const {- generateSpeechExternal,- cancelSpeech: cancelSpeechExternal,- isLoading: isLoadingExternal,- voices: voicesExternal,- } = useTextToSpeechExternal({- setIsSpeaking,- audioRef,- messageId,- isLast,- index,- });-- const generateSpeech = useMemo(() => {- const map = {- browser: generateSpeechLocal,- external: generateSpeechExternal,- };-- return map[textToSpeechEndpoint];- }, [generateSpeechExternal, generateSpeechLocal, textToSpeechEndpoint]);-- const cancelSpeech = useMemo(() => {- const map = {- browser: cancelSpeechLocal,- external: cancelSpeechExternal,- };- return map[textToSpeechEndpoint];- }, [cancelSpeechExternal, cancelSpeechLocal, textToSpeechEndpoint]);-- const isLoading = useMemo(() => {- const map = {- browser: false,- external: isLoadingExternal,- };- return map[textToSpeechEndpoint];- }, [isLoadingExternal, textToSpeechEndpoint]);-- const voices: Option[] | string[] = useMemo(() => {- const voiceMap = {- browser: voicesLocal,- external: voicesExternal,- };-- return voiceMap[textToSpeechEndpoint];- }, [textToSpeechEndpoint, voicesExternal, voicesLocal]);-- useEffect(() => {- const firstVoice = voices[0];- if (voices.length && typeof firstVoice === 'object') {- const lastSelectedVoice = voices.find((v) =>- typeof v === 'object' ? v.value === voice : v === voice,- );- if (lastSelectedVoice != null) {- const currentVoice =- typeof lastSelectedVoice === 'object' ? lastSelectedVoice.value : lastSelectedVoice;- logger.log('useTextToSpeech.ts - Effect:', { voices, voice: currentVoice });- setVoice(currentVoice?.toString() ?? undefined);- return;- }-- logger.log('useTextToSpeech.ts - Effect:', { voices, voice: firstVoice.value });- setVoice(firstVoice.value?.toString() ?? undefined);- } else if (voices.length) {- const lastSelectedVoice = voices.find((v) => v === voice);- if (lastSelectedVoice != null) {- logger.log('useTextToSpeech.ts - Effect:', { voices, voice: lastSelectedVoice });- setVoice(lastSelectedVoice.toString());- return;- }- logger.log('useTextToSpeech.ts - Effect:', { voices, voice: firstVoice });- setVoice(firstVoice.toString());- }- }, [setVoice, textToSpeechEndpoint, voice, voices]);-- const handleMouseDown = () => {- isMouseDownRef.current = true;- timerRef.current = window.setTimeout(() => {- if (isMouseDownRef.current) {- const messageContent = content ?? '';- const parsedMessage =- typeof messageContent === 'string'- ? messageContent- : parseTextParts(messageContent, true);- generateSpeech(parsedMessage, false);- }- }, 1000);- };-- const handleMouseUp = () => {- isMouseDownRef.current = false;- if (timerRef.current != null) {- window.clearTimeout(timerRef.current);- }- };-- const toggleSpeech = () => {- if (isSpeaking === true) {- cancelSpeech();- pauseGlobalAudio();- } else {- const messageContent = content ?? '';- const parsedMessage =- typeof messageContent === 'string' ? messageContent : parseTextParts(messageContent, true);- generateSpeech(parsedMessage, false);- }- };-- return {- handleMouseDown,- handleMouseUp,- toggleSpeech,- isSpeaking,- isLoading,- audioRef,- voices,- };-};--export default useTextToSpeech;diff --git a/client/src/hooks/Messages/index.ts b/client/src/hooks/Messages/index.tsindex d5348991a3..1856f9704c 100644--- a/client/src/hooks/Messages/index.ts+++ b/client/src/hooks/Messages/index.ts@@ -1,7 +1,5 @@export { default as useProgress } from './useProgress';export {- MESSAGE_CONTENT_LAYOUT_CHANGE_EVENT,- dispatchMessageContentLayoutChange,getRenderedContentMaxScrollTop,reconcileMessageContentLayout,scheduleMessageContentLayoutReconcile,diff --git a/client/src/hooks/Messages/messageLayout.ts b/client/src/hooks/Messages/messageLayout.tsindex 203e0c9e3f..a5225059df 100644--- a/client/src/hooks/Messages/messageLayout.ts+++ b/client/src/hooks/Messages/messageLayout.ts@@ -1,4 +1,3 @@-export const MESSAGE_CONTENT_LAYOUT_CHANGE_EVENT = 'librechat:message-content-layout-change';const MESSAGE_SCROLL_CONTAINER_SELECTOR = '.scrollbar-gutter-stable';const MESSAGE_LAYOUT_RECONCILE_DURATION_MS = 350;@@ -72,16 +71,3 @@ export function scheduleMessageContentLayoutReconcile(target: HTMLElement | null}};}--export function dispatchMessageContentLayoutChange(target: HTMLElement | null): void {- reconcileMessageContentLayout(target);- if (!target || typeof CustomEvent === 'undefined') {- return;- }-- target.dispatchEvent(- new CustomEvent(MESSAGE_CONTENT_LAYOUT_CHANGE_EVENT, {- bubbles: true,- }),- );-}diff --git a/client/src/hooks/Messages/useCopyToClipboard.ts b/client/src/hooks/Messages/useCopyToClipboard.tsindex 884125d342..9270cf7aae 100644--- a/client/src/hooks/Messages/useCopyToClipboard.ts+++ b/client/src/hooks/Messages/useCopyToClipboard.ts@@ -69,12 +69,6 @@ function getMessageParts({ text, content }: Partial<Pick<TMessage, 'text' | 'conreturn parts;}-export function serializeMessageForClipboard(- source: Partial<Pick<TMessage, 'text' | 'content'>>,-): string {- return getMessageParts(source).join('\n');-}-type CitationSegment = {text: string;/**diff --git a/client/src/hooks/Nav/index.ts b/client/src/hooks/Nav/index.tsindex c7b0ae7b7b..85ef7c2620 100644--- a/client/src/hooks/Nav/index.ts+++ b/client/src/hooks/Nav/index.ts@@ -1,3 +1,2 @@export { default as useNavScrolling } from './useNavScrolling';export { default as useShowMarketplace } from './useShowMarketplace';-export * from './useNavHelpers';diff --git a/client/src/hooks/Nav/useNavHelpers.ts b/client/src/hooks/Nav/useNavHelpers.tsdeleted file mode 100644index 7f26cebf06..0000000000--- a/client/src/hooks/Nav/useNavHelpers.ts+++ /dev/null@@ -1,35 +0,0 @@-import { useCallback, useEffect, useRef } from 'react';-import { useNavigate, useLocation } from 'react-router-dom';-import type { Location } from 'react-router-dom';--export function useCustomLink<T = HTMLAnchorElement>(- route: string,- callback?: (event: React.MouseEvent<T>) => void,-) {- const navigate = useNavigate();- const location = useLocation();- const clickHandler = useCallback(- (event: React.MouseEvent<T>) => {- if (callback) {- callback(event);- }- if (event.button === 0 && !(event.ctrlKey || event.metaKey)) {- event.preventDefault();- navigate(route, { state: { prevLocation: location } });- }- },- [navigate, route, callback, location],- );- return clickHandler;-}--export const usePreviousLocation = () => {- const location = useLocation();- const previousLocationRef: React.MutableRefObject<Location<unknown> | undefined> = useRef();-- useEffect(() => {- previousLocationRef.current = location.state?.prevLocation;- }, [location]);-- return previousLocationRef;-};diff --git a/client/src/hooks/SSE/useEventHandlers.ts b/client/src/hooks/SSE/useEventHandlers.tsindex 086507e22b..17f3d5c48b 100644--- a/client/src/hooks/SSE/useEventHandlers.ts+++ b/client/src/hooks/SSE/useEventHandlers.ts@@ -689,7 +689,6 @@ export default function useEventHandlers({setMessages,getMessages,announcePolite,- setIsSubmitting,lastAnnouncementTimeRef,onSkillAuthoringComplete,onSubagentIndexChange,diff --git a/client/src/hooks/SSE/useStepHandler.ts b/client/src/hooks/SSE/useStepHandler.tsindex 300e5b81be..ba0c5fe583 100644--- a/client/src/hooks/SSE/useStepHandler.ts+++ b/client/src/hooks/SSE/useStepHandler.ts@@ -16,7 +16,6 @@ import type {PtcToolCallEvent,} from 'librechat-data-provider';import type { StepEvent, StepEffect, StepContext, StreamState } from '@librechat/chat';-import type { SetterOrUpdater } from 'recoil';import type { AnnounceOptions } from '~/common';import {closeParentSubagentProgress,@@ -40,8 +39,6 @@ type TUseStepHandler = {announcePolite: (options: AnnounceOptions) => void;setMessages: (messages: TMessage[]) => void;getMessages: () => TMessage[] | undefined;- /** @deprecated - isSubmitting should be derived from submission state */- setIsSubmitting?: SetterOrUpdater<boolean>;lastAnnouncementTimeRef: React.MutableRefObject<number>;/*** Fired when a completed `create_file`/`edit_file` call targeted adiff --git a/client/src/hooks/__tests__/useNewConvo.spec.ts b/client/src/hooks/__tests__/useNewConvo.spec.tsindex 0baab45ccd..23b9daf543 100644--- a/client/src/hooks/__tests__/useNewConvo.spec.ts+++ b/client/src/hooks/__tests__/useNewConvo.spec.ts@@ -98,7 +98,6 @@ jest.mock('../Assistants/useAssistantListMap', () => ({default: () => ({}),}));jest.mock('../Files/useFileHandling', () => ({ clearUploadRecovery: jest.fn() }));-jest.mock('../useChatBadges', () => ({ useResetChatBadges: () => jest.fn() }));jest.mock('../Agents', () => ({ useApplyModelSpecEffects: () => jest.fn() }));jest.mock('../Audio', () => ({ usePauseGlobalAudio: () => ({ pauseGlobalAudio: jest.fn() }) }));jest.mock('~/Providers', () => ({ useAgentsMapContext: () => ({}) }));diff --git a/client/src/hooks/index.ts b/client/src/hooks/index.tsindex f5dd9e1829..e3ea3e3b0e 100644--- a/client/src/hooks/index.ts+++ b/client/src/hooks/index.ts@@ -32,14 +32,12 @@ export { default as useGreeting } from './useGreeting';export { default as useFocusTrap } from './useFocusTrap';export { default as useFavorites } from './useFavorites';export { default as useToolFavorites } from './useToolFavorites';-export { default as useChatBadges } from './useChatBadges';export { default as useAdaptiveIcon } from './useAdaptiveIcon';export { default as useScrollToRef } from './useScrollToRef';export { default as useIsActiveItem } from './useIsActiveItem';export { default as useLocalStorage } from './useLocalStorage';export { default as useDocumentTitle } from './useDocumentTitle';export { default as useSpeechToText } from './Input/useSpeechToText';-export { default as useTextToSpeech } from './Input/useTextToSpeech';export { default as useGenerationsByLatest } from './useGenerationsByLatest';export { default as useLocalizedConfig } from './useLocalizedConfig';export { default as useResourcePermissions } from './useResourcePermissions';diff --git a/client/src/hooks/useChatBadges.ts b/client/src/hooks/useChatBadges.tsdeleted file mode 100644index 3b8d4721d9..0000000000--- a/client/src/hooks/useChatBadges.ts+++ /dev/null@@ -1,56 +0,0 @@-import { useMemo } from 'react';-import { Box } from 'lucide-react';-import { useRecoilValue } from 'recoil';-import { useRecoilCallback } from 'recoil';-import type { BadgeItem } from '~/common';-import { useLocalize, TranslationKeys } from '~/hooks';-import store from '~/store';--interface ChatBadgeConfig {- id: string;- icon: typeof Box;- label: string;- atom?: any;-}--const badgeConfig: ReadonlyArray<ChatBadgeConfig> = [- // {- // id: '1',- // icon: Box,- // label: 'com_ui_artifacts',- // atom: store.codeArtifacts,- // },- // TODO: add more badges here (missing store atoms)-];--export default function useChatBadges(): BadgeItem[] {- const localize = useLocalize();- const activeBadges = useRecoilValue(store.chatBadges) as Array<{ id: string }>;- const activeBadgeIds = useMemo(- () => new Set(activeBadges.map((badge) => badge.id)),- [activeBadges],- );- const allBadges = useMemo(() => {- return (- badgeConfig.map((cfg) => ({- id: cfg.id,- label: localize(cfg.label as TranslationKeys),- icon: cfg.icon,- atom: cfg.atom,- isAvailable: activeBadgeIds.has(cfg.id),- })) || []- );- }, [activeBadgeIds, localize]);- return allBadges;-}--export function useResetChatBadges() {- return useRecoilCallback(- ({ reset }) =>- () => {- badgeConfig.forEach(({ atom }) => reset(atom));- reset(store.chatBadges);- },- [],- );-}diff --git a/client/src/hooks/useNewConvo.ts b/client/src/hooks/useNewConvo.tsindex 8f8d70de6b..6915536d97 100644--- a/client/src/hooks/useNewConvo.ts+++ b/client/src/hooks/useNewConvo.ts@@ -54,7 +54,6 @@ import useGetConversation from './Conversations/useGetConversation';import useAssistantListMap from './Assistants/useAssistantListMap';import { useChatSettings } from '~/Providers/ChatSettingsContext';import { clearUploadRecovery } from './Files/useFileHandling';-import { useResetChatBadges } from './useChatBadges';import { useApplyModelSpecEffects } from './Agents';import { useAgentsMapContext } from '~/Providers';import { usePauseGlobalAudio } from './Audio';@@ -85,7 +84,6 @@ const useNewConvo = (index = 0) => {const defaultPreset = useRecoilValue(store.defaultPreset);const { setConversation } = store.useSetConversationAtom(index);const [files, setFiles] = useRecoilState(store.filesByIndex(index));- const saveBadgesState = useRecoilValue<boolean>(store.saveBadgesState);const setSubmission = useSetRecoilState<TSubmission | null>(store.submissionByIndex(index));const { data: endpointsConfig = {} as TEndpointsConfig } = useGetEndpointsQuery();const agentsMap = useAgentsMapContext();@@ -99,7 +97,6 @@ const useNewConvo = (index = 0) => {const assistantsListMap = useAssistantListMap();const { pauseGlobalAudio } = usePauseGlobalAudio(index);const { saveDrafts } = useChatSettings();- const resetBadges = useResetChatBadges();const { mutateAsync } = useDeleteFilesMutation({onSuccess: () => {@@ -341,9 +338,6 @@ const useNewConvo = (index = 0) => {renewNewConversationDraftToken(index);}pauseGlobalAudio();- if (!saveBadgesState) {- resetBadges();- }const templateConvoId = _template.conversationId ?? '';const paramEndpoint =@@ -522,9 +516,7 @@ const useNewConvo = (index = 0) => {agentsMap,saveDrafts,mutateAsync,- resetBadges,startupConfig,- saveBadgesState,endpointsConfig,getConversation,pauseGlobalAudio,diff --git a/client/src/hooks/useRenderChangeLog.ts b/client/src/hooks/useRenderChangeLog.tsdeleted file mode 100644index e20f04be05..0000000000--- a/client/src/hooks/useRenderChangeLog.ts+++ /dev/null@@ -1,67 +0,0 @@-import { useEffect, useRef } from 'react';--type DebugWindow = Window & {- __LC_RENDER_DEBUG__?: boolean;-};--/**- * Development-only hook that logs which tracked values changed between renders.- *- * Enable by setting `window.__LC_RENDER_DEBUG__ = true` in the browser console.- * Automatically no-ops in production builds.- *- * @example- * ```ts- * useRenderChangeLog('MessageRender', { messageId, isLast, depth });- * ```- */-export default function useRenderChangeLog(- name: string,- values: Record<string, string | number | boolean | null | undefined>,-) {- const previousValuesRef = useRef<Record<- string,- string | number | boolean | null | undefined- > | null>(null);-- useEffect(() => {- if (process.env.NODE_ENV === 'production') {- return;- }-- if (typeof window === 'undefined' || !(window as DebugWindow).__LC_RENDER_DEBUG__) {- previousValuesRef.current = values;- return;- }-- if (previousValuesRef.current == null) {- console.log(`[render-debug] ${name}: initial render`, values);- previousValuesRef.current = values;- return;- }-- const previousValues = previousValuesRef.current;- const changedEntries = Object.entries(values).filter(- ([key, value]) => !Object.is(previousValues[key], value),- );-- if (changedEntries.length > 0) {- console.log(- `[render-debug] ${name}`,- Object.fromEntries(- changedEntries.map(([key, value]) => [- key,- {- previous: previousValues[key],- next: value,- },- ]),- ),- );- } else {- console.log(`[render-debug] ${name}: parent-driven render`);- }-- previousValuesRef.current = values;- });-}diff --git a/client/src/hooks/useVirtualGrid.ts b/client/src/hooks/useVirtualGrid.tsdeleted file mode 100644index edff196f64..0000000000--- a/client/src/hooks/useVirtualGrid.ts+++ /dev/null@@ -1,66 +0,0 @@-import { useCallback, useMemo } from 'react';--interface UseVirtualGridProps {- itemCount: number;- containerWidth: number;- itemHeight: number;- gapSize: number;- mobileColumnsCount: number;- desktopColumnsCount: number;- mobileBreakpoint: number;-}--interface UseVirtualGridReturn {- cardsPerRow: number;- rowCount: number;- rowHeight: number;- getRowItems: (rowIndex: number, items: any[]) => any[];-}--/**- * Custom hook for virtual grid calculations- * Handles responsive grid layout and item positioning for virtualized lists- */-export const useVirtualGrid = ({- itemCount,- containerWidth,- itemHeight,- gapSize,- mobileColumnsCount,- desktopColumnsCount,- mobileBreakpoint = 768,-}: UseVirtualGridProps): UseVirtualGridReturn => {- // Calculate cards per row based on container width- const cardsPerRow = useMemo(() => {- return containerWidth >= mobileBreakpoint ? desktopColumnsCount : mobileColumnsCount;- }, [containerWidth, mobileBreakpoint, desktopColumnsCount, mobileColumnsCount]);-- // Calculate total number of rows needed- const rowCount = useMemo(() => {- return Math.ceil(itemCount / cardsPerRow);- }, [itemCount, cardsPerRow]);-- // Calculate row height including gap- const rowHeight = useMemo(() => {- return itemHeight + gapSize;- }, [itemHeight, gapSize]);-- // Get items for a specific row- const getRowItems = useCallback(- (rowIndex: number, items: any[]) => {- const startIndex = rowIndex * cardsPerRow;- const endIndex = Math.min(startIndex + cardsPerRow, items.length);- return items.slice(startIndex, endIndex);- },- [cardsPerRow],- );-- return {- cardsPerRow,- rowCount,- rowHeight,- getRowItems,- };-};--export default useVirtualGrid;diff --git a/client/src/store/endpoints.ts b/client/src/store/endpoints.tsdeleted file mode 100644index 9815b7dde1..0000000000--- a/client/src/store/endpoints.ts+++ /dev/null@@ -1,44 +0,0 @@-import { atom, selector } from 'recoil';-import { EModelEndpoint } from 'librechat-data-provider';-import type { TEndpointsConfig } from 'librechat-data-provider';--const defaultConfig: TEndpointsConfig = {- [EModelEndpoint.azureOpenAI]: null,- [EModelEndpoint.azureAssistants]: null,- [EModelEndpoint.assistants]: null,- [EModelEndpoint.agents]: null,- [EModelEndpoint.openAI]: null,- [EModelEndpoint.google]: null,- [EModelEndpoint.anthropic]: null,- [EModelEndpoint.custom]: null,-};--const endpointsConfig = atom<TEndpointsConfig>({- key: 'endpointsConfig',- default: defaultConfig,-});--const endpointsQueryEnabled = atom<boolean>({- key: 'endpointsQueryEnabled',- default: true,-});--const endpointsFilter = selector({- key: 'endpointsFilter',- get: ({ get }) => {- const config = get(endpointsConfig) || {};-- const filter = {};- for (const key of Object.keys(config)) {- filter[key] = !!config[key];- }- return filter;- },-});--export default {- endpointsConfig,- endpointsFilter,- defaultConfig,- endpointsQueryEnabled,-};diff --git a/client/src/store/families.ts b/client/src/store/families.tsindex ba5a86abb0..8be5065592 100644--- a/client/src/store/families.ts+++ b/client/src/store/families.ts@@ -23,11 +23,6 @@ import {} from '~/utils';import { useSetConvoContext } from '~/Providers/SetConvoContext';-const submissionKeysAtom = atom<(string | number)[]>({- key: 'submissionKeys',- default: [],-});-const submissionByIndex = atomFamily<TSubmission | null, string | number>({key: 'submissionByIndex',default: null,@@ -39,10 +34,6 @@ const submissionKeysSelector = selector<(string | number)[]>({const keys = get(conversationKeysAtom);return keys.filter((key) => get(submissionByIndex(key)) !== null);},- set: ({ set }, newKeys) => {- logger.log('setting submissionKeysAtom', newKeys);- set(submissionKeysAtom, newKeys);- },});const conversationByIndex = atomFamily<TConversation | null, string | number>({@@ -125,14 +116,6 @@ const conversationKeysAtom = atom<(string | number)[]>({default: [],});-const allConversationsSelector = selector({- key: 'allConversationsSelector',- get: ({ get }) => {- const keys = get(conversationKeysAtom);- return keys.map((key) => get(conversationByIndex(key))).map((convo) => convo?.conversationId);- },-});-const conversationIdByIndex = selectorFamily<string | null, string | number>({key: 'conversationIdByIndex',get:@@ -197,11 +180,6 @@ const presetByIndex = atomFamily<TPreset | null, string | number>({default: null,});-const textByIndex = atomFamily<string, string | number>({- key: 'textByIndex',- default: '',-});-const isSubmittingFamily = atomFamily({key: 'isSubmittingByIndex',default: false,@@ -431,7 +409,7 @@ const conversationByKeySelector = conversationByIndex;function useClearSubmissionState() {const clearAllSubmissions = useRecoilCallback(- ({ reset, set, snapshot }) =>+ ({ reset, snapshot }) =>async (skipFirst?: boolean) => {const submissionKeys = await snapshot.getPromise(submissionKeysSelector);logger.log('submissionKeys', submissionKeys);@@ -444,8 +422,6 @@ function useClearSubmissionState() {logger.log('resetting submission', key);reset(submissionByIndex(key));}-- set(submissionKeysSelector, []);},[],);@@ -484,12 +460,10 @@ export default {filesByIndex,presetByIndex,submissionByIndex,- textByIndex,isSubmittingFamily,optionSettingsFamily,showPopoverFamily,anySubmittingSelector,- allConversationsSelector,conversationIdByIndex,conversationEndpointByIndex,effectiveEndpointByIndex,diff --git a/client/src/store/index.ts b/client/src/store/index.tsindex 5ad0853243..2cf84ec024 100644--- a/client/src/store/index.ts+++ b/client/src/store/index.ts@@ -1,16 +1,12 @@import * as artifacts from './artifacts';-import submission from './submission';import isTemporary from './temporary';-import endpoints from './endpoints';import families from './families';import settings from './settings';import prompts from './prompts';import search from './search';import preset from './preset';import lang from './language';-import toast from './toast';import user from './user';-import text from './text';import misc from './misc';export * from './agents';export * from './mcp';@@ -21,11 +17,7 @@ export * from './ptc';export default {...artifacts,...families,- ...endpoints,...user,- ...text,- ...toast,- ...submission,...search,...prompts,...preset,diff --git a/client/src/store/misc.ts b/client/src/store/misc.tsindex 2000b6bb28..0f347c5586 100644--- a/client/src/store/misc.ts+++ b/client/src/store/misc.ts@@ -1,7 +1,6 @@import { atom, selectorFamily } from 'recoil';import { TAttachment } from 'librechat-data-provider';import { atomWithLocalStorage } from './utils';-import { BadgeItem } from '~/common';const hideBannerHint = atomWithLocalStorage('hideBannerHint', [] as string[]);@@ -52,11 +51,6 @@ const queriesEnabled = atom<boolean>({default: true,});-const isEditingBadges = atom<boolean>({- key: 'isEditingBadges',- default: false,-});-const showShortcutsDialog = atom<boolean>({key: 'showShortcutsDialog',default: false,@@ -85,22 +79,13 @@ const customShortcuts = atomWithLocalStorage<Record<string, ShortcutOverride>>(/** When false, no keyboard shortcut fires and the UI stops advertising them. */const shortcutsEnabled = atomWithLocalStorage<boolean>('keyboardShortcutsEnabled', true);-const chatBadges = atomWithLocalStorage<Pick<BadgeItem, 'id'>[]>('chatBadges', [- // When adding new badges, make sure to add them to useChatBadges.ts as well and add them as last item- // DO NOT CHANGE THE ORDER OF THE BADGES ALREADY IN THE ARRAY- { id: '1' },- // { id: '2' },-]);-export default {hideBannerHint,messageAttachmentsMap,conversationAttachmentsSelector,queriesEnabled,- isEditingBadges,showShortcutsDialog,keyboardDeleteTarget,customShortcuts,shortcutsEnabled,- chatBadges,};diff --git a/client/src/store/submission.ts b/client/src/store/submission.tsdeleted file mode 100644index 0cd0b3e97f..0000000000--- a/client/src/store/submission.ts+++ /dev/null@@ -1,28 +0,0 @@-import { atom } from 'recoil';-import { TSubmission } from 'librechat-data-provider';--// current submission-// submit any new value to this state will cause new message to be send.-// set to null to give up any submission-// {-// conversation, // target submission, must have: model, chatGptLabel, promptPrefix-// messages, // old messages-// message, // request message-// initialResponse, // response message-// isRegenerate=false, // isRegenerate?-// }--const submission = atom<TSubmission | null>({- key: 'submission',- default: null,-});--const isSubmitting = atom({- key: 'isSubmitting',- default: false,-});--export default {- submission,- isSubmitting,-};diff --git a/client/src/store/text.ts b/client/src/store/text.tsdeleted file mode 100644index 5068711929..0000000000--- a/client/src/store/text.ts+++ /dev/null@@ -1,8 +0,0 @@-import { atom } from 'recoil';--const text = atom<string>({- key: 'text',- default: '',-});--export default { text };diff --git a/client/src/store/toast.ts b/client/src/store/toast.tsdeleted file mode 100644index 59b5f5ec5d..0000000000--- a/client/src/store/toast.ts+++ /dev/null@@ -1,14 +0,0 @@-import { atom } from 'recoil';-import { NotificationSeverity } from '~/common';--const toastState = atom({- key: 'toastState',- default: {- open: false,- message: '',- severity: NotificationSeverity.SUCCESS,- showIcon: true,- },-});--export default { toastState };diff --git a/client/src/utils/__tests__/agents.spec.tsx b/client/src/utils/__tests__/agents.spec.tsxindex 173af83b00..4b81fe3ccb 100644--- a/client/src/utils/__tests__/agents.spec.tsx+++ b/client/src/utils/__tests__/agents.spec.tsx@@ -2,7 +2,7 @@ import React from 'react';import { render, screen } from '@testing-library/react';import '@testing-library/jest-dom';import type t from 'librechat-data-provider';-import { getAgentAvatarUrl, renderAgentAvatar, getContactDisplayName } from '../agents';+import { getAgentAvatarUrl, renderAgentAvatar } from '../agents';// Mock the Feather icon from lucide-reactjest.mock('lucide-react', () => ({@@ -121,49 +121,5 @@ describe('Agent Utilities', () => {});});- describe('getContactDisplayName', () => {- it('should return null for null agent', () => {- expect(getContactDisplayName(null)).toBeNull();- });-- it('should return null for undefined agent', () => {- expect(getContactDisplayName(undefined)).toBeNull();- });-- it('should prioritize support_contact name', () => {- const agent = {- id: '1',- support_contact: { name: 'Support Team', email: '[email protected]' },- authorName: 'John Doe',- } as any;- expect(getContactDisplayName(agent)).toBe('Support Team');- });-- it('should use authorName when support_contact name is missing', () => {- const agent = {- id: '1',- support_contact: { email: '[email protected]' },- authorName: 'John Doe',- } as any;- expect(getContactDisplayName(agent)).toBe('John Doe');- });-- it('should use support_contact email when both name and authorName are missing', () => {- const agent = {- id: '1',- support_contact: { email: '[email protected]' },- } as any;- expect(getContactDisplayName(agent)).toBe('[email protected]');- });-- it('should return null when no contact info is available', () => {- const agent = {- id: '1',- name: 'Test Agent',- } as any;- expect(getContactDisplayName(agent)).toBeNull();- });- });-// Tests for hardcoded category functions removed - now using database-driven categories});diff --git a/client/src/utils/__tests__/collection.test.ts b/client/src/utils/__tests__/collection.test.tsindex 53bace714b..5caad2b361 100644--- a/client/src/utils/__tests__/collection.test.ts+++ b/client/src/utils/__tests__/collection.test.ts@@ -5,7 +5,6 @@ import {deleteData,updateFields,updateFieldsInPlace,- normalizeData,getRecordByProperty,} from '../collection';@@ -341,46 +340,3 @@ describe('deleteData', () => {expect(result.pages[0].items).toHaveLength(1);});});--// ----------------------------------------------------------------------------// normalizeData-// -----------------------------------------------------------------------------describe('normalizeData', () => {- it('redistributes items evenly according to pageSize', () => {- const data = makeInfiniteData([- { items: [makeItem('a', 'A'), makeItem('b', 'B'), makeItem('c', 'C')] },- { items: [makeItem('d', 'D')] },- ]);-- const result = normalizeData<Page, Item>(data, 'items', 2);-- expect(result.pages[0].items).toHaveLength(2);- expect(result.pages[1].items).toHaveLength(2);- });-- it('removes empty pages after redistribution', () => {- const data = makeInfiniteData([{ items: [makeItem('a', 'A')] }, { items: [] }]);-- const result = normalizeData<Page, Item>(data, 'items', 10);-- expect(result.pages).toHaveLength(1);- });-- it('deduplicates items when uniqueProperty is provided', () => {- const data = makeInfiniteData([- { items: [makeItem('a', 'Alpha'), makeItem('a', 'AlphaDuplicate')] },- ]);-- const result = normalizeData<Page, Item>(data, 'items', 10, 'id');-- const ids = result.pages.flatMap((p) => p.items.map((i) => i.id));- expect(ids.filter((id) => id === 'a')).toHaveLength(1);- });-- it('returns the data unchanged when pages array is empty', () => {- const data = makeInfiniteData([]);- const result = normalizeData<Page, Item>(data, 'items', 10);- expect(result.pages).toHaveLength(0);- });-});diff --git a/client/src/utils/__tests__/configHtml.test.ts b/client/src/utils/__tests__/configHtml.test.tsindex 4599068b5b..6a3cfbfcd8 100644--- a/client/src/utils/__tests__/configHtml.test.ts+++ b/client/src/utils/__tests__/configHtml.test.ts@@ -6,12 +6,11 @@ import {CONFIG_HTML_MEDIA_TAGS,createConfigHtmlSanitizer,createConfigHtmlTextSanitizer,- sanitizeConfigHtml,} from '../configHtml';describe('configHtml', () => {it('removes active attributes and unsupported elements', () => {- const sanitized = sanitizeConfigHtml(+ const sanitized = createConfigHtmlSanitizer()('<img src=x onerror="alert(1)"><a href="javascript:alert(1)" onclick="alert(1)"><strong>Learn</strong></a><script>alert(1)</script><svg onload="alert(1)"></svg>',);diff --git a/client/src/utils/__tests__/promptGroups.test.ts b/client/src/utils/__tests__/promptGroups.test.tsindex 9346888aa4..b792fdd05b 100644--- a/client/src/utils/__tests__/promptGroups.test.ts+++ b/client/src/utils/__tests__/promptGroups.test.ts@@ -11,7 +11,6 @@ import {updateGroupFieldsInPlace,updateGroupInAll,updatePromptGroup,- getSnippet,findPromptGroup,} from '../promptGroups';@@ -325,40 +324,6 @@ describe('findPromptGroup', () => {});});-// ----------------------------------------------------------------------------// getSnippet-// -----------------------------------------------------------------------------describe('getSnippet', () => {- it('returns the full string when it is within the default length', () => {- const short = 'Hello';- expect(getSnippet(short)).toBe('Hello');- });-- it('truncates and appends ellipsis when string exceeds default length', () => {- const long = 'a'.repeat(60);- const result = getSnippet(long);- expect(result.endsWith('...')).toBe(true);- expect(result.length).toBe(56);- });-- it('respects a custom length parameter', () => {- const text = 'abcdefghij';- const result = getSnippet(text, 7);- expect(result).toBe('abcd...');- expect(result.length).toBe(7);- });-- it('returns the original string when it equals the length exactly', () => {- const text = 'a'.repeat(56);- expect(getSnippet(text)).toBe(text);- });-- it('handles an empty string without throwing', () => {- expect(getSnippet('')).toBe('');- });-});-// ---------------------------------------------------------------------------// addGroupToAll// ---------------------------------------------------------------------------diff --git a/client/src/utils/__tests__/resolvePastedTextFile.spec.ts b/client/src/utils/__tests__/resolvePastedTextFile.spec.tsindex 77921eed8e..71971c7353 100644--- a/client/src/utils/__tests__/resolvePastedTextFile.spec.ts+++ b/client/src/utils/__tests__/resolvePastedTextFile.spec.ts@@ -3,7 +3,6 @@ import type { FileConfig } from 'librechat-data-provider';import {getViableUploadOptions,resolvePastedTextFile,- isPastedTextFilename,nextPastedTextFilename,PASTE_AS_FILE_MIN_LENGTH,PASTED_TEXT_FILENAME,@@ -203,8 +202,8 @@ describe('resolvePastedTextFile', () => {});});-describe('isPastedTextFilename', () => {- it('accepts every name the paste flow generates', () => {+describe('nextPastedTextFilename', () => {+ it('starts at the bare name and counts from 2', () => {const attachedFilenames = new Set<string>();const generated = Array.from({ length: 4 }, () => {const name = nextPastedTextFilename(attachedFilenames);@@ -218,26 +217,5 @@ describe('isPastedTextFilename', () => {'pasted-text-3.txt','pasted-text-4.txt',]);- expect(generated.every(isPastedTextFilename)).toBe(true);- /** The counter has no ceiling: a busy composer reaches double digits. */- expect(isPastedTextFilename('pasted-text-10.txt')).toBe(true);- });-- it.each([- ['a deliberate upload that merely mentions pasting', 'my-pasted-text.txt'],- ['a different extension', 'pasted-text.md'],- ['a suffix that is not a paste number', 'pasted-text-final.txt'],- ['a name with the marker in the middle', 'notes-pasted-text.txt'],- ['a counter the generator never produces', 'pasted-text-1.txt'],- ['a zero counter the generator never produces', 'pasted-text-0.txt'],- ['a zero-padded counter the generator never produces', 'pasted-text-02.txt'],- ['an empty name', ''],- ])('rejects %s', (_label, filename) => {- expect(isPastedTextFilename(filename)).toBe(false);- });-- it('rejects a missing name rather than throwing', () => {- expect(isPastedTextFilename(undefined)).toBe(false);- expect(isPastedTextFilename(null)).toBe(false);});});diff --git a/client/src/utils/__tests__/timestamps.test.ts b/client/src/utils/__tests__/timestamps.test.tsindex 4572fb74c7..f1714b9ae1 100644--- a/client/src/utils/__tests__/timestamps.test.ts+++ b/client/src/utils/__tests__/timestamps.test.ts@@ -1,12 +1,5 @@import { LocalStorageKeys } from 'librechat-data-provider';-import {- setTimestamp,- setTimestampedValue,- getTimestampedValue,- removeTimestampedValue,- cleanupTimestampedStorage,- migrateExistingEntries,-} from '../timestamps';+import { setTimestamp, getTimestampedValue, cleanupTimestampedStorage } from '../timestamps';describe('timestamps', () => {beforeEach(() => {@@ -25,18 +18,6 @@ describe('timestamps', () => {});});- describe('setTimestampedValue', () => {- it('should set value and timestamp in localStorage', () => {- const key = 'test-key';- const value = { data: 'test' };-- setTimestampedValue(key, value);-- expect(localStorage.getItem(key)).toBe(JSON.stringify(value));- expect(localStorage.getItem(`${key}_TIMESTAMP`)).toBeTruthy();- });- });-describe('getTimestampedValue', () => {it('should return value if timestamp is valid', () => {const key = 'test-key';@@ -74,20 +55,6 @@ describe('timestamps', () => {});});- describe('removeTimestampedValue', () => {- it('should remove both value and timestamp', () => {- const key = 'test-key';-- localStorage.setItem(key, 'value');- localStorage.setItem(`${key}_TIMESTAMP`, Date.now().toString());-- removeTimestampedValue(key);-- expect(localStorage.getItem(key)).toBeNull();- expect(localStorage.getItem(`${key}_TIMESTAMP`)).toBeNull();- });- });-describe('cleanupTimestampedStorage', () => {it('should remove entries without timestamps', () => {const key = `${LocalStorageKeys.LAST_MCP_}convo-123`;@@ -146,31 +113,4 @@ describe('timestamps', () => {expect(localStorage.getItem(`${key}_TIMESTAMP`)).toBeNull();});});-- describe('migrateExistingEntries', () => {- it('should add timestamps to existing timestamped keys', () => {- const key1 = `${LocalStorageKeys.LAST_MCP_}convo-111`;- const key2 = `${LocalStorageKeys.PIN_MCP_}convo-222`;-- localStorage.setItem(key1, '["mcp1", "mcp2"]');- localStorage.setItem(key2, 'true');-- migrateExistingEntries();-- expect(localStorage.getItem(`${key1}_TIMESTAMP`)).toBeTruthy();- expect(localStorage.getItem(`${key2}_TIMESTAMP`)).toBeTruthy();- });-- it('should not overwrite existing timestamps', () => {- const key = `${LocalStorageKeys.LAST_FILE_SEARCH_TOGGLE_}convo-333`;- const existingTimestamp = '1234567890';-- localStorage.setItem(key, 'true');- localStorage.setItem(`${key}_TIMESTAMP`, existingTimestamp);-- migrateExistingEntries();-- expect(localStorage.getItem(`${key}_TIMESTAMP`)).toBe(existingTimestamp);- });- });});diff --git a/client/src/utils/agents.tsx b/client/src/utils/agents.tsxindex aff9d73bbf..521340250e 100644--- a/client/src/utils/agents.tsx+++ b/client/src/utils/agents.tsx@@ -120,19 +120,6 @@ export const renderAgentAvatar = ();};-/**- * Gets the display name for a contact (prioritizes name over email)- */-export const getContactDisplayName = (agent: t.Agent | null | undefined): string | null => {- if (!agent) return null;-- const supportName = (agent as any).support_contact?.name;- const supportEmail = (agent as any).support_contact?.email;- const authorName = (agent as any).authorName;-- return supportName || authorName || supportEmail || null;-};-// All hardcoded category constants removed - now using database-driven categories/**diff --git a/client/src/utils/collection.ts b/client/src/utils/collection.tsindex 81228801e2..36840e105d 100644--- a/client/src/utils/collection.ts+++ b/client/src/utils/collection.ts@@ -87,54 +87,6 @@ export const deleteData = <TCollection, TData>(return newData;};-/**- * Normalize the data so that the number of data on each page is within pageSize- */-export const normalizeData = <TCollection, TData>(- data: InfiniteData<TCollection>,- collectionName: string,- pageSize: number,- uniqueProperty?: keyof TData,-): InfiniteData<TCollection> => {- const infiniteData = JSON.parse(JSON.stringify(data)) as InfiniteData<TCollection>;- const pageCount = infiniteData.pages.length;- if (pageCount === 0) {- return infiniteData;- }-- const pageParams = infiniteData.pageParams;-- // Combine all conversations of all pages into one array- let collection = infiniteData.pages.flatMap((page) => page[collectionName]);-- if (collection.length === 0) {- return infiniteData;- }-- if (uniqueProperty) {- const seen = new Set<TData>();- collection = collection.filter((item) => {- const value = item[uniqueProperty];- if (seen.has(value)) {- return false;- }- seen.add(value);- return true;- });- }-- // Create the restructured pages- const restructuredPages = Array.from({ length: pageCount }, (_, i) => ({- ...infiniteData.pages[i],- [collectionName]: collection.slice(i * pageSize, (i + 1) * pageSize),- })).filter((page) => page[collectionName].length > 0); // Remove empty pages-- return {- pageParams: pageParams.slice(0, restructuredPages.length),- pages: restructuredPages,- };-};-export const updateFields = <TCollection, TData>(data: InfiniteData<TCollection>,updatedItem: Partial<TData>,diff --git a/client/src/utils/configHtml.ts b/client/src/utils/configHtml.tsindex dec654acd8..4c6c1366c3 100644--- a/client/src/utils/configHtml.ts+++ b/client/src/utils/configHtml.ts@@ -71,7 +71,3 @@ export function createConfigHtmlTextSanitizer() {return (fragment.textContent ?? '').replace(/\s+/g, ' ').trim();};}--export function sanitizeConfigHtml(html?: string | null, options?: ConfigHtmlSanitizerOptions) {- return createConfigHtmlSanitizer(options)(html);-}diff --git a/client/src/utils/convos.fakeData.ts b/client/src/utils/convos.fakeData.tsdeleted file mode 100644index df6e6d8609..0000000000--- a/client/src/utils/convos.fakeData.ts+++ /dev/null@@ -1,567 +0,0 @@-// @ts-nocheck-import { EModelEndpoint, ImageDetail } from 'librechat-data-provider';-import type { ConversationData } from 'librechat-data-provider';--const today = new Date();-today.setDate(today.getDate() - 3);-const updatedAt = today.toISOString();--export const convoData: ConversationData = {- pages: [- {- conversations: [- {- conversationId: 'bf71b257-3625-440c-b6a6-03f6a3fd6a4d',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-02T15:28:47.123Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bd0a2f7cb605e374e93ea3',- '65bd0a2f7cb605e374e94028',- '65bec4af7cb605e3741e84d1',- '65bec4af7cb605e3741e86aa',- ],- model: 'gpt-3.5-turbo-0125',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'A Long Story',- top_p: 1,- updatedAt,- },- {- conversationId: '544f1c4f-030f-4ea2-997c-35923f5d8ee2',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T22:48:33.144Z',- endpoint: 'OpenRouter',- endpointType: EModelEndpoint.custom,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bec2c27cb605e3741896fd',- '65bec2c47cb605e374189c16',- '65bec2d97cb605e37418d7dc',- '65bec2e67cb605e374190490',- '65bec2e77cb605e3741907df',- ],- model: 'meta-llama/llama-2-13b-chat',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'How Are You Doing?',- top_p: 1,- updatedAt,- },- {- conversationId: 'e3f19866-190e-43ab-869f-10260f07530f',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T18:55:09.560Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65be8c0d7cb605e37473236c', '65be8c0d7cb605e374732475'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'A Long Story',- top_p: 1,- updatedAt,- },- {- conversationId: '4d569723-3aff-4f52-9bbf-e127783a06ac',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T16:37:37.600Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65be6bd17cb605e374127036',- '65be6bd17cb605e374127156',- '65be8c007cb605e37472f7a9',- '65be8c007cb605e37472f8b5',- '65be8c057cb605e374730c05',- '65be8c067cb605e374730dae',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: "Write Einstein's Famous Equation in LaTeX",- top_p: 1,- updatedAt,- },- {- conversationId: '640db89d-459f-4411-a0b0-26cb1d53bf1a',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T16:36:11.010Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65be6b7a7cb605e374117519',- '65be6b7b7cb605e37411766c',- '65be6e1c7cb605e374195898',- '65be6e1d7cb605e374195985',- '65be6e767cb605e3741a5d94',- '65be6e767cb605e3741a5e8e',- '65be89ee7cb605e3746ccb52',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Fibonacci Solver in Python',- top_p: 1,- updatedAt,- },- {- conversationId: 'a9b39a05-fdc0-47f4-bd3b-b0aca618f656',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:06:55.573Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bde6117cb605e37481d294',- '65bde6117cb605e37481d4eb',- '65be6e7b7cb605e3741a6dd4',- '65be6e7b7cb605e3741a6ebe',- '65be6fa97cb605e3741df0ed',- '65be6fa97cb605e3741df249',- '65be709a7cb605e37420ca1b',- '65be709a7cb605e37420cb24',- '65be71ba7cb605e374244131',- '65be71bb7cb605e37424423e',- '65be79017cb605e37439dddd',- '65be79027cb605e37439df49',- '65be82e57cb605e37457d6b5',- '65be84727cb605e3745c76ff',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'test',- top_p: 1,- updatedAt,- },- {- conversationId: '3ce779d7-8535-4a43-9b70-e0d3160f299e',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-02T16:41:24.324Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bd1b347cb605e3741e299d',- '65bd1b347cb605e3741e2ba6',- '65be82ed7cb605e37457f381',- ],- model: 'gpt-3.5-turbo-0125',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'c162f906-06fb-405a-b7e6-773a0fc5f8e9',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T06:01:57.968Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bdd6d77cb605e37454b66c',- '65bdd6d87cb605e37454b892',- '65bddca57cb605e37465ceea',- '65bddcab7cb605e37465de2b',- '65bddccb7cb605e374663d37',- '65bddccc7cb605e374663ea9',- '65bddce17cb605e374667f08',- '65bddce27cb605e374668096',- '65bdeb557cb605e37491787a',- '65bdeb567cb605e374917aa2',- '65be82dc7cb605e37457b70e',- ],- model: 'gpt-4-0125-preview',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'test',- top_p: 1,- updatedAt,- },- {- conversationId: '48bbc7d5-1815-4024-8ac6-6c9f59242426',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T18:15:36.759Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65be82c87cb605e3745777f6',- '65be82c97cb605e374577911',- '65be82d57cb605e37457a2fc',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: '97d6e676-b05b-43f9-8f56-1c07e8a1eb4e',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:16:36.407Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bde8557cb605e37488abe2',- '65bde8567cb605e37488ad32',- '65be6eb97cb605e3741b267b',- '65be6eba7cb605e3741b2849',- '65be703c7cb605e3741fb06d',- '65be703d7cb605e3741fb182',- '65be710b7cb605e374221776',- '65be710b7cb605e37422193a',- '65be72137cb605e37425544c',- '65be72137cb605e37425556c',- '65be7e2c7cb605e3744975ee',- '65be7e6c7cb605e3744a3d29',- '65be81147cb605e374525ccb',- '65be826b7cb605e374565dcf',- '65be827e7cb605e37456986c',- '65be82967cb605e37456db94',- '65be82c07cb605e374575ef6',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'test',- top_p: 1,- updatedAt,- },- {- conversationId: '293f230b-ceaa-4802-9611-c4fe7e4b1fd6',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:20:58.933Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bde95c7cb605e3748ba84d',- '65bde95c7cb605e3748baa9d',- '65be6b3a7cb605e37410ab2d',- '65be6b3a7cb605e37410ac16',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello, How Can I Help You?',- top_p: 1,- updatedAt,- },- {- conversationId: '279db3ad-2219-4229-b99a-e19a2b191dd7',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T16:32:22.480Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65be6a967cb605e3740ebd60', '65be6a967cb605e3740ebf38'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello there! How may I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: '3e62a081-055c-4ee5-9e33-7ab8b3d367c9',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:26:10.988Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bdea947cb605e3748f4275', '65bdea947cb605e3748f43af'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How may I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'b97836fc-8566-48e2-a28d-99f99528ca20',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:18:01.245Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde8aa7cb605e37489a256', '65bde8ab7cb605e37489a3a1'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'aa52b79d-ebe7-49d1-9fee-5f5b89d56069',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:16:03.728Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde8357cb605e37488508e', '65bde8357cb605e37488520e'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How may I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'fe50b20f-8465-4866-b5ef-9bc519a00eef',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:13:10.682Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde7887cb605e3748644e0', '65bde7887cb605e37486463b'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: '2fbb4a34-4d17-4e05-8c0a-949e78572aa3',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:10:42.904Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde6f47cb605e374848207', '65bde6f47cb605e3748483b5'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'c0d587d0-e881-42be-a2cf-5bf01198bdac',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:09:25.506Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde6a77cb605e3748393d7', '65bde6a77cb605e374839506'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'acd7fa14-4165-4fa1-b2a6-637041743a78',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:08:10.607Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde65c7cb605e37482b6f7', '65bde65c7cb605e37482b822'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: '61ba520e-d53b-4816-b8cc-059d89f15ed4',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T07:07:49.166Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde6467cb605e374826fee', '65bde6477cb605e374827125'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'd4f599af-aeae-4a54-b34c-bd85ce8134af',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T06:59:49.834Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bde4677cb605e3747cd0ed', '65bde4677cb605e3747cd26d'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'e424c98c-8540-428a-ae43-dc314e15849d',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T06:40:18.167Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bddfd37cb605e3746f42c5', '65bddfd47cb605e3746f4471'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'edac9c4d-bb66-4550-acaf-98006b83db4d',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T06:35:35.937Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: ['65bddeb97cb605e3746bfb5e', '65bddeb97cb605e3746bfc8a'],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hello! How can I assist you today?',- top_p: 1,- updatedAt,- },- {- conversationId: 'dbeca051-8af8-42cb-a611-70f669c66502',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T06:00:31.691Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bdd6817cb605e37453b904',- '65bdd6817cb605e37453ba9b',- '65bddd7e7cb605e3746858ff',- '65bddd7f7cb605e374685ac6',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'test 2',- top_p: 1,- updatedAt,- },- {- conversationId: '4a69c491-5cfc-4a62-b7d3-6a54d890dfa8',- user: 'my-user-id',- chatGptLabel: null,- createdAt: '2024-02-03T06:14:02.394Z',- endpoint: EModelEndpoint.openAI,- frequency_penalty: 0,- imageDetail: ImageDetail.auto,- messages: [- '65bdd9ab7cb605e3745cf30b',- '65bdd9ac7cb605e3745cf3f6',- '65bddc417cb605e37464abc7',- '65bddc427cb605e37464ad09',- '65bddc4a7cb605e37464c7cc',- '65bddc767cb605e374654895',- ],- model: 'gpt-3.5-turbo-0301',- presence_penalty: 0,- promptPrefix: null,- resendFiles: false,- temperature: 1,- title: 'Hi there! How can I assist you today?',- top_p: 1,- updatedAt,- },- ],- pages: 49,- pageNumber: '1',- pageSize: 25,- },- ],- pageParams: [null],-};diff --git a/client/src/utils/convos.spec.ts b/client/src/utils/convos.spec.tsindex b72ee17c33..e8451641ed 100644--- a/client/src/utils/convos.spec.ts+++ b/client/src/utils/convos.spec.ts@@ -11,12 +11,9 @@ import {supersedeConvoSnapshots,fetchConvoSnapshot,storeEndpointSettings,- addConversationToInfinitePages,- updateInfiniteConvoPage,findConversationInInfinite,removeConvoFromInfinitePages,groupConversations,- updateConvoFieldsInfinite,addConvoToAllQueries,collectPinnedConversations,upsertConvoInAllQueries,@@ -28,10 +25,8 @@ import {isConversationUnseen,applyServerReplyStamp,removeConvoFromAllQueries,- addConversationToAllConversationsQueries,invalidateConversationLists,} from './convos';-import { normalizeData } from './collection';jest.mock('date-fns', () => {const actual = jest.requireActual('date-fns');@@ -415,173 +410,6 @@ describe('Conversation Utilities', () => {});});- describe('normalizeConversationData', () => {- it('normalizes the number of items on each page after data removal', () => {- // Create test data:- // Generates 15 conversation items, each with a unique conversationId and an updatedAt timestamp set to a different day.- // { conversationId: '1', updatedAt: new Date(Date.now() - 86400000 * i).toISOString() }- const conversations = Array.from({ length: 15 }, (_, i) => ({- conversationId: (i + 1).toString(),- updatedAt: new Date(Date.now() - 86400000 * i).toISOString(),- }));-- // Paginate Data:- // Divides the 15 conversation items into pages, with each page containing up to 5 items (pageSize is set to 5). This results in 3 pages.- const pageSize = 5;- const totalPageNumber = Math.ceil(conversations.length / pageSize);-- const paginatedData = Array.from({ length: totalPageNumber }, (_, index) => ({- conversations: conversations.slice(index * pageSize, (index + 1) * pageSize),- pages: totalPageNumber,- pageNumber: index + 1,- pageSize,- }));-- const testData = { pages: paginatedData, pageParams: [null, 2, 3] };-- // Removes one item from the first page, resulting in the first page having 4 items, while the second and third pages still have 5 items each.- testData.pages[0].conversations.splice(1, 1);- expect(testData.pages[0].conversations).toHaveLength(4);- expect(testData.pages[1].conversations).toHaveLength(5);- expect(testData.pages[2].conversations).toHaveLength(5);-- // Normalize Data:- // Calls the normalizeData function to ensure that each page contains exactly 5 items, redistributing the items across the pages as needed.- const normalizedData = normalizeData(testData, 'conversations', pageSize);-- // Verify Results:- // Asserts that the number of conversation data is 5 except for the last page,- // that the number of conversation data is 4 only for the last page,- // and that the conversation ids are in the expected order.- expect(normalizedData.pages[0].conversations).toHaveLength(5);- expect(normalizedData.pages[0].conversations[0].conversationId).toBe('1');- expect(normalizedData.pages[0].conversations[4].conversationId).toBe('6');-- expect(normalizedData.pages[1].conversations).toHaveLength(5);- expect(normalizedData.pages[1].conversations[0].conversationId).toBe('7');- expect(normalizedData.pages[1].conversations[4].conversationId).toBe('11');-- expect(normalizedData.pages[2].conversations).toHaveLength(4);- expect(normalizedData.pages[2].conversations[0].conversationId).toBe('12');- expect(normalizedData.pages[2].conversations[3].conversationId).toBe('15');- });-- it('normalizes the number of items on each page after data addition', () => {- // Create test data:- // Generates 15 conversation items, each with a unique conversationId and an updatedAt timestamp set to a different day.- // { conversationId: '1', updatedAt: new Date(Date.now() - 86400000 * i).toISOString() }- const conversations = Array.from({ length: 15 }, (_, i) => ({- conversationId: (i + 1).toString(),- updatedAt: new Date(Date.now() - 86400000 * i).toISOString(),- }));-- // Paginate Data:- // Divides the 15 conversation items into pages,- // with each page containing up to 5 items (pageSize is set to 5). This results in 3 pages.- const pageSize = 5;- const totalPageNumber = Math.ceil(conversations.length / pageSize);-- const paginatedData = Array.from({ length: totalPageNumber }, (_, index) => ({- conversations: conversations.slice(index * pageSize, (index + 1) * pageSize),- pages: totalPageNumber,- pageNumber: index + 1,- pageSize,- }));-- const testData = { pages: paginatedData, pageParams: [null, 2, 3] };-- // Inserts a new conversation item at the beginning of the first page,- testData.pages[0].conversations.unshift({- conversationId: '16',- updatedAt: new Date().toISOString(),- });-- // resulting in the first page having 6 items,- // while the second and third pages still have 5 items each.- expect(testData.pages[0].conversations).toHaveLength(6);- expect(testData.pages[1].conversations).toHaveLength(5);- expect(testData.pages[2].conversations).toHaveLength(5);- expect(testData.pages[2].conversations[4].conversationId).toBe('15');- expect(testData.pages).toHaveLength(3);-- const normalizedData = normalizeData(testData, 'conversations', pageSize);-- // Verify Results:- // Asserts that after normalization, each page contains the correct number of items (5 items per page).- expect(normalizedData.pages[0].conversations).toHaveLength(5);- expect(normalizedData.pages[1].conversations).toHaveLength(5);- expect(normalizedData.pages[2].conversations).toHaveLength(5);- expect(normalizedData.pages).toHaveLength(3);-- // Checks that the items are in the expected order, ensuring that the conversationId values are correctly distributed across the pages.-- expect(normalizedData.pages[0].conversations[0].conversationId).toBe('16');- expect(normalizedData.pages[0].conversations[4].conversationId).toBe('4');-- expect(normalizedData.pages[1].conversations[0].conversationId).toBe('5');- expect(normalizedData.pages[1].conversations[4].conversationId).toBe('9');-- expect(normalizedData.pages[2].conversations[0].conversationId).toBe('10');- expect(normalizedData.pages[2].conversations[4].conversationId).toBe('14');- expect(normalizedData.pageParams).toHaveLength(3);- });-- it('returns empty data when there is no data', () => {- const normalizedData = normalizeData(- { pages: [{ conversations: [], pageNumber: 1, pageSize: 5, pages: 1 }], pageParams: [] },- 'conversations',- 5,- );-- expect(normalizedData.pages[0].conversations).toHaveLength(0);- });-- it('does not normalize data when not needed', () => {- const normalizedData = normalizeData(- { pages: [{ conversations: ['1'], pageNumber: 1, pageSize: 5, pages: 1 }], pageParams: [] },- 'conversations',- 5,- );-- expect(normalizedData.pages[0].conversations).toHaveLength(1);- });-- it('deletes pages that have no data as a result of normalization', () => {- const conversations = Array.from({ length: 15 }, (_, i) => ({- conversationId: (i + 1).toString(),- updatedAt: new Date(Date.now() - 86400000 * i).toISOString(),- }));-- const pageSize = 5;- const totalPageNumber = Math.ceil(conversations.length / pageSize);-- const paginatedData = Array.from({ length: totalPageNumber }, (_, index) => ({- conversations: conversations.slice(index * pageSize, (index + 1) * pageSize),- pages: totalPageNumber,- pageNumber: index + 1,- pageSize,- }));-- const testData = { pages: paginatedData, pageParams: [null, 2, 3] };-- // Removes all data from the last page, resulting in the last page having 0 items.- testData.pages[2].conversations = [];- expect(testData.pages[0].conversations).toHaveLength(5);- expect(testData.pages[1].conversations).toHaveLength(5);- expect(testData.pages[2].conversations).toHaveLength(0);- expect(testData.pageParams).toHaveLength(3);-- const normalizedData = normalizeData(testData, 'conversations', pageSize);-- // Verify Results:- // Asserts that the last page is removed after normalization, leaving only the first and second pages.- expect(normalizedData.pages).toHaveLength(2);- expect(normalizedData.pages[0].conversations).toHaveLength(5);- expect(normalizedData.pages[1].conversations).toHaveLength(5);- expect(normalizedData.pageParams).toHaveLength(2);- });- });-describe('InfiniteData helpers', () => {const makeConversation = (id: string, updatedAt?: string) => ({conversationId: id,@@ -620,52 +448,6 @@ describe('Conversation Utilities', () => {});});- describe('updateInfiniteConvoPage', () => {- it('updates a conversation in InfiniteData', () => {- const data = {- pages: [makePage([makeConversation('1', '2023-01-01T00:00:00Z'), makeConversation('2')])],- pageParams: [],- };- const updater = (c: any) => ({ ...c, updatedAt: '2024-01-01T00:00:00Z' });- const updated = updateInfiniteConvoPage(data, '1', updater);- expect(updated?.pages[0].conversations[0].updatedAt).toBe('2024-01-01T00:00:00Z');- });-- it('returns original data if conversation not found', () => {- const data = {- pages: [makePage([makeConversation('1')])],- pageParams: [],- };- const updater = (c: any) => ({ ...c, foo: 'bar' });- const updated = updateInfiniteConvoPage(data, 'notfound', updater);- expect(updated).toEqual(data);- });-- it('returns undefined if data is undefined', () => {- expect(updateInfiniteConvoPage(undefined, '1', (c) => c)).toBeUndefined();- });- });-- describe('addConversationToInfinitePages', () => {- it('adds a conversation to the first page', () => {- const data = {- pages: [makePage([makeConversation('1')])],- pageParams: [],- };- const newConvo = makeConversation('new');- const updated = addConversationToInfinitePages(data, newConvo as TConversation);- expect(updated.pages[0].conversations[0].conversationId).toBe('new');- expect(updated.pages[0].conversations[1].conversationId).toBe('1');- });-- it('creates new InfiniteData if data is undefined', () => {- const newConvo = makeConversation('new');- const updated = addConversationToInfinitePages(undefined, newConvo as TConversation);- expect(updated.pages[0].conversations[0].conversationId).toBe('new');- expect(updated.pageParams).toEqual([undefined]);- });- });-describe('removeConvoFromInfinitePages', () => {it('removes a conversation by id', () => {const data = {@@ -694,57 +476,6 @@ describe('Conversation Utilities', () => {});});- describe('updateConvoFieldsInfinite', () => {- it('updates fields and bumps to front if keepPosition is false', () => {- const data = {- pages: [- makePage([makeConversation('1'), makeConversation('2')]),- makePage([makeConversation('3')]),- ],- pageParams: [],- };- const updated = updateConvoFieldsInfinite(- data,- { conversationId: '2', title: 'new' },- false,- );- expect(updated?.pages[0].conversations[0].conversationId).toBe('2');- expect(updated?.pages[0].conversations[0].title).toBe('new');- });-- it('updates fields and keeps position if keepPosition is true', () => {- const data = {- pages: [makePage([makeConversation('1'), makeConversation('2')])],- pageParams: [],- };- const updated = updateConvoFieldsInfinite(- data,- { conversationId: '2', title: 'stay' },- true,- );- expect(updated?.pages[0].conversations[1].title).toBe('stay');- });-- it('returns original data if conversation not found', () => {- const data = {- pages: [makePage([makeConversation('1')])],- pageParams: [],- };- const updated = updateConvoFieldsInfinite(- data,- { conversationId: 'notfound', title: 'x' },- false,- );- expect(updated).toEqual(data);- });-- it('returns original data if data is undefined', () => {- expect(- updateConvoFieldsInfinite(undefined, { conversationId: '1', title: 'x' }, false),- ).toBeUndefined();- });- });-describe('storeEndpointSettings', () => {beforeEach(() => {localStorage.clear();@@ -1773,12 +1504,12 @@ describe('Conversation Utilities', () => {expect(data!.pages.length).toBe(0);});- it('addConversationToAllConversationsQueries works with multiple pages', () => {+ it('addConvoToAllQueries works with multiple pages', () => {queryClient.setQueryData(['allConversations', 'other'], {pages: [{ conversations: [], nextCursor: null }],pageParams: [],});- addConversationToAllConversationsQueries(queryClient, convoB);+ addConvoToAllQueries(queryClient, convoB);const mainData = queryClient.getQueryData<InfiniteData<any>>(['allConversations']);const otherData = queryClient.getQueryData<InfiniteData<any>>([@@ -1806,7 +1537,7 @@ describe('Conversation Utilities', () => {});});- describe('addConversationToAllConversationsQueries with list facets', () => {+ describe('addConvoToAllQueries with list facets', () => {const emptyPages = { pages: [{ conversations: [], nextCursor: null }], pageParams: [] };/** A row the endpoint and date facets can judge from its own fields. */const facetConvo = {@@ -1822,7 +1553,7 @@ describe('Conversation Utilities', () => {const key = ['allConversations', { endpoints: ['google'] }];queryClient.setQueryData(key, emptyPages);- addConversationToAllConversationsQueries(queryClient, facetConvo);+ addConvoToAllQueries(queryClient, facetConvo);expect(queryClient.getQueryData<InfiniteData<any>>(key)!.pages[0].conversations,@@ -1834,7 +1565,7 @@ describe('Conversation Utilities', () => {const key = ['allConversations', { updatedAfter: '2026-09-25T00:00:00.000Z' }];queryClient.setQueryData(key, emptyPages);- addConversationToAllConversationsQueries(queryClient, facetConvo);+ addConvoToAllQueries(queryClient, facetConvo);expect(queryClient.getQueryData<InfiniteData<any>>(key)!.pages[0].conversations,@@ -1846,7 +1577,7 @@ describe('Conversation Utilities', () => {const key = ['allConversations', { updatedAfter: '2026-09-24T00:00:00.000Z' }];queryClient.setQueryData(key, emptyPages);- addConversationToAllConversationsQueries(queryClient, facetConvo);+ addConvoToAllQueries(queryClient, facetConvo);expect(queryClient.getQueryData<InfiniteData<any>>(key)!.pages[0].conversations[0]@@ -1917,7 +1648,7 @@ describe('Conversation Utilities', () => {queryClient.setQueryData(key, emptyPages);const invalidate = jest.spyOn(queryClient, 'invalidateQueries');- addConversationToAllConversationsQueries(queryClient, facetConvo);+ addConvoToAllQueries(queryClient, facetConvo);expect(invalidate).toHaveBeenCalledWith(expect.objectContaining({ queryKey: key, refetchType: 'active' }),diff --git a/client/src/utils/convos.ts b/client/src/utils/convos.tsindex 615e6c5df6..0e9db68673 100644--- a/client/src/utils/convos.ts+++ b/client/src/utils/convos.ts@@ -499,78 +499,6 @@ export function findConversationInInfinite(return undefined;}-export function updateInfiniteConvoPage(- data: InfiniteData<ConversationCursorData> | undefined,- conversationId: string,- updater: (c: TConversation) => TConversation,-): InfiniteData<ConversationCursorData> | undefined {- if (!data) {- return data;- }- return {- ...data,- pages: data.pages.map((page) => ({- ...page,- conversations: page.conversations.map((c) =>- c.conversationId === conversationId ? updater(c) : c,- ),- })),- };-}--export function addConversationToInfinitePages(- data: InfiniteData<ConversationCursorData> | undefined,- newConversation: TConversation,-): InfiniteData<ConversationCursorData> {- if (!data) {- return {- pageParams: [undefined],- pages: [{ conversations: [newConversation], nextCursor: null }],- };- }- return {- ...data,- pages: [- { ...data.pages[0], conversations: [newConversation, ...data.pages[0].conversations] },- ...data.pages.slice(1),- ],- };-}--export function addConversationToAllConversationsQueries(- queryClient: QueryClient,- newConversation: TConversation,-) {- for (const query of findConversationListQueries(queryClient)) {- const verdict = conversationInsertVerdict(query.queryKey, newConversation);- if (verdict === 'skip') {- continue;- }- if (verdict === 'refetch') {- queryClient.invalidateQueries({ queryKey: query.queryKey, refetchType: 'active' });- continue;- }- queryClient.setQueryData<InfiniteData<ConversationCursorData>>(query.queryKey, (old) => {- if (- !old ||- old.pages[0].conversations.some((c) => c.conversationId === newConversation.conversationId)- ) {- return old;- }- return {- ...old,- pages: [- {- ...old.pages[0],- conversations: [newConversation, ...old.pages[0].conversations],- },- ...old.pages.slice(1),- ],- };- });- }-}-export function removeConvoFromInfinitePages(data: InfiniteData<ConversationCursorData> | undefined,conversationId: string,@@ -589,61 +517,6 @@ export function removeConvoFromInfinitePages(};}-// Used for partial update (e.g., title, etc.), updating AND possibly bumping to front of visible convos-export function updateConvoFieldsInfinite(- data: InfiniteData<ConversationCursorData> | undefined,- updatedConversation: Partial<TConversation> & { conversationId: string },- keepPosition = false,-): InfiniteData<ConversationCursorData> | undefined {- if (!data) {- return data;- }- let found: TConversation | undefined;- let pageIdx = -1,- convoIdx = -1;- for (let i = 0; i < data.pages.length; ++i) {- const idx = data.pages[i].conversations.findIndex(- (c) => c.conversationId === updatedConversation.conversationId,- );- if (idx !== -1) {- pageIdx = i;- convoIdx = idx;- found = data.pages[i].conversations[idx];- break;- }- }- if (!found) {- return data;- }-- if (keepPosition) {- return {- ...data,- pages: data.pages.map((page, pi) =>- pi === pageIdx- ? {- ...page,- conversations: page.conversations.map((c, ci) =>- ci === convoIdx ? { ...c, ...updatedConversation } : c,- ),- }- : page,- ),- };- } else {- const patched = { ...found, ...updatedConversation, updatedAt: new Date().toISOString() };- const pages = data.pages.map((page) => ({- ...page,- conversations: page.conversations.filter((c) => c.conversationId !== patched.conversationId),- }));-- pages[0].conversations = [patched, ...pages[0].conversations];-- const finalPages = pages.filter((page) => page.conversations.length > 0);- return { ...data, pages: finalPages };- }-}-export function storeEndpointSettings(conversation: TConversation | null) {if (!conversation) {return;diff --git a/client/src/utils/drafts.spec.ts b/client/src/utils/drafts.spec.tsindex 2e0fe23b30..287d42f7da 100644--- a/client/src/utils/drafts.spec.ts+++ b/client/src/utils/drafts.spec.ts@@ -1,6 +1,5 @@import { Constants, LocalStorageKeys } from 'librechat-data-provider';import {- applyPendingPasteToDraft,applyPendingPastesToDraft,clearAllDrafts,clearDraft,@@ -80,48 +79,56 @@ describe('getNewConversationDraftId', () => {});});-describe('applyPendingPasteToDraft', () => {+describe('applyPendingPastesToDraft with a single paste', () => {it('replaces a stale selected range when the original text is still present', () => {expect(- applyPendingPasteToDraft('before selected after', {- text: 'pasted',- selectionStart: 7,- selectionEnd: 15,- replacedText: 'selected',- }),+ applyPendingPastesToDraft('before selected after', [+ {+ text: 'pasted',+ selectionStart: 7,+ selectionEnd: 15,+ replacedText: 'selected',+ },+ ]),).toBe('before pasted after');});it('inserts at the caret when the selected range is already gone', () => {expect(- applyPendingPasteToDraft('before after', {- text: 'pasted',- selectionStart: 7,- selectionEnd: 15,- replacedText: 'selected',- }),+ applyPendingPastesToDraft('before after', [+ {+ text: 'pasted',+ selectionStart: 7,+ selectionEnd: 15,+ replacedText: 'selected',+ },+ ]),).toBe('before pasted after');});it('inserts at the caret when no replacement range was stored', () => {expect(- applyPendingPasteToDraft('before after', {- text: 'pasted',- selectionStart: 7,- }),+ applyPendingPastesToDraft('before after', [+ {+ text: 'pasted',+ selectionStart: 7,+ },+ ]),).toBe('before pasted after');});it('does not delete remaining identical text after a post-replacement snapshot', () => {expect(- applyPendingPasteToDraft('abc', {- text: 'PASTE',- selectionStart: 0,- replacedText: 'abc',- replacedApplied: true,- anchorBefore: '',- anchorAfter: 'abc',- }),+ applyPendingPastesToDraft('abc', [+ {+ text: 'PASTE',+ selectionStart: 0,+ replacedText: 'abc',+ replacedApplied: true,+ anchorBefore: '',+ anchorAfter: 'abc',+ },+ ]),).toBe('PASTEabc');});});@@ -151,49 +158,57 @@ describe('applyPendingPastesToDraft', () => {it('rebases an insert after the user edits text before the original caret', () => {expect(- applyPendingPasteToDraft('Xhello', {- text: 'PASTE',- selectionStart: 5,- replacedApplied: true,- anchorBefore: 'hello',- anchorAfter: '',- }),+ applyPendingPastesToDraft('Xhello', [+ {+ text: 'PASTE',+ selectionStart: 5,+ replacedApplied: true,+ anchorBefore: 'hello',+ anchorAfter: '',+ },+ ]),).toBe('XhelloPASTE');});it('rebases an insert past a prefix the user duplicated', () => {expect(- applyPendingPasteToDraft('aabc', {- text: 'PASTE',- selectionStart: 1,- replacedApplied: true,- anchorBefore: 'a',- anchorAfter: 'bc',- }),+ applyPendingPastesToDraft('aabc', [+ {+ text: 'PASTE',+ selectionStart: 1,+ replacedApplied: true,+ anchorBefore: 'a',+ anchorAfter: 'bc',+ },+ ]),).toBe('aaPASTEbc');});it('keeps a leading insert ahead of a suffix the user duplicated', () => {expect(- applyPendingPasteToDraft('abcabc', {- text: 'PASTE',- selectionStart: 0,- replacedApplied: true,- anchorBefore: '',- anchorAfter: 'abc',- }),+ applyPendingPastesToDraft('abcabc', [+ {+ text: 'PASTE',+ selectionStart: 0,+ replacedApplied: true,+ anchorBefore: '',+ anchorAfter: 'abc',+ },+ ]),).toBe('PASTEabcabc');});it('rebases an insert when both sides of the original caret were edited', () => {expect(- applyPendingPasteToDraft('XhelloWORLDY', {- text: 'PASTE',- selectionStart: 5,- replacedApplied: true,- anchorBefore: 'hello',- anchorAfter: 'WORLD',- }),+ applyPendingPastesToDraft('XhelloWORLDY', [+ {+ text: 'PASTE',+ selectionStart: 5,+ replacedApplied: true,+ anchorBefore: 'hello',+ anchorAfter: 'WORLD',+ },+ ]),).toBe('XhelloPASTEWORLDY');});diff --git a/client/src/utils/drafts.ts b/client/src/utils/drafts.tsindex 2fc8e96421..037db909a9 100644--- a/client/src/utils/drafts.ts+++ b/client/src/utils/drafts.ts@@ -201,11 +201,6 @@ export const resolvePendingPasteInsertStart = ();};-export const applyPendingPasteToDraft = (- draftText: string,- pendingPaste: PendingTextAttachmentDraft,-): string => applyPendingPastesToDraft(draftText, [pendingPaste]);-/** Replay leftover pre-deletion ranges, then insert paste text at rebased or anchored offsets. */export const applyPendingPastesToDraft = (draftText: string,diff --git a/client/src/utils/files.ts b/client/src/utils/files.tsindex 18b44ed127..d3beca2595 100644--- a/client/src/utils/files.ts+++ b/client/src/utils/files.ts@@ -149,27 +149,6 @@ export const fileTypes = {// image,};-// export const getFileType = (type = '') => {-// let fileType = fileTypes.file;-// const exactMatch = fileTypes[type];-// const partialMatch = !exactMatch && partialTypes.find((type) => type.includes(type));-// const category = (!partialMatch && (type.split('/')[0] ?? 'text') || 'text');--// if (exactMatch) {-// fileType = exactMatch;-// } else if (partialMatch) {-// fileType = fileTypes[partialMatch];-// } else if (fileTypes[category]) {-// fileType = fileTypes[category];-// }--// if (!fileType) {-// fileType = fileTypes.file;-// }--// return fileType;-// };-export const getFileType = (type = '',): {@@ -722,20 +701,6 @@ export const PASTE_AS_FILE_MIN_LENGTH = 2500;export const PASTED_TEXT_FILENAME = 'pasted-text.txt';-/** Matches every name `nextPastedTextFilename` can produce, and nothing else: the counter- * starts at the bare name and jumps to 2, so `-0`, `-1`, and zero-padded variants are never- * generated and must not read as generated. The alternation is "any integer of 2 or more":- * a single digit 2-9, or two or more digits. */-const PASTED_TEXT_FILENAME_PATTERN = /^pasted-text(-([2-9]|[1-9]\d+))?\.txt$/;--/**- * Whether a filename is one `nextPastedTextFilename` can produce. Name alone cannot prove an- * attachment is a paste, though: a user can deliberately upload a file with one of these names.- * Provenance comes from the paste registry and the files draft, not the name.- */-export const isPastedTextFilename = (filename?: string | null): boolean =>- filename != null && PASTED_TEXT_FILENAME_PATTERN.test(filename);-/** Paste provenance is genuinely per-tab: it decides which chips offer the paste affordances, and* `sessionStorage` is exactly that scope, surviving this tab's reloads without reaching another.* It has to survive a reload or an already-sent paste would be reclassified as unsent, because thediff --git a/client/src/utils/index.ts b/client/src/utils/index.tsindex 096965fe41..c5331033db 100644--- a/client/src/utils/index.ts+++ b/client/src/utils/index.ts@@ -111,13 +111,6 @@ export const defaultTextProps =export const optionText ='p-0 shadow-none text-right pr-1 h-8 border-transparent hover:bg-surface-hover transition-colors';-export const defaultTextPropsLabel =- 'rounded-md border border-border-medium bg-transparent text-sm text-text-primary shadow-[0_0_0.625rem_rgba(0,0,0,0.10)] outline-hidden focus-within:placeholder:text-text-primary focus:placeholder:text-text-primary placeholder:text-text-secondary focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50';--export function capitalizeFirstLetter(string: string) {- return string.charAt(0).toUpperCase() + string.slice(1);-}-export const handleDoubleClick: React.MouseEventHandler<HTMLElement> = (event) => {const range = document.createRange();range.selectNodeContents(event.target as Node);diff --git a/client/src/utils/localStorage.ts b/client/src/utils/localStorage.tsindex 1cf590b8ee..11e4aa8062 100644--- a/client/src/utils/localStorage.ts+++ b/client/src/utils/localStorage.ts@@ -1,4 +1,4 @@-import { LocalStorageKeys, TConversation, isUUID } from 'librechat-data-provider';+import { LocalStorageKeys, TConversation } from 'librechat-data-provider';export function getLocalStorageItems() {const items = {@@ -70,23 +70,6 @@ export function clearLocalStorage(skipFirst?: boolean) {});}-export function clearConversationStorage(conversationId?: string | null) {- if (!conversationId) {- return;- }- if (!isUUID.safeParse(conversationId)?.success) {- console.warn(- `Conversation ID ${conversationId} is not a valid UUID. Skipping local storage cleanup.`,- );- return;- }- const keys = Object.keys(localStorage);- keys.forEach((key) => {- if (key.includes(conversationId)) {- localStorage.removeItem(key);- }- });-}export function clearAllConversationStorage() {const keys = Object.keys(localStorage);keys.forEach((key) => {diff --git a/client/src/utils/map.ts b/client/src/utils/map.tsindex 9f43d5a502..3676458ca8 100644--- a/client/src/utils/map.ts+++ b/client/src/utils/map.ts@@ -1,5 +1,4 @@import type * as t from 'librechat-data-provider';-import type { TPluginMap } from '~/common';/** Maps Attachments by `toolCallId` for quick lookup */export function mapAttachments(attachments: Array<t.TAttachment | null | undefined>) {@@ -90,49 +89,6 @@ export function mapAgents(agents: t.Agent[]) {return agentsMap;}-/** Maps Plugins by `pluginKey` for quick lookup */-export function mapPlugins(plugins: t.TPlugin[]): TPluginMap {- return plugins.reduce((acc, plugin) => {- acc[plugin.pluginKey] = plugin;- return acc;- }, {} as TPluginMap);-}--/** Transform query data to object with list and map fields */-export const selectPlugins = (- data: t.TPlugin[] | undefined,-): {- list: t.TPlugin[];- map: TPluginMap;-} => {- if (!data) {- return {- list: [],- map: {},- };- }-- return {- list: data,- map: mapPlugins(data),- };-};--/** Transform array to TPlugin values */-export function processPlugins(- tools: (string | t.TPlugin)[],- allPlugins?: TPluginMap,-): t.TPlugin[] {- return tools- .map((tool: string | t.TPlugin) => {- if (typeof tool === 'string') {- return allPlugins?.[tool];- }- return tool;- })- .filter((tool: t.TPlugin | undefined): tool is t.TPlugin => tool !== undefined);-}-export function mapToolCalls(toolCalls: t.ToolCallResults = []): {[key: string]: t.ToolCallResult[] | undefined;} {diff --git a/client/src/utils/messages.ts b/client/src/utils/messages.tsindex fe5c6c3964..9e085ae475 100644--- a/client/src/utils/messages.ts+++ b/client/src/utils/messages.ts@@ -18,7 +18,6 @@ import type {import type { QueryClient } from '@tanstack/react-query';import type { LocalizeFunction, TMessageProps } from '~/common';-export const TEXT_KEY_DIVIDER = '|||';export const STREAM_START_FAILED_METADATA_KEY = 'streamStartFailed';/** A locally submitted user row is not canonical until the server acknowledges it. */@@ -447,86 +446,6 @@ export const markStreamStartFailedMetadata = ([STREAM_START_FAILED_METADATA_KEY]: true,});-const getLatestContentForKey = (message: TMessage): string => {- const formatText = (str: string, index: number): string => {- if (str.length === 0) {- return '0';- }- const length = str.length;- const lastChars = str.slice(-16);- return `${length}${TEXT_KEY_DIVIDER}${lastChars}${TEXT_KEY_DIVIDER}${index}`;- };-- if (message.text) {- return formatText(message.text, -1);- }-- if (!message.content || message.content.length === 0) {- return '';- }-- for (let i = message.content.length - 1; i >= 0; i--) {- const part = message.content[i] as TMessageContentParts | undefined;- if (!part?.type) {- continue;- }-- const type = part.type;- let text = '';-- // Handle THINK type - extract think content- if (type === ContentTypes.THINK && 'think' in part) {- text = typeof part.think === 'string' ? part.think : (part.think?.value ?? '');- }- // Handle TEXT type- else if (type === ContentTypes.TEXT && 'text' in part) {- text = typeof part.text === 'string' ? part.text : (part.text?.value ?? '');- }- // Handle ERROR type- else if (type === ContentTypes.ERROR && 'error' in part) {- text = String(part.error || 'err').slice(0, 30);- }- // Handle TOOL_CALL - use simple marker with type- else if (type === ContentTypes.TOOL_CALL && 'tool_call' in part) {- const tcType = part.tool_call?.type || 'x';- const tcName = String(part.tool_call?.['name'] || 'unknown').slice(0, 20);- const tcArgs = String(part.tool_call?.['args'] || 'none').slice(0, 20);- const tcOutput = String(part.tool_call?.['output'] || 'none').slice(0, 20);- text = `tc_${tcType}_${tcName}_${tcArgs}_${tcOutput}`;- }- // Handle IMAGE_FILE - use simple marker with file_id suffix- else if (type === ContentTypes.IMAGE_FILE && 'image_file' in part) {- const fileId = part.image_file?.file_id || 'x';- text = `if_${fileId.slice(-8)}`;- }- // Handle IMAGE_URL - use simple marker- else if (type === ContentTypes.IMAGE_URL) {- text = 'iu';- }- // Handle AGENT_UPDATE - use simple marker with agentId suffix- else if (type === ContentTypes.AGENT_UPDATE && 'agent_update' in part) {- const agentId = String(part.agent_update?.agentId || 'x').slice(0, 30);- text = `au_${agentId}`;- } else {- text = type;- }-- if (text.length > 0) {- return formatText(text, i);- }- }-- return '';-};--export const getTextKey = (message?: TMessage | null, convoId?: string | null) => {- if (!message) {- return '';- }- const contentKey = getLatestContentForKey(message);- return `${(message.messageId as string | null) ?? ''}${TEXT_KEY_DIVIDER}${contentKey}${TEXT_KEY_DIVIDER}${message.conversationId ?? convoId}`;-};-export const scrollToEnd = (callback?: () => void) => {const messagesEndElement = document.getElementById('messages-end');if (messagesEndElement) {diff --git a/client/src/utils/previewCache.ts b/client/src/utils/previewCache.tsindex 604ce56308..7908cf3364 100644--- a/client/src/utils/previewCache.ts+++ b/client/src/utils/previewCache.ts@@ -28,8 +28,3 @@ export function deletePreview(fileId: string): void {previewCache.delete(fileId);}}--export function clearPreviewCache(): void {- previewCache.forEach((url) => URL.revokeObjectURL(url));- previewCache.clear();-}diff --git a/client/src/utils/promptGroups.ts b/client/src/utils/promptGroups.tsindex 8076803e93..b9c351dadb 100644--- a/client/src/utils/promptGroups.ts+++ b/client/src/utils/promptGroups.ts@@ -78,10 +78,6 @@ export const updateGroupFieldsInPlace = ();};-export const getSnippet = (promptText: string, length = 56) => {- return promptText.length > length ? `${promptText.slice(0, length - 3)}...` : promptText;-};-export const findPromptGroup = (data: InfiniteData<PromptGroupListResponse>,findProperty: (group: TPromptGroup) => boolean,diff --git a/client/src/utils/textarea.ts b/client/src/utils/textarea.tsindex ef9aaba405..d45e3f7d0a 100644--- a/client/src/utils/textarea.ts+++ b/client/src/utils/textarea.ts@@ -39,24 +39,6 @@ export const forceResize = (element: HTMLTextAreaElement | null) => {element.style.height = `${element.scrollHeight}px`;};-/**- * Necessary undo event helper for edge cases where undoing pasted content leaves newlines filling the previous container height.- */-export const trimUndoneRange = (textAreaRef: React.RefObject<HTMLTextAreaElement>) => {- if (!textAreaRef.current) {- return;- }- const { value, selectionStart, selectionEnd } = textAreaRef.current;- const afterCursor = value.substring(selectionEnd).trim();- if (afterCursor.length) {- return;- }- const beforeCursor = value.substring(0, selectionStart);- const newValue = beforeCursor + afterCursor;- textAreaRef.current.value = newValue;- textAreaRef.current.setSelectionRange(selectionStart, selectionStart);-};-/*** Remove the specified character from the end of the textarea's text if it's present.* This function ensures that the specified character is only removed if it's the last character.diff --git a/client/src/utils/timestamps.ts b/client/src/utils/timestamps.tsindex eddf6c4b0d..4d9e0eb025 100644--- a/client/src/utils/timestamps.ts+++ b/client/src/utils/timestamps.ts@@ -27,14 +27,6 @@ export function setTimestamp(key: string): void {localStorage.setItem(`${key}${TIMESTAMP_SUFFIX}`, Date.now().toString());}-/**- * Set a value in localStorage with an associated timestamp- */-export function setTimestampedValue(key: string, value: any): void {- localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value));- localStorage.setItem(`${key}${TIMESTAMP_SUFFIX}`, Date.now().toString());-}-/*** Get a value from localStorage, checking if it has a valid timestamp* Returns null if the value is too old or has no timestamp@@ -59,14 +51,6 @@ export function getTimestampedValue(key: string): string | null {return localStorage.getItem(key);}-/**- * Remove a value and its timestamp from localStorage- */-export function removeTimestampedValue(key: string): void {- localStorage.removeItem(key);- localStorage.removeItem(`${key}${TIMESTAMP_SUFFIX}`);-}-/*** Clean up old localStorage entries based on timestamps* This should be called on app startup@@ -113,28 +97,3 @@ export function cleanupTimestampedStorage(): void {console.error('Error during cleanup of timestamped storage:', error);}}--/**- * Migration function to add timestamps to existing entries- * This ensures existing entries don't get immediately cleaned up- */-export function migrateExistingEntries(): void {- const now = Date.now().toString();-- for (let i = 0; i < localStorage.length; i++) {- const key = localStorage.key(i);- if (!key) continue;-- const isTimestampedKey = TIMESTAMPED_KEYS.some((prefix) => key.startsWith(prefix));-- if (isTimestampedKey && !key.endsWith(TIMESTAMP_SUFFIX)) {- const timestampKey = `${key}${TIMESTAMP_SUFFIX}`;- const hasTimestamp = localStorage.getItem(timestampKey);-- if (!hasTimestamp) {- // Add timestamp to existing entry- localStorage.setItem(timestampKey, now);- }- }- }-}diff --git a/client/src/utils/tokens.spec.ts b/client/src/utils/tokens.spec.tsindex f58b67fb66..8ed5b01333 100644--- a/client/src/utils/tokens.spec.ts+++ b/client/src/utils/tokens.spec.ts@@ -5,7 +5,6 @@ import {upsertEntries,migrateIndex,clearIndex,- hasIndex,sumBranch,mergeUsage,setEntryUsage,@@ -497,7 +496,7 @@ describe('token index', () => {buildIndex(Constants.NEW_CONVO, [msg('u1', Constants.NO_PARENT, true, 10)]);migrateIndex(Constants.NEW_CONVO, 'convo-2');- expect(hasIndex(Constants.NEW_CONVO)).toBe(false);+ expect(sumBranch(Constants.NEW_CONVO, 'u1').input).toBe(0);expect(sumBranch('convo-2', 'u1').input).toBe(10);});});diff --git a/client/src/utils/tokens.ts b/client/src/utils/tokens.tsindex d39be7ad8d..3b4f614138 100644--- a/client/src/utils/tokens.ts+++ b/client/src/utils/tokens.ts@@ -404,10 +404,6 @@ export function clearIndex(conversationId: string): void {usageHistory.delete(conversationId);}-export function hasIndex(conversationId: string): boolean {- return registry.has(conversationId);-}-/** O(depth) walk from the branch tail up the parent chain */export function sumBranch(conversationId: string,@@ -656,45 +652,6 @@ export function collectAnchorSeries(return series.reverse();}-/**- * The branch's largest messages (context contributions), largest first — the- * "what is eating my window" list. Same contribution rule as `sumBranch`:- * stored `tokenCount` when counted, else the char-based `estTokens`.- */-export function topBranchMessages(- conversationId: string,- tailId: string | null | undefined,- limit = 3,-): Array<{ role: 'user' | 'assistant'; tokens: number }> {- const index = registry.get(conversationId);- if (!index || !tailId) {- return [];- }-- const items: Array<{ role: 'user' | 'assistant'; tokens: number }> = [];- let currentId: string | null = tailId;- let guard = index.size;- let contextCapped = false;-- while (currentId && currentId !== Constants.NO_PARENT && guard-- > 0) {- const entry: TokenEntry | undefined = index.get(currentId);- if (!entry) {- break;- }- if (!contextCapped) {- const contribution = entry.tokenCount > 0 ? entry.tokenCount : entry.estTokens;- if (contribution > 0) {- items.push({ role: entry.isCreatedByUser ? 'user' : 'assistant', tokens: contribution });- }- }- if (!contextCapped && entry.summaryUsedTokens != null && entry.summaryUsedTokens > 0) {- contextCapped = true;- }- currentId = entry.parentMessageId;- }- return items.sort((a, b) => b.tokens - a.tokens).slice(0, limit);-}-/*** Tokens of the most recent exchange (the tail response plus the user turn it* answers) — what a summarization would KEEP. `excludeTail` skips an in-flightdiff --git a/client/test/mockMorphIcon.tsx b/client/test/mockMorphIcon.tsxindex bae04fc7d7..a0ca898856 100644--- a/client/test/mockMorphIcon.tsx+++ b/client/test/mockMorphIcon.tsx@@ -39,30 +39,6 @@ export function createCopyCheckMorphIconMock() {]);}-/** Pin favorite morph sites. */-export function createPinMorphIconMock() {- const { Pin, PinOff } = jest.requireActual('lucide') as Record<string, unknown>;- return createMorphIconMock([- [Pin, 'pin'],- [PinOff, 'pin-off'],- ]);-}--/** In-flight steers: preempt Zap + expand chevrons. */-export function createSteerMorphIconMock() {- const { Zap, ZapOff, ChevronUp, ChevronDown, Clock } = jest.requireActual('lucide') as Record<- string,- unknown- >;- return createMorphIconMock([- [Zap, 'zap'],- [ZapOff, 'zap-off'],- [ChevronUp, 'chevron-up'],- [ChevronDown, 'chevron-down'],- [Clock, 'clock'],- ]);-}-/** Mermaid header: exclusive code/preview view toggle. */export function createMermaidViewMorphIconMock() {const { Eye, Code2 } = jest.requireActual('lucide') as Record<string, unknown>;@@ -71,12 +47,3 @@ export function createMermaidViewMorphIconMock() {[Code2, 'code-2'],]);}--/** Subagent expand/collapse. */-export function createSubagentMorphIconMock() {- const { Minimize2, Maximize2 } = jest.requireActual('lucide') as Record<string, unknown>;- return createMorphIconMock([- [Minimize2, 'minimize-2'],- [Maximize2, 'maximize-2'],- ]);-}diff --git a/eslint-suppressions.json b/eslint-suppressions.jsonindex 7ebadf29a4..88ff682245 100644--- a/eslint-suppressions.json+++ b/eslint-suppressions.json@@ -1470,7 +1470,7 @@},"client/src/utils/index.ts": {"design/disabled-recipe": {- "count": 2+ "count": 1}},"packages/chat/src/components/CollapsibleText.tsx": {diff --git a/package-lock.json b/package-lock.jsonindex 92fe411f9f..4216a60fab 100644--- a/package-lock.json+++ b/package-lock.json@@ -931,7 +931,6 @@"monaco-editor": "^0.56.0","morphicons": "^1.4.1","qrcode.react": "^4.2.0",- "rc-input-number": "^7.4.2","react": "^18.2.0","react-avatar-editor": "^13.0.2","react-dnd": "^16.0.1",@@ -14345,6 +14344,7 @@"version": "1.1.0","resolved": "https://registry.npmjs.org/@rc-component/mini-decimal/-/mini-decimal-1.1.0.tgz","integrity": "sha512-jS4E7T9Li2GuYwI6PyiVXmxTiM6b07rlD9Ge8uGZSCz3WlzcG5ZK7g5bbuKNeZ9pgUuPK/5guV781ujdVpm4HQ==",+ "peer": true,"dependencies": {"@babel/runtime": "^7.18.0"},@@ -21291,7 +21291,8 @@"node_modules/classnames": {"version": "2.5.1","resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",- "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="+ "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==",+ "peer": true},"node_modules/clean-set": {"version": "1.1.2",@@ -34627,6 +34628,7 @@"version": "7.4.2","resolved": "https://registry.npmjs.org/rc-input-number/-/rc-input-number-7.4.2.tgz","integrity": "sha512-yGturTw7WGP+M1GbJ+UTAO7L4buxeW6oilhL9Sq3DezsRS8/9qec4UiXUbeoiX9bzvRXH11JvgskBtxSp4YSNg==",+ "peer": true,"dependencies": {"@babel/runtime": "^7.10.1","@rc-component/mini-decimal": "^1.0.1",@@ -34642,6 +34644,7 @@"version": "5.38.1","resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.38.1.tgz","integrity": "sha512-e4ZMs7q9XqwTuhIK7zBIVFltUtMSjphuPPQXHoHlzRzNdOwUxDejo0Zls5HYaJfRKNURcsS/ceKVULlhjBrxng==",+ "peer": true,"dependencies": {"@babel/runtime": "^7.18.3","react-is": "^18.2.0"diff --git a/packages/data-provider/src/types/mutations.ts b/packages/data-provider/src/types/mutations.tsindex 15f14a17d7..b4607bfaa6 100644--- a/packages/data-provider/src/types/mutations.ts+++ b/packages/data-provider/src/types/mutations.ts@@ -309,8 +309,8 @@ export type UpdatePermResponse = r.TRole;/*** Cache entries that can appear under the `[QueryKeys.skills, ...]` key prefix.- * Flat responses come from `useListSkillsQuery`; infinite responses come from- * `useSkillsInfiniteQuery`. The context carries both shapes for rollback.+ * Infinite responses come from `useSkillsInfiniteQuery`; flat responses may also+ * be cached under this prefix. The context carries both shapes for rollback.*/export type TSkillCacheEntry = TSkillListResponse | InfiniteData<TSkillListResponse> | undefined;