Skip to content

Commit

Permalink
Update Nextway.js
Browse files Browse the repository at this point in the history
  • Loading branch information
zachey01 committed Jul 17, 2024
1 parent b7d9e97 commit d221ccb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/Providers/ChatCompletion/Nextway.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@ class NextwayProvider extends Provider {
async chatCompletion(messages, options) {
const proxyUrl = options.use_proxy
? "https://proxy.zachey.space/?url=https://chat.eqing.tech/api/openai/v1/chat/completions"
: "https://chat.eqing.tech/api/openai/v1/chat/completions";
: "https://origin.eqing.tech/api/openai/v1/chat/completions";

const response = await fetch(proxyUrl, {
headers: {
...baseHeaders("https://chat.eqing.tech"),
usesearch: options.webSearch,
...baseHeaders("https://origin.eqing.tech/"),
usesearch: "true",
},
body: JSON.stringify({
messages: messages,
stream: options.stream,
model: options.model || "gpt-4o-free",
temperature: options.temperature,
captchaToken:
"P1_" +
btoa(JSON.stringify({ typ: "JWT", alg: "HS256" })) +
"." +
btoa("hashedkey") +
"." +
btoa("signature"),
temperature: options.temperature || 0.5,
max_tokens: 4000 || options.maxTokens,
captchaToken: `P1_${[...Array(30)].map(() => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(Math.random() * 64))).join("")}.${[...Array(256)].map(() => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(Math.random() * 64))).join("")}.${[...Array(43)].map(() => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(Math.random() * 64))).join("")}`,
}),
method: "POST",
});
Expand Down

0 comments on commit d221ccb

Please sign in to comment.