mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 07:12:12 +03:00
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:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user