mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-23 22:20:23 +09:00
fix: #305
This commit is contained in:
parent
9227cb82d5
commit
ab7c13c59b
@ -95,12 +95,12 @@ export async function requestOpenai(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const contentType = req.headers.get("Content-Type") ?? "application/json";
|
||||||
const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}/${path}`);
|
const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}/${path}`);
|
||||||
console.log("fetchUrl", fetchUrl);
|
console.log("fetchUrl", fetchUrl);
|
||||||
const fetchOptions: RequestInit = {
|
const fetchOptions: RequestInit = {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": contentType,
|
||||||
"Cache-Control": "no-store",
|
"Cache-Control": "no-store",
|
||||||
[authHeaderName]: authValue,
|
[authHeaderName]: authValue,
|
||||||
...(serverConfig.openaiOrgId && {
|
...(serverConfig.openaiOrgId && {
|
||||||
@ -117,7 +117,7 @@ export async function requestOpenai(req: NextRequest) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// #1815 try to refuse gpt4 request
|
// #1815 try to refuse gpt4 request
|
||||||
if (serverConfig.customModels && req.body) {
|
if (serverConfig.customModels && req.body && contentType.includes("json")) {
|
||||||
try {
|
try {
|
||||||
const clonedBody = await req.text();
|
const clonedBody = await req.text();
|
||||||
fetchOptions.body = clonedBody;
|
fetchOptions.body = clonedBody;
|
||||||
|
@ -260,7 +260,7 @@ export function getHeaders(ignoreHeaders?: boolean) {
|
|||||||
: isAlibaba
|
: isAlibaba
|
||||||
? accessStore.alibabaApiKey
|
? accessStore.alibabaApiKey
|
||||||
: accessStore.openaiApiKey;
|
: accessStore.openaiApiKey;
|
||||||
if (accessStore.isUseOpenAIEndpointForAllModels) {
|
if (accessStore.isUseOpenAIEndpointForAllModels || ignoreHeaders) {
|
||||||
return {
|
return {
|
||||||
isGoogle: false,
|
isGoogle: false,
|
||||||
isAzure: false,
|
isAzure: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user