add detailed logging for custom API model fetching to debug blog site issue
This commit is contained in:
parent
0af7efc863
commit
02e614d733
1 changed files with 6 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue