debug: add detailed logging for Chutes API calls
- Log API key prefix to verify key is loaded - Log full error response from Chutes API - Log success count when models are fetched
This commit is contained in:
@@ -7997,17 +7997,31 @@ async function fetchNvidiaModels() {
|
||||
|
||||
// Fetch models from Chutes API when API key is configured
|
||||
async function fetchChutesModels() {
|
||||
if (!CHUTES_API_KEY) return [];
|
||||
if (!CHUTES_API_KEY) {
|
||||
log('Chutes API key not configured');
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
log('Fetching Chutes models', {
|
||||
url: `${CHUTES_API_URL}/models`,
|
||||
keyPrefix: CHUTES_API_KEY.substring(0, 8) + '...'
|
||||
});
|
||||
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 });
|
||||
const errorText = await res.text().catch(() => '');
|
||||
log('Chutes models fetch failed', {
|
||||
status: res.status,
|
||||
statusText: res.statusText,
|
||||
error: errorText.substring(0, 200),
|
||||
keyPrefix: CHUTES_API_KEY.substring(0, 8) + '...'
|
||||
});
|
||||
return [];
|
||||
}
|
||||
const data = await res.json();
|
||||
const models = Array.isArray(data?.data) ? data.data : [];
|
||||
log('Chutes models fetched successfully', { count: models.length });
|
||||
return models.map((m) => ({
|
||||
name: m.id || m.name,
|
||||
label: `${m.id || m.name} (Chutes)`,
|
||||
|
||||
Reference in New Issue
Block a user