Fix Chutes models not loading in admin page - Add missing fetchChutesModels() function and include it in external provider fetches
This commit is contained in:
@@ -7755,6 +7755,30 @@ async function fetchNvidiaModels() {
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch models from Chutes API when API key is configured
|
||||
async function fetchChutesModels() {
|
||||
if (!CHUTES_API_KEY) return [];
|
||||
try {
|
||||
const res = await fetch(`${CHUTES_API_URL}/models`, {
|
||||
headers: { 'Authorization': `Bearer ${CHUTES_API_KEY}` }
|
||||
});
|
||||
if (!res.ok) {
|
||||
log('Chutes models fetch failed', { status: res.status });
|
||||
return [];
|
||||
}
|
||||
const data = await res.json();
|
||||
const models = Array.isArray(data?.data) ? data.data : [];
|
||||
return models.map((m) => ({
|
||||
name: m.id || m.name,
|
||||
label: `${m.id || m.name} (Chutes)`,
|
||||
provider: 'chutes'
|
||||
})).filter((m) => m.name);
|
||||
} catch (error) {
|
||||
log('Chutes models fetch error', { error: String(error) });
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function listModels(cliName = 'opencode') {
|
||||
const now = Date.now();
|
||||
const normalizedCli = normalizeCli(cliName);
|
||||
@@ -7841,7 +7865,8 @@ async function listModels(cliName = 'opencode') {
|
||||
fetchMistralModels(),
|
||||
fetchGroqModels(),
|
||||
fetchGoogleModels(),
|
||||
fetchNvidiaModels()
|
||||
fetchNvidiaModels(),
|
||||
fetchChutesModels()
|
||||
];
|
||||
|
||||
const externalResults = await Promise.allSettled(externalProviderFetches);
|
||||
|
||||
Reference in New Issue
Block a user