add detailed logging for custom API model fetching to debug blog site issue

This commit is contained in:
Russell Ballestrini 2025-07-11 01:05:35 -04:00
parent 0af7efc863
commit 02e614d733

View file

@ -34,11 +34,16 @@ export async function fetchModelsFromEndpoints() {
// Add custom API endpoint if configured
const apiConfig = await getAPIConfig();
if (apiConfig.isCustom) {
console.log("🔧 Adding custom API endpoint to model fetch:", apiConfig.endpoint);
endpointsToFetch.push({
id: apiConfig.endpoint,
url: apiConfig.endpoint
});
} else {
console.log("🏠 No custom API configured, using default endpoints only");
}
console.log("📡 Fetching models from endpoints:", endpointsToFetch.map(e => e.url));
// If no valid cache, fetch models from all endpoints
const fetchPromises = endpointsToFetch.map(async (endpoint) => {
@ -60,6 +65,7 @@ export async function fetchModelsFromEndpoints() {
const jsonResponse = await res.json();
// Expected JSON structure: { data: [ { id, ... }, ... ], object: "list" }
const models = jsonResponse.data || [];
console.log(`✅ Fetched ${models.length} models from ${endpoint.url}:`, models.map(m => m.id));
// Map each model to include its endpoint ID, unique ID, and model name
return models.map((model) => ({
...model,