mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-24 03:06:12 +01:00
* chore(ChatGPTClient.js): add support for OpenRouter API chore(OpenAIClient.js): add support for OpenRouter API * chore: comment out token debugging * chore: add back streamResult assignment * chore: remove double condition/assignment from merging * refactor(routes/endpoints): -> controller/services logic * feat: add openrouter model fetching * chore: remove unused endpointsConfig in cleanupPreset function * refactor: separate models concern from endpointsConfig * refactor(data-provider): add TModels type and make TEndpointsConfig adaptible to new endpoint keys * refactor: complete models endpoint service in data-provider * refactor: onMutate for refreshToken and login, invalidate models query * feat: complete models endpoint logic for frontend * chore: remove requireJwtAuth from /api/endpoints and /api/models as not implemented yet * fix: endpoint will not be overwritten and instead use active value * feat: openrouter support for plugins * chore(EndpointOptionsDialog): remove unused recoil value * refactor(schemas/parseConvo): add handling of secondaryModels to use first of defined secondary models, which includes last selected one as first, or default to the convo's secondary model value * refactor: remove hooks from store and move to hooks refactor(switchToConversation): make switchToConversation use latest recoil state, which is necessary to get the most up-to-date models list, replace wrapper function refactor(getDefaultConversation): factor out logic into 3 pieces to reduce complexity. * fix: backend tests * feat: optimistic update by calling newConvo when models are fetched * feat: openrouter support for titling convos * feat: cache models fetch * chore: add missing dep to AuthContext useEffect * chore: fix useTimeout types * chore: delete old getDefaultConvo file * chore: remove newConvo logic from Root, remove console log from api models caching * chore: ensure bun is used for building in b:client script * fix: default endpoint will not default to null on a completely fresh login (no localStorage/cookies) * chore: add openrouter docs to free_ai_apis.md and .env.example * chore: remove openrouter console logs * feat: add debugging env variable for Plugins
71 lines
2.9 KiB
TypeScript
71 lines
2.9 KiB
TypeScript
import { clsx } from 'clsx';
|
|
import { twMerge } from 'tailwind-merge';
|
|
|
|
export * from './languages';
|
|
export { default as buildTree } from './buildTree';
|
|
export { default as getLoginError } from './getLoginError';
|
|
export { default as cleanupPreset } from './cleanupPreset';
|
|
export { default as validateIframe } from './validateIframe';
|
|
export { default as getMessageError } from './getMessageError';
|
|
export { default as buildDefaultConvo } from './buildDefaultConvo';
|
|
export { default as getDefaultEndpoint } from './getDefaultEndpoint';
|
|
export { default as getLocalStorageItems } from './getLocalStorageItems';
|
|
|
|
export function cn(...inputs: string[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
export const languages = [
|
|
'java',
|
|
'c',
|
|
'markdown',
|
|
'css',
|
|
'html',
|
|
'xml',
|
|
'bash',
|
|
'json',
|
|
'yaml',
|
|
'jsx',
|
|
'python',
|
|
'c++',
|
|
'javascript',
|
|
'csharp',
|
|
'php',
|
|
'typescript',
|
|
'swift',
|
|
'objectivec',
|
|
'sql',
|
|
'r',
|
|
'kotlin',
|
|
'ruby',
|
|
'go',
|
|
'x86asm',
|
|
'matlab',
|
|
'perl',
|
|
'pascal',
|
|
];
|
|
|
|
export const alternateName = {
|
|
openAI: 'OpenAI',
|
|
azureOpenAI: 'Azure OpenAI',
|
|
bingAI: 'Bing',
|
|
chatGPTBrowser: 'ChatGPT',
|
|
gptPlugins: 'Plugins',
|
|
google: 'PaLM',
|
|
anthropic: 'Anthropic',
|
|
};
|
|
|
|
export const removeFocusOutlines =
|
|
'focus:outline-none focus:ring-0 focus:ring-opacity-0 focus:ring-offset-0';
|
|
|
|
export const cardStyle =
|
|
'transition-colors rounded-md min-w-[75px] border font-normal bg-white hover:bg-slate-50 dark:border-gray-600 dark:hover:bg-gray-700 dark:bg-gray-800 text-black dark:text-gray-600 focus:outline-none data-[state=open]:bg-slate-50 dark:data-[state=open]:bg-gray-700';
|
|
|
|
export const defaultTextProps =
|
|
'rounded-md border border-gray-200 focus:border-slate-400 focus:bg-gray-50 bg-transparent text-sm shadow-[0_0_10px_rgba(0,0,0,0.05)] outline-none placeholder:text-gray-400 focus:outline-none focus:ring-gray-400 focus:ring-opacity-20 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-500 dark:bg-gray-700 focus:dark:bg-gray-600 dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)] dark:focus:border-gray-400 dark:focus:outline-none dark:focus:ring-0 dark:focus:ring-gray-400 dark:focus:ring-offset-0';
|
|
|
|
export const optionText =
|
|
'p-0 shadow-none text-right pr-1 h-8 border-transparent focus:ring-[#10a37f] focus:ring-offset-0 focus:ring-opacity-100 hover:bg-gray-800/10 dark:hover:bg-white/10 focus:bg-gray-800/10 dark:focus:bg-white/10 transition-colors';
|
|
|
|
export const defaultTextPropsLabel =
|
|
'rounded-md border border-gray-300 bg-transparent text-sm shadow-[0_0_10px_rgba(0,0,0,0.10)] outline-none placeholder:text-gray-400 focus:outline-none focus:ring-gray-400 focus:ring-opacity-20 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-400 dark:bg-gray-700 dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)] dark:focus:border-gray-400 dark:focus:outline-none dark:focus:ring-0 dark:focus:ring-gray-400 dark:focus:ring-offset-0';
|