Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -569,7 +569,7 @@ async function processModelResponse(linejosn, model) {
|
|
569 |
if (linejosn?.isThinking && !CONFIG.IS_THINKING) {
|
570 |
result.token = "<think>" + linejosn?.token;
|
571 |
CONFIG.IS_THINKING = true;
|
572 |
-
} else if (
|
573 |
result.token = "</think>" + linejosn?.token;
|
574 |
CONFIG.IS_THINKING = false;
|
575 |
} else {
|
@@ -607,6 +607,7 @@ async function handleResponse(response, model, res, isStream) {
|
|
607 |
if (!data.trim()) continue;
|
608 |
if (data === "[DONE]") continue;
|
609 |
const linejosn = JSON.parse(data);
|
|
|
610 |
if (linejosn?.error) {
|
611 |
Logger.error(JSON.stringify(linejosn, null, 2), 'Server');
|
612 |
stream.destroy();
|
@@ -830,7 +831,7 @@ app.post('/hf/v1/chat/completions', async (req, res) => {
|
|
830 |
throw new Error('无可用令牌');
|
831 |
}
|
832 |
Logger.info(`当前令牌索引: ${CONFIG.SSO_INDEX}`, 'Server');
|
833 |
-
Logger.info(`当前令牌: ${CONFIG.API.SIGNATURE_COOKIE}`, 'Server');
|
834 |
const newMessageReq = await fetch(`${CONFIG.API.BASE_URL}/api/rpc`, {
|
835 |
method: 'POST',
|
836 |
headers: {
|
|
|
569 |
if (linejosn?.isThinking && !CONFIG.IS_THINKING) {
|
570 |
result.token = "<think>" + linejosn?.token;
|
571 |
CONFIG.IS_THINKING = true;
|
572 |
+
} else if (!linejosn.isThinking && CONFIG.IS_THINKING) {
|
573 |
result.token = "</think>" + linejosn?.token;
|
574 |
CONFIG.IS_THINKING = false;
|
575 |
} else {
|
|
|
607 |
if (!data.trim()) continue;
|
608 |
if (data === "[DONE]") continue;
|
609 |
const linejosn = JSON.parse(data);
|
610 |
+
Logger.info(`当前数据: ${linejosn}`, 'Server');
|
611 |
if (linejosn?.error) {
|
612 |
Logger.error(JSON.stringify(linejosn, null, 2), 'Server');
|
613 |
stream.destroy();
|
|
|
831 |
throw new Error('无可用令牌');
|
832 |
}
|
833 |
Logger.info(`当前令牌索引: ${CONFIG.SSO_INDEX}`, 'Server');
|
834 |
+
Logger.info(`当前令牌: ${JSON.stringify(CONFIG.API.SIGNATURE_COOKIE,null,2)}`, 'Server');
|
835 |
const newMessageReq = await fetch(`${CONFIG.API.BASE_URL}/api/rpc`, {
|
836 |
method: 'POST',
|
837 |
headers: {
|