🪦 refactor: Remove Legacy Code (#10533)

* 🗑️ chore: Remove unused Legacy Provider clients and related helpers

* Deleted OpenAIClient and GoogleClient files along with their associated tests.
* Removed references to these clients in the clients index file.
* Cleaned up typedefs by removing the OpenAISpecClient export.
* Updated chat controllers to use the OpenAI SDK directly instead of the removed client classes.

* chore/remove-openapi-specs

* 🗑️ chore: Remove unused mergeSort and misc utility functions

* Deleted mergeSort.js and misc.js files as they are no longer needed.
* Removed references to cleanUpPrimaryKeyValue in messages.js and adjusted related logic.
* Updated mongoMeili.ts to eliminate local implementations of removed functions.

* chore: remove legacy endpoints

* chore: remove all plugins endpoint related code

* chore: remove unused prompt handling code and clean up imports

* Deleted handleInputs.js and instructions.js files as they are no longer needed.
* Removed references to these files in the prompts index.js.
* Updated docker-compose.yml to simplify reverse proxy configuration.

* chore: remove unused LightningIcon import from Icons.tsx

* chore: clean up translation.json by removing deprecated and unused keys

* chore: update Jest configuration and remove unused mock file

    * Simplified the setupFiles array in jest.config.js by removing the fetchEventSource mock.
    * Deleted the fetchEventSource.js mock file as it is no longer needed.

* fix: simplify endpoint type check in Landing and ConversationStarters components

    * Updated the endpoint type check to use strict equality for better clarity and performance.
    * Ensured consistency in the handling of the azureOpenAI endpoint across both components.

* chore: remove unused dependencies from package.json and package-lock.json

* chore: remove legacy EditController, associated routes and imports

* chore: update banResponse logic to refine request handling for banned users

* chore: remove unused validateEndpoint middleware and its references

* chore: remove unused 'res' parameter from initializeClient in multiple endpoint files

* chore: remove unused 'isSmallScreen' prop from BookmarkNav and NewChat components; clean up imports in ArchivedChatsTable and useSetIndexOptions hooks; enhance localization in PromptVersions

* chore: remove unused import of Constants and TMessage from MobileNav; retain only necessary QueryKeys import

* chore: remove unused TResPlugin type and related references; clean up imports in types and schemas
This commit is contained in:
Danny Avila 2025-11-25 15:20:07 -05:00
parent bf859dc524
commit 3c54740074
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
161 changed files with 256 additions and 10511 deletions

View file

@ -31,12 +31,8 @@ const buildDefaultConvo = ({
const availableModels = models;
const model = lastConversationSetup?.model ?? lastSelectedModel?.[endpoint] ?? '';
const secondaryModel: string | null =
endpoint === EModelEndpoint.gptPlugins
? (lastConversationSetup?.agentOptions?.model ?? lastSelectedModel?.secondaryModel ?? null)
: null;
let possibleModels: string[], secondaryModels: string[];
let possibleModels: string[];
if (availableModels.includes(model)) {
possibleModels = [model, ...availableModels];
@ -44,19 +40,12 @@ const buildDefaultConvo = ({
possibleModels = [...availableModels];
}
if (secondaryModel != null && secondaryModel !== '' && availableModels.includes(secondaryModel)) {
secondaryModels = [secondaryModel, ...availableModels];
} else {
secondaryModels = [...availableModels];
}
const convo = parseConvo({
endpoint: endpoint as EndpointSchemaKey,
endpointType: endpointType as EndpointSchemaKey,
conversation: lastConversationSetup,
possibleValues: {
models: possibleModels,
secondaryModels,
},
});

View file

@ -539,19 +539,6 @@ describe('Conversation Utilities', () => {
expect([undefined, 'gpt-3']).toContain(stored.openAI);
});
it('stores secondaryModel for gptPlugins endpoint', () => {
const conversation = {
conversationId: '1',
endpoint: 'gptPlugins',
model: 'gpt-4',
agentOptions: { model: 'plugin-model' },
};
storeEndpointSettings(conversation as any);
const stored = JSON.parse(localStorage.getItem('lastModel') || '{}');
expect([undefined, 'gpt-4']).toContain(stored.gptPlugins);
expect([undefined, 'plugin-model']).toContain(stored.secondaryModel);
});
it('does nothing if conversation is null', () => {
storeEndpointSettings(null);
expect(localStorage.getItem('lastModel')).toBeNull();

View file

@ -1,3 +1,5 @@
import { QueryClient } from '@tanstack/react-query';
import { LocalStorageKeys, QueryKeys } from 'librechat-data-provider';
import {
format,
isToday,
@ -8,8 +10,6 @@ import {
startOfYear,
isWithinInterval,
} from 'date-fns';
import { QueryClient } from '@tanstack/react-query';
import { EModelEndpoint, LocalStorageKeys, QueryKeys } from 'librechat-data-provider';
import type { TConversation, GroupedConversations } from 'librechat-data-provider';
import type { InfiniteData } from '@tanstack/react-query';
@ -306,15 +306,12 @@ export function storeEndpointSettings(conversation: TConversation | null) {
if (!conversation) {
return;
}
const { endpoint, model, agentOptions } = conversation;
const { endpoint, model } = conversation;
if (!endpoint) {
return;
}
const lastModel = JSON.parse(localStorage.getItem(LocalStorageKeys.LAST_MODEL) ?? '{}');
lastModel[endpoint] = model;
if (endpoint === EModelEndpoint.gptPlugins) {
lastModel.secondaryModel = agentOptions?.model ?? model ?? '';
}
localStorage.setItem(LocalStorageKeys.LAST_MODEL, JSON.stringify(lastModel));
}