Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -58,7 +58,6 @@ var RedisClient = class {
|
|
| 58 |
constructor() {
|
| 59 |
this.url = CONFIG.API.RedisUrl;
|
| 60 |
this.token = CONFIG.API.RedisToken;
|
| 61 |
-
console.log(this.url, this.token);
|
| 62 |
}
|
| 63 |
async get(key) {
|
| 64 |
const response = await fetch(`${this.url}/get/${key}`, {
|
|
@@ -109,13 +108,11 @@ class TokenManager {
|
|
| 109 |
if (wafToken) {
|
| 110 |
Tokens[currentIndex].aws_waf_token = wafToken;
|
| 111 |
await this.updateCacheTokens();
|
| 112 |
-
console.log("更新后的token",JSON.stringify(Tokens[currentIndex],null,2));
|
| 113 |
this.updateRedisTokens();
|
| 114 |
-
console.log("更新成功",)
|
| 115 |
return;
|
| 116 |
} else {
|
| 117 |
-
console.log("提取aws-waf-token失败");
|
| 118 |
currentIndex = (currentIndex + 1) % Tokens.length;
|
|
|
|
| 119 |
}
|
| 120 |
}else{
|
| 121 |
const newCsrfToken = response.headers.get('anti-csrftoken-a2z');
|
|
@@ -280,15 +277,12 @@ async function initializeService() {
|
|
| 280 |
index++;
|
| 281 |
}
|
| 282 |
console.log('服务初始化完毕');
|
| 283 |
-
console.log(JSON.stringify(Tokens[0],null,2));
|
| 284 |
-
|
| 285 |
}
|
| 286 |
|
| 287 |
await initializeService();
|
| 288 |
|
| 289 |
class ApiClient {
|
| 290 |
constructor(modelId) {
|
| 291 |
-
console.log(modelId);
|
| 292 |
if (!CONFIG.MODELS[modelId]) {
|
| 293 |
throw new Error(`不支持的模型: ${modelId}`);
|
| 294 |
}
|
|
@@ -352,7 +346,7 @@ class ApiClient {
|
|
| 352 |
temperature = 1;
|
| 353 |
}
|
| 354 |
const extractPartyRockId = url => url.match(/https:\/\/partyrock\.aws\/u\/[^/]+\/([^/]+)/)?.[1];
|
| 355 |
-
console.log(CONFIG.DEFAULT_HEADERS.referer);
|
| 356 |
|
| 357 |
const requestPayload = {
|
| 358 |
"messages": mergedMessages,
|
|
|
|
| 58 |
constructor() {
|
| 59 |
this.url = CONFIG.API.RedisUrl;
|
| 60 |
this.token = CONFIG.API.RedisToken;
|
|
|
|
| 61 |
}
|
| 62 |
async get(key) {
|
| 63 |
const response = await fetch(`${this.url}/get/${key}`, {
|
|
|
|
| 108 |
if (wafToken) {
|
| 109 |
Tokens[currentIndex].aws_waf_token = wafToken;
|
| 110 |
await this.updateCacheTokens();
|
|
|
|
| 111 |
this.updateRedisTokens();
|
|
|
|
| 112 |
return;
|
| 113 |
} else {
|
|
|
|
| 114 |
currentIndex = (currentIndex + 1) % Tokens.length;
|
| 115 |
+
await this.updateCacheTokens();
|
| 116 |
}
|
| 117 |
}else{
|
| 118 |
const newCsrfToken = response.headers.get('anti-csrftoken-a2z');
|
|
|
|
| 277 |
index++;
|
| 278 |
}
|
| 279 |
console.log('服务初始化完毕');
|
|
|
|
|
|
|
| 280 |
}
|
| 281 |
|
| 282 |
await initializeService();
|
| 283 |
|
| 284 |
class ApiClient {
|
| 285 |
constructor(modelId) {
|
|
|
|
| 286 |
if (!CONFIG.MODELS[modelId]) {
|
| 287 |
throw new Error(`不支持的模型: ${modelId}`);
|
| 288 |
}
|
|
|
|
| 346 |
temperature = 1;
|
| 347 |
}
|
| 348 |
const extractPartyRockId = url => url.match(/https:\/\/partyrock\.aws\/u\/[^/]+\/([^/]+)/)?.[1];
|
| 349 |
+
console.log("当前请求的是",CONFIG.DEFAULT_HEADERS.referer);
|
| 350 |
|
| 351 |
const requestPayload = {
|
| 352 |
"messages": mergedMessages,
|