Update common.ts

This commit is contained in:
Richard C Lim 2025-02-02 18:39:04 -05:00 committed by GitHub
parent a4db5a9011
commit f55a173cc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,16 +31,6 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se
console.log("[Auth Header Name]", authHeaderName); console.log("[Auth Header Name]", authHeaderName);
console.log("[Auth Value Present]", !!authValue); 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 path = `${req.nextUrl.pathname}`.replaceAll("/api/openai/", "");
let baseUrl = let baseUrl =
(isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL; (isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL;
@ -135,7 +125,7 @@ const fetchOptions: RequestInit = {
duplex: "half", duplex: "half",
signal: controller.signal, signal: controller.signal,
}; };
console.log("[Request Headers]", fetchOptions.headers);
// #1815 try to refuse gpt4 request // #1815 try to refuse gpt4 request
if (serverConfig.customModels && req.body) { if (serverConfig.customModels && req.body) {
try { try {
@ -212,4 +202,3 @@ const fetchOptions: RequestInit = {
clearTimeout(timeoutId); clearTimeout(timeoutId);
} }
} }
console.log("[Request Headers]", fetchOptions.headers);