feat: add request logging to AI proxy routes

- Log session ID, model, pool size, and active session count on every
  POST /v1/chat/completions and POST /v1/messages

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-17 04:30:07 +07:00
co-authored by Claude
parent 45f1b33fb6
commit 9c2f0a65f0
+2
View File
@@ -490,6 +490,7 @@ const server: Server<WSRelayData> = Bun.serve<WSRelayData>({
try {
const body = await req.json();
const sessionId = crypto.randomUUID();
console.log(`[index] POST /v1/chat/completions session=${sessionId.slice(0, 8)} model=${(body as any).model} poolSize=${proxyPool.size} sessionPool.active=${sessionPool.activeSessions}`);
return handleChatCompletion(body, proxyPool, sessionPool, sessionId);
} catch {
return new Response(
@@ -512,6 +513,7 @@ const server: Server<WSRelayData> = Bun.serve<WSRelayData>({
try {
const body = await req.json();
const sessionId = crypto.randomUUID();
console.log(`[index] POST /v1/messages session=${sessionId.slice(0, 8)} model=${(body as any).model} poolSize=${proxyPool.size} sessionPool.active=${sessionPool.activeSessions}`);
return handleAnthropicMessages(body, proxyPool, sessionPool, sessionId);
} catch {
return new Response(