only enabled ai models in super admin
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
|||||||
SelectValue,
|
SelectValue,
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { useSettings } from 'state/useSettings';
|
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[]) {
|
function buildGroups(models: ModelOption[]) {
|
||||||
const groups: Record<string, { id: string; name: string }[]> = {};
|
const groups: Record<string, { id: string; name: string }[]> = {};
|
||||||
@@ -30,9 +30,11 @@ const NONE = '__none__';
|
|||||||
|
|
||||||
export const AIModels = () => {
|
export const AIModels = () => {
|
||||||
const { settings, saveSettings } = useSettings();
|
const { settings, saveSettings } = useSettings();
|
||||||
const piModels = useVisiblePiModels();
|
const piModels = useEnabledPiModels();
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
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 [chatModel, setChatModel] = useState<string | null>(settings.chat.defaultModel);
|
||||||
const [projectModel, setProjectModel] = useState<string | null>(settings.chat.defaultProjectModel);
|
const [projectModel, setProjectModel] = useState<string | null>(settings.chat.defaultProjectModel);
|
||||||
const [taskModel, setTaskModel] = useState<string | null>(settings.tasks.defaultModel);
|
const [taskModel, setTaskModel] = useState<string | null>(settings.tasks.defaultModel);
|
||||||
|
|||||||
@@ -42,12 +42,6 @@ export function ModelSelector({
|
|||||||
hasStarted,
|
hasStarted,
|
||||||
}: ModelSelectorProps) {
|
}: ModelSelectorProps) {
|
||||||
const providers = [...new Set(availableModels.map((m) => m.provider).filter(Boolean))] as string[];
|
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
|
// Determine which model to display: selectedModel takes precedence, then model (from server), then fallback
|
||||||
const displayModel = selectedModel || model;
|
const displayModel = selectedModel || model;
|
||||||
@@ -68,9 +62,7 @@ export function ModelSelector({
|
|||||||
const displayName = (provider: string) => {
|
const displayName = (provider: string) => {
|
||||||
// Handle local providers (officer-local-{uuid})
|
// Handle local providers (officer-local-{uuid})
|
||||||
if (provider.startsWith('officer-local-')) {
|
if (provider.startsWith('officer-local-')) {
|
||||||
const name = getProviderDisplayName(provider);
|
return getProviderDisplayName(provider);
|
||||||
console.log('[displayName] Local provider:', provider, '→', name);
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
return PROVIDER_DISPLAY[provider] ?? provider;
|
return PROVIDER_DISPLAY[provider] ?? provider;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user