Code clean-up

This commit is contained in:
Cohee1207 2023-08-19 18:52:06 +03:00
parent e77cded357
commit 2cd2318298
1 changed files with 4 additions and 4 deletions

View File

@ -633,7 +633,7 @@ app.post("/generate_textgenerationwebui", jsonParser, async function (request, r
resolve(data, isBinary); resolve(data, isBinary);
}); });
}); });
} catch(err) { } catch (err) {
console.error("Socket error:", err); console.error("Socket error:", err);
websocket.close(); websocket.close();
yield "[SillyTavern] Streaming failed:\n" + err; yield "[SillyTavern] Streaming failed:\n" + err;
@ -3582,7 +3582,7 @@ async function sendAI21Request(request, response) {
}) })
.catch(err => { .catch(err => {
console.error(err) console.error(err)
return response.send({error: true}) return response.send({ error: true })
}); });
} }
@ -3597,12 +3597,12 @@ app.post("/tokenize_ai21", jsonParser, function (request, response_tokenize_ai21
'content-type': 'application/json', 'content-type': 'application/json',
Authorization: `Bearer ${readSecret(SECRET_KEYS.AI21)}` Authorization: `Bearer ${readSecret(SECRET_KEYS.AI21)}`
}, },
body: JSON.stringify({text: request.body[0].content}) body: JSON.stringify({ text: request.body[0].content })
}; };
fetch('https://api.ai21.com/studio/v1/tokenize', options) fetch('https://api.ai21.com/studio/v1/tokenize', options)
.then(response => response.json()) .then(response => response.json())
.then(response => response_tokenize_ai21.send({"token_count": response.tokens.length})) .then(response => response_tokenize_ai21.send({ "token_count": response.tokens.length }))
.catch(err => console.error(err)); .catch(err => console.error(err));
}); });