⚙️ feat: add conditional visibility for model selector based on startup config (#10729)

This commit is contained in:
Marco Beretta 2025-12-01 18:03:03 +01:00 committed by Danny Avila
parent f856da8391
commit 9df4d272e1
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
2 changed files with 34 additions and 3 deletions

View file

@ -1,14 +1,15 @@
import React, { useMemo } from 'react';
import { TooltipAnchor } from '@librechat/client';
import { getConfigDefaults } from 'librechat-data-provider';
import type { ModelSelectorProps } from '~/common';
import { ModelSelectorProvider, useModelSelectorContext } from './ModelSelectorContext';
import { ModelSelectorChatProvider } from './ModelSelectorChatContext';
import {
renderModelSpecs,
renderEndpoints,
renderSearchResults,
renderCustomGroups,
} from './components';
import { ModelSelectorProvider, useModelSelectorContext } from './ModelSelectorContext';
import { ModelSelectorChatProvider } from './ModelSelectorChatContext';
import { getSelectedIcon, getDisplayValue } from './utils';
import { CustomMenu as Menu } from './CustomMenu';
import DialogManager from './DialogManager';
@ -122,6 +123,14 @@ function ModelSelectorContent() {
}
export default function ModelSelector({ startupConfig }: ModelSelectorProps) {
const interfaceConfig = startupConfig?.interface ?? getConfigDefaults().interface;
const modelSpecs = startupConfig?.modelSpecs?.list ?? [];
// Hide the selector when modelSelect is false and there are no model specs to show
if (interfaceConfig.modelSelect === false && modelSpecs.length === 0) {
return null;
}
return (
<ModelSelectorChatProvider>
<ModelSelectorProvider startupConfig={startupConfig}>