Update src/index.js
Browse files- src/index.js +0 -6
src/index.js
CHANGED
@@ -41,16 +41,10 @@ app.post('/hf/v1/chat/completions', async (req, res) => {
|
|
41 |
const hexData = await stringToHex(messages, model);
|
42 |
|
43 |
// 获取checksum,req header中传递优先,环境变量中的等级第二,最后随机生成
|
44 |
-
/*
|
45 |
const checksum =
|
46 |
req.headers['x-cursor-checksum'] ??
|
47 |
process.env['x-cursor-checksum'] ??
|
48 |
`zo${getRandomIDPro({ dictType: 'max', size: 6 })}${getRandomIDPro({ dictType: 'max', size: 64 })}/${getRandomIDPro({ dictType: 'max', size: 64 })}`;
|
49 |
-
*/
|
50 |
-
const checksum = `zo${getRandomIDPro({ dictType: 'max', size: 6 })}${getRandomIDPro({ dictType: 'max', size: 64 })}/${getRandomIDPro({ dictType: 'max', size: 64 })}`
|
51 |
-
?? process.env['x-cursor-checksum']
|
52 |
-
?? req.headers['x-cursor-checksum'];
|
53 |
-
console.log(checksum);
|
54 |
|
55 |
const response = await fetch('https://api2.cursor.sh/aiserver.v1.AiService/StreamChat', {
|
56 |
method: 'POST',
|
|
|
41 |
const hexData = await stringToHex(messages, model);
|
42 |
|
43 |
// 获取checksum,req header中传递优先,环境变量中的等级第二,最后随机生成
|
|
|
44 |
const checksum =
|
45 |
req.headers['x-cursor-checksum'] ??
|
46 |
process.env['x-cursor-checksum'] ??
|
47 |
`zo${getRandomIDPro({ dictType: 'max', size: 6 })}${getRandomIDPro({ dictType: 'max', size: 64 })}/${getRandomIDPro({ dictType: 'max', size: 64 })}`;
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
const response = await fetch('https://api2.cursor.sh/aiserver.v1.AiService/StreamChat', {
|
50 |
method: 'POST',
|