Changeset 0.4.3 (#32)
This commit is contained in:
@@ -16,13 +16,22 @@ async function fetchModels(showInModal = true) {
|
||||
let models = [];
|
||||
|
||||
if (Backend.isManaged) {
|
||||
// Managed mode: fetch from backend aggregated models endpoint
|
||||
const data = await Backend.listAllModels();
|
||||
// Managed mode: fetch admin-curated enabled models
|
||||
const data = await Backend.listEnabledModels();
|
||||
models = (data.models || []).map(m => ({
|
||||
id: m.id || m.name,
|
||||
owned_by: m.owned_by || m.provider || null,
|
||||
id: m.model_id || m.id,
|
||||
owned_by: m.provider_name || m.provider || null,
|
||||
config_id: m.config_id || null
|
||||
}));
|
||||
// Fallback: if no curated models, try raw aggregation
|
||||
if (models.length === 0) {
|
||||
const raw = await Backend.listAllModels();
|
||||
models = (raw.models || []).map(m => ({
|
||||
id: m.id || m.name,
|
||||
owned_by: m.owned_by || m.provider || null,
|
||||
config_id: m.config_id || null
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
// Unmanaged mode: direct provider call
|
||||
const endpoint = showInModal
|
||||
|
||||
Reference in New Issue
Block a user