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
|
// Fetch models from Chutes API when API key is configured
|
||||||
async function fetchChutesModels() {
|
async function fetchChutesModels() {
|
||||||
if (!CHUTES_API_KEY) return [];
|
if (!CHUTES_API_KEY) {
|
||||||
|
log('Chutes API key not configured');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
try {
|
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`, {
|
const res = await fetch(`${CHUTES_API_URL}/models`, {
|
||||||
headers: { 'Authorization': `Bearer ${CHUTES_API_KEY}` }
|
headers: { 'Authorization': `Bearer ${CHUTES_API_KEY}` }
|
||||||
});
|
});
|
||||||
if (!res.ok) {
|
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 [];
|
return [];
|
||||||
}
|
}
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const models = Array.isArray(data?.data) ? data.data : [];
|
const models = Array.isArray(data?.data) ? data.data : [];
|
||||||
|
log('Chutes models fetched successfully', { count: models.length });
|
||||||
return models.map((m) => ({
|
return models.map((m) => ({
|
||||||
name: m.id || m.name,
|
name: m.id || m.name,
|
||||||
label: `${m.id || m.name} (Chutes)`,
|
label: `${m.id || m.name} (Chutes)`,
|
||||||
|
|||||||
Reference in New Issue
Block a user