yxmiler commited on
Commit
bf2ced1
·
verified ·
1 Parent(s): cdaad0d

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +16 -20
index.js CHANGED
@@ -53,21 +53,20 @@ puppeteer.use(StealthPlugin())
53
 
54
  // 请求头配置
55
  const DEFAULT_HEADERS = {
56
- 'accept': '*/*',
57
- 'accept-language': 'zh-CN,zh;q=0.9',
58
- 'accept-encoding': 'gzip, deflate, br, zstd',
59
- 'content-type': 'text/plain;charset=UTF-8',
60
  'Connection': 'keep-alive',
61
- 'origin': 'https://grok.com',
62
- 'priority': 'u=1, i',
63
- 'sec-ch-ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
64
- 'sec-ch-ua-mobile': '?0',
65
- 'sec-ch-ua-platform': '"Windows"',
66
- 'sec-fetch-dest': 'empty',
67
- 'sec-fetch-mode': 'cors',
68
- 'sec-fetch-site': 'same-origin',
69
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
70
- 'baggage': 'sentry-public_key=b311e0f2690c81f25e2c4cf6d4f7ce1c'
71
  };
72
 
73
 
@@ -95,7 +94,7 @@ async function initialization() {
95
  );
96
 
97
  await Promise.all(batchPromises);
98
- Logger.info(`已加载令牌: ${i} 个`, 'Server');
99
  await new Promise(resolve => setTimeout(resolve, 1000));
100
  }
101
  Logger.info(`令牌加载完成: ${JSON.stringify(tokenManager.getAllTokens(), null, 2)}`, 'Server');
@@ -1203,11 +1202,8 @@ app.post('/hf/v1/chat/completions', async (req, res) => {
1203
  const response = await fetch(`${CONFIG.API.BASE_URL}/rest/app-chat/conversations/new`, {
1204
  method: 'POST',
1205
  headers: {
1206
- "accept": "text/event-stream",
1207
- "baggage": "sentry-public_key=b311e0f2690c81f25e2c4cf6d4f7ce1c",
1208
- "content-type": "text/plain;charset=UTF-8",
1209
- "Connection": "keep-alive",
1210
- "cookie": CONFIG.API.SIGNATURE_COOKIE
1211
  },
1212
  body: JSON.stringify(requestPayload)
1213
  });
 
53
 
54
  // 请求头配置
55
  const DEFAULT_HEADERS = {
56
+ 'Accept': '*/*',
57
+ 'Accept-Language': 'zh-CN,zh;q=0.9',
58
+ 'Accept-Encoding': 'gzip, deflate, br, zstd',
59
+ 'Content-Type': 'text/plain;charset=UTF-8',
60
  'Connection': 'keep-alive',
61
+ 'Origin': 'https://grok.com',
62
+ 'Priority': 'u=1, i',
63
+ 'Sec-Ch-Ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
64
+ 'Sec-Ch-Ua-Mobile': '?0',
65
+ 'Sec-Ch-Ua-Platform': '"Windows"',
66
+ 'Sec-Fetch-Dest': 'empty',
67
+ 'Sec-Fetch-Mode': 'cors',
68
+ 'Sec-Fetch-Site': 'same-origin',
69
+ 'Baggage': 'sentry-public_key=b311e0f2690c81f25e2c4cf6d4f7ce1c'
 
70
  };
71
 
72
 
 
94
  );
95
 
96
  await Promise.all(batchPromises);
97
+ Logger.info(`已加载令牌: ${i+1} 个`, 'Server');
98
  await new Promise(resolve => setTimeout(resolve, 1000));
99
  }
100
  Logger.info(`令牌加载完成: ${JSON.stringify(tokenManager.getAllTokens(), null, 2)}`, 'Server');
 
1202
  const response = await fetch(`${CONFIG.API.BASE_URL}/rest/app-chat/conversations/new`, {
1203
  method: 'POST',
1204
  headers: {
1205
+ ...DEFAULT_HEADERS,
1206
+ "Cookie": CONFIG.API.SIGNATURE_COOKIE
 
 
 
1207
  },
1208
  body: JSON.stringify(requestPayload)
1209
  });