Update common.ts

debug logger
This commit is contained in:
Richard C Lim 2025-02-02 18:35:32 -05:00 committed by GitHub
parent 97b6eaa38a
commit a4db5a9011
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,7 +26,21 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se
authValue = req.headers.get("Authorization") ?? "";
authHeaderName = "Authorization";
}
// Add debug logs
console.log("[Auth Header Name]", authHeaderName);
console.log("[Auth Value Present]", !!authValue);
const fetchOptions: RequestInit = {
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store",
[authHeaderName]: authValue, // Make sure this is being set
...(serverConfig.openaiOrgId && {
"OpenAI-Organization": serverConfig.openaiOrgId,
}),
},
let path = `${req.nextUrl.pathname}`.replaceAll("/api/openai/", "");
let baseUrl =
(isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL;
@ -198,3 +212,4 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se
clearTimeout(timeoutId);
}
}
console.log("[Request Headers]", fetchOptions.headers);