fix: show readable provider name in model-sync logs

Use connection.name instead of the raw provider node ID
(e.g. "BltCy API" instead of "openai-compatible-chat-09fdb807-...")
in call logs and scheduler console output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
R.D.
2026-03-24 21:40:13 -04:00
parent 5205f5f4b4
commit 03d97ba617
2 changed files with 8 additions and 3 deletions

View File

@@ -31,6 +31,9 @@ export async function POST(request: Request, { params }: { params: Promise<{ id:
return NextResponse.json({ error: "Connection not found" }, { status: 404 });
}
// Use a human-readable provider name for logs
const providerLabel = connection.name || connection.provider || "unknown";
// Fetch models from the existing /api/providers/[id]/models endpoint
const origin = new URL(request.url).origin;
const modelsUrl = `${origin}/api/providers/${id}/models`;
@@ -52,7 +55,7 @@ export async function POST(request: Request, { params }: { params: Promise<{ id:
path: `/api/providers/${id}/models`,
status: modelsRes.status,
model: "model-sync",
provider: connection.provider || "unknown",
provider: providerLabel,
connectionId: id,
duration,
error: modelsData.error || `HTTP ${modelsRes.status}`,
@@ -84,7 +87,7 @@ export async function POST(request: Request, { params }: { params: Promise<{ id:
path: `/api/providers/${id}/models`,
status: 200,
model: "model-sync",
provider: connection.provider || "unknown",
provider: providerLabel,
connectionId: id,
duration: Date.now() - start,
requestType: "model-sync",

View File

@@ -94,7 +94,9 @@ async function runSyncCycle(apiBaseUrl: string): Promise<void> {
console.log(`[ModelSync] Starting model sync cycle — ${connections.length} connection(s)`);
const results = await Promise.allSettled(
connections.map((conn) => syncConnectionModels(conn.id, conn.provider, apiBaseUrl))
connections.map((conn) =>
syncConnectionModels(conn.id, conn.name || conn.provider, apiBaseUrl)
)
);
const succeeded = results.filter((r) => r.status === "fulfilled" && r.value === true).length;