Skip to content

Commit

Permalink
g4t-18k
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyfabin committed Feb 29, 2024
1 parent ef45905 commit 9592ccd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
22 changes: 12 additions & 10 deletions app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,21 @@ export async function requestOpenai(req: NextRequest) {
console.log("[Model]:", "Use gpt-3.5-turbo model!");
} else {

if ((jsonBody?.model ?? "").includes("gpt-4-1106-preview")) {
// 默认gpt-4
fetchUrl = `${GPT4_URL}/${openaiPath}`;
jsonBody.model = "gpt-4-1106-preview";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use gpt-4-1106-preview-2 model!");
}


// 不联网版
if ((jsonBody?.model ?? "").includes("不联网")) {
fetchUrl = `${BING_URL}/${openaiPath}`;

jsonBody.model = "Balanced-offline";
jsonBody.model = "Balanced-18k-offline";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use 不联网 model!");
}
// g4t
if ((jsonBody?.model ?? "").includes("gpt-4")) {
fetchUrl = `${BING_URL}/${openaiPath}`;

jsonBody.model = "Precise-g4t-offline";
jsonBody.model = "Precise-g4t-18k";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use 不联网 model!");
}
Expand All @@ -159,10 +153,18 @@ export async function requestOpenai(req: NextRequest) {
// 联网版
if ((jsonBody?.model ?? "").includes("联网版")) {
fetchUrl = `${BING_URL}/${openaiPath}`;
jsonBody.model = "Creative";
jsonBody.model = "Creative-g4t-18k";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use 联网版 model!");
}

if ((jsonBody?.model ?? "").includes("gpt-4-1106-preview")) {
// 默认gpt-4
fetchUrl = `${GPT4_URL}/${openaiPath}`;
jsonBody.model = "gpt-4-1106-preview";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use gpt-4-1106-preview-2 model!");
}
}
} catch (e) {
console.error("[Check Model Error:]", e);
Expand Down
26 changes: 13 additions & 13 deletions app/api/dist/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,34 +162,34 @@ function requestOpenai(req) {
console.log("[Model]:", "Use gpt-3.5-turbo model!");
}
else {
if (((_d = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _d !== void 0 ? _d : "").includes("gpt-4-1106-preview")) {
// 默认gpt-4
fetchUrl = GPT4_URL + "/" + openaiPath;
jsonBody.model = "gpt-4-1106-preview";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use gpt-4-1106-preview-2 model!");
}
// 不联网版
if (((_e = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _e !== void 0 ? _e : "").includes("不联网")) {
if (((_d = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _d !== void 0 ? _d : "").includes("不联网")) {
fetchUrl = BING_URL + "/" + openaiPath;
jsonBody.model = "Balanced-offline";
jsonBody.model = "Balanced-18k-offline";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use 不联网 model!");
}
// g4t
if (((_f = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _f !== void 0 ? _f : "").includes("gpt-4")) {
if (((_e = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _e !== void 0 ? _e : "").includes("gpt-4")) {
fetchUrl = BING_URL + "/" + openaiPath;
jsonBody.model = "Precise-g4t-offline";
jsonBody.model = "Precise-g4t-18k";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use 不联网 model!");
}
// 联网版
if (((_g = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _g !== void 0 ? _g : "").includes("联网版")) {
if (((_f = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _f !== void 0 ? _f : "").includes("联网版")) {
fetchUrl = BING_URL + "/" + openaiPath;
jsonBody.model = "Creative";
jsonBody.model = "Creative-g4t-18k";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use 联网版 model!");
}
if (((_g = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.model) !== null && _g !== void 0 ? _g : "").includes("gpt-4-1106-preview")) {
// 默认gpt-4
fetchUrl = GPT4_URL + "/" + openaiPath;
jsonBody.model = "gpt-4-1106-preview";
fetchOptions.body = JSON.stringify(jsonBody);
console.log("[Model]:", "Use gpt-4-1106-preview-2 model!");
}
}
return [3 /*break*/, 8];
case 7:
Expand Down

0 comments on commit 9592ccd

Please sign in to comment.