问题描述
- Azure模型gpt4与gpt4o模型无法切换。
gpt4模型:不知道cnlunar项目。
gpt4o模型:指导cnlunar项目。
解决问题方案:
在app/common.ts文件中。
const clonedBody = await req.text();
const fetchOptions: RequestInit = {
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store",
"model": JSON.parse(clonedBody).model,
[authHeaderName]: authValue,
...(serverConfig.openaiOrgId && {
"OpenAI-Organization": serverConfig.openaiOrgId,
}),
},
method: req.method,
body: req.body,
// to fix #2485: https://stackoverflow.com/questions/55920957/cloudflare-worker-typeerror-one-time-use-body
redirect: "manual",
// @ts-ignore
duplex: "half",
signal: controller.signal,
};
fetchOptions.body = clonedBody;
if (serverConfig.customModels && clonedBody) {
解决问题的过程:
发现Azure官网的restful api请求采用的是请求头header中加入model模型进行切换的,更多信息请去Azure官网查看。