Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -15,7 +15,7 @@ let currentIndex = 0;
|
|
| 15 |
let sessionId = null;
|
| 16 |
const CONFIG = {
|
| 17 |
API: {
|
| 18 |
-
BASE_URL: "https://partyrock.aws"
|
| 19 |
API_KEY: process.env.API_KEY || "sk-123456",//自定义你自己的认证密钥,记得修改
|
| 20 |
RedisUrl: process.env.RedisUrl,
|
| 21 |
RedisToken: process.env.RedisToken
|
|
@@ -35,8 +35,6 @@ const CONFIG = {
|
|
| 35 |
'mistral-large': 'bedrock-mistral.mistral-large-2407-v1-0'
|
| 36 |
},
|
| 37 |
DEFAULT_HEADERS: {
|
| 38 |
-
"Host":"partyrock.aws",
|
| 39 |
-
"reqable-id": "",
|
| 40 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
|
| 41 |
"Cache-Control": "no-cache, no-store",
|
| 42 |
"Connection": "keep-alive",
|
|
@@ -100,7 +98,6 @@ class TokenManager {
|
|
| 100 |
CONFIG.DEFAULT_HEADERS["anti-csrftoken-a2z"] = Tokens[currentIndex].anti_csrftoken_a2z;
|
| 101 |
CONFIG.DEFAULT_HEADERS.Cookie = `idToken=${Tokens[currentIndex].idToken}; pr_refresh_token=${Tokens[currentIndex].pr_refresh_token};aws-waf-token=${Tokens[currentIndex].aws_waf_token};cwr_s=${Tokens[currentIndex].cwr_s};cwr_u=${sessionId}`;
|
| 102 |
CONFIG.DEFAULT_HEADERS.referer = Tokens[currentIndex].refreshUrl;
|
| 103 |
-
CONFIG.DEFAULT_HEADERS["reqable-id"] = `reqable-id-${sessionId}`;
|
| 104 |
}
|
| 105 |
|
| 106 |
async updateTokens(response, isWaf = false) {
|
|
@@ -529,7 +526,7 @@ app.post('/hf/v1/chat/completions', async (req, res) => {
|
|
| 529 |
try {
|
| 530 |
console.log("开始请求");
|
| 531 |
//发送请求
|
| 532 |
-
var response = await fetch(
|
| 533 |
method: "POST",
|
| 534 |
headers: {
|
| 535 |
...CONFIG.DEFAULT_HEADERS
|
|
|
|
| 15 |
let sessionId = null;
|
| 16 |
const CONFIG = {
|
| 17 |
API: {
|
| 18 |
+
BASE_URL: process.env.DENO_URL || "https://partyrock.aws/stream/getCompletion",//如果需要多号循环,需要设置你自己的denourl
|
| 19 |
API_KEY: process.env.API_KEY || "sk-123456",//自定义你自己的认证密钥,记得修改
|
| 20 |
RedisUrl: process.env.RedisUrl,
|
| 21 |
RedisToken: process.env.RedisToken
|
|
|
|
| 35 |
'mistral-large': 'bedrock-mistral.mistral-large-2407-v1-0'
|
| 36 |
},
|
| 37 |
DEFAULT_HEADERS: {
|
|
|
|
|
|
|
| 38 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
|
| 39 |
"Cache-Control": "no-cache, no-store",
|
| 40 |
"Connection": "keep-alive",
|
|
|
|
| 98 |
CONFIG.DEFAULT_HEADERS["anti-csrftoken-a2z"] = Tokens[currentIndex].anti_csrftoken_a2z;
|
| 99 |
CONFIG.DEFAULT_HEADERS.Cookie = `idToken=${Tokens[currentIndex].idToken}; pr_refresh_token=${Tokens[currentIndex].pr_refresh_token};aws-waf-token=${Tokens[currentIndex].aws_waf_token};cwr_s=${Tokens[currentIndex].cwr_s};cwr_u=${sessionId}`;
|
| 100 |
CONFIG.DEFAULT_HEADERS.referer = Tokens[currentIndex].refreshUrl;
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
async updateTokens(response, isWaf = false) {
|
|
|
|
| 526 |
try {
|
| 527 |
console.log("开始请求");
|
| 528 |
//发送请求
|
| 529 |
+
var response = await fetch(`${CONFIG.API.DENO_URL}`, {
|
| 530 |
method: "POST",
|
| 531 |
headers: {
|
| 532 |
...CONFIG.DEFAULT_HEADERS
|