mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-23 10:46:12 +01:00
* WIP: end session endpoint * refactor: move useGetBannerQuery outside of package * refactor: add queriesEnabled and move useGetEndpointsConfigQuery to data-provider (local) * refactor: move useGetEndpointsQuery import to data-provider * refactor: relocate useGetEndpointsQuery import to improve module organization * refactor: move `useGetStartupConfig` from package to `~/data-provider` * refactor: move useGetUserBalance to data-provider and update imports * refactor: update query enabled conditions to include config check * refactor: remove unused useConfigOverride import from useAppStartup * refactor: integrate queriesEnabled state into file and search queries and move useGetSearchEnabledQuery to data-provider (local) * refactor: move useGetUserQuery to data-provider and update imports * refactor: enhance loginUser mutation with success and error handling as pass in options to hook * refactor: update enabled condition in queries to handle undefined config * refactor: enhance authentication mutations with queriesEnabled state management * refactor: improve conditional rendering for error messages and feature flags in Login component * refactor: remove unused queriesEnabled state from AuthContextProvider * refactor: implement queriesEnabled state management in LoginLayout with timeout handling * refactor: add conditional check for end session endpoint in OpenID strategy * ci: fix tests after changes * refactor: remove endSessionEndpoint from user schema and update logoutController to use OpenID issuer's end_session_endpoint * refactor: update logoutController to use end_session_endpoint from issuer metadata
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import { useRecoilValue } from 'recoil';
|
|
import { SettingsViews, TConversation } from 'librechat-data-provider';
|
|
import { useGetModelsQuery } from 'librechat-data-provider/react-query';
|
|
import type { TSettingsProps } from '~/common';
|
|
import { useGetEndpointsQuery } from '~/data-provider';
|
|
import { cn, getEndpointField } from '~/utils';
|
|
import { getSettings } from './Settings';
|
|
import store from '~/store';
|
|
|
|
export default function Settings({
|
|
conversation,
|
|
setOption,
|
|
isPreset = false,
|
|
className = '',
|
|
}: TSettingsProps) {
|
|
const modelsQuery = useGetModelsQuery();
|
|
const { data: endpointsConfig } = useGetEndpointsQuery();
|
|
const currentSettingsView = useRecoilValue(store.currentSettingsView);
|
|
const endpointType = getEndpointField(endpointsConfig, conversation?.endpoint ?? '', 'type');
|
|
const endpoint = endpointType ?? conversation?.endpoint ?? '';
|
|
if (!endpoint || currentSettingsView !== SettingsViews.default) {
|
|
return null;
|
|
}
|
|
|
|
const { settings, multiViewSettings } = getSettings();
|
|
const { endpoint: _endpoint } = conversation as TConversation;
|
|
const models = modelsQuery.data?.[_endpoint ?? ''] ?? [];
|
|
const OptionComponent = settings[endpoint];
|
|
|
|
if (OptionComponent) {
|
|
return (
|
|
<div className={cn('h-[500px] overflow-y-auto md:mb-2 md:h-[350px]', className)}>
|
|
<OptionComponent
|
|
conversation={conversation}
|
|
setOption={setOption}
|
|
models={models}
|
|
isPreset={isPreset}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const MultiViewComponent = multiViewSettings[endpoint];
|
|
|
|
if (MultiViewComponent == null) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className={cn('hide-scrollbar h-[500px] overflow-y-auto md:mb-2 md:h-[350px]', className)}>
|
|
<MultiViewComponent conversation={conversation} models={models} isPreset={isPreset} />
|
|
</div>
|
|
);
|
|
}
|