mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 03:10:15 +01:00
💽 refactor(client): Optimize ModelsConfig Query Cache (#2330)
* refactor(client): remove double caching of models via recoil to rely exclusively on react-query * chore(useConversation): add modelsQuery.data dep to callback
This commit is contained in:
parent
fb80af05be
commit
f6a84887e1
11 changed files with 76 additions and 94 deletions
|
|
@ -2,7 +2,6 @@ import conversation from './conversation';
|
|||
import conversations from './conversations';
|
||||
import families from './families';
|
||||
import endpoints from './endpoints';
|
||||
import models from './models';
|
||||
import user from './user';
|
||||
import text from './text';
|
||||
import toast from './toast';
|
||||
|
|
@ -17,7 +16,6 @@ export default {
|
|||
...conversation,
|
||||
...conversations,
|
||||
...endpoints,
|
||||
...models,
|
||||
...user,
|
||||
...text,
|
||||
...toast,
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
import { atom } from 'recoil';
|
||||
import { EModelEndpoint, defaultModels } from 'librechat-data-provider';
|
||||
import type { TModelsConfig } from 'librechat-data-provider';
|
||||
|
||||
const fitlerAssistantModels = (str: string) => {
|
||||
return /gpt-4|gpt-3\\.5/i.test(str) && !/vision|instruct/i.test(str);
|
||||
};
|
||||
|
||||
const openAIModels = defaultModels[EModelEndpoint.openAI];
|
||||
|
||||
const modelsConfig = atom<TModelsConfig>({
|
||||
key: 'models',
|
||||
default: {
|
||||
[EModelEndpoint.openAI]: openAIModels,
|
||||
[EModelEndpoint.assistants]: openAIModels.filter(fitlerAssistantModels),
|
||||
[EModelEndpoint.gptPlugins]: openAIModels,
|
||||
[EModelEndpoint.azureOpenAI]: openAIModels,
|
||||
[EModelEndpoint.bingAI]: ['BingAI', 'Sydney'],
|
||||
[EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],
|
||||
[EModelEndpoint.google]: defaultModels[EModelEndpoint.google],
|
||||
[EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],
|
||||
},
|
||||
});
|
||||
|
||||
const modelsQueryEnabled = atom<boolean>({
|
||||
key: 'modelsQueryEnabled',
|
||||
default: true,
|
||||
});
|
||||
|
||||
export default {
|
||||
modelsConfig,
|
||||
modelsQueryEnabled,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue