only enabled ai models in super admin

This commit is contained in:
2026-02-23 08:14:20 +00:00
parent d9b69c8209
commit e25f685b70
2 changed files with 5 additions and 11 deletions
@@ -12,7 +12,7 @@ import {
SelectValue,
} from '@/components/ui/select';
import { useSettings } from 'state/useSettings';
import { useVisiblePiModels, getProviderDisplayName, type ModelOption } from 'state/useModels';
import { useEnabledPiModels, getProviderDisplayName, type ModelOption } from 'state/useModels';
function buildGroups(models: ModelOption[]) {
const groups: Record<string, { id: string; name: string }[]> = {};
@@ -30,9 +30,11 @@ const NONE = '__none__';
export const AIModels = () => {
const { settings, saveSettings } = useSettings();
const piModels = useVisiblePiModels();
const piModels = useEnabledPiModels();
const [isSaving, setIsSaving] = useState(false);
console.log('[AIModels] enabledModels:', settings.ai?.enabledModels?.length, 'filtered:', piModels.length);
const [chatModel, setChatModel] = useState<string | null>(settings.chat.defaultModel);
const [projectModel, setProjectModel] = useState<string | null>(settings.chat.defaultProjectModel);
const [taskModel, setTaskModel] = useState<string | null>(settings.tasks.defaultModel);
@@ -42,12 +42,6 @@ export function ModelSelector({
hasStarted,
}: ModelSelectorProps) {
const providers = [...new Set(availableModels.map((m) => m.provider).filter(Boolean))] as string[];
console.log('[ModelSelector]', {
availableModelsCount: availableModels.length,
providers,
models: availableModels.map(m => ({ id: m.id, provider: m.provider, name: m.name }))
});
// Determine which model to display: selectedModel takes precedence, then model (from server), then fallback
const displayModel = selectedModel || model;
@@ -68,9 +62,7 @@ export function ModelSelector({
const displayName = (provider: string) => {
// Handle local providers (officer-local-{uuid})
if (provider.startsWith('officer-local-')) {
const name = getProviderDisplayName(provider);
console.log('[displayName] Local provider:', provider, '→', name);
return name;
return getProviderDisplayName(provider);
}
return PROVIDER_DISPLAY[provider] ?? provider;
};