Alternative out of quota handling

This commit is contained in:
SillyLossy
2023-04-30 17:36:50 +03:00
parent c0f5057660
commit 2d624f90a6

View File

@ -2263,6 +2263,9 @@ app.post("/generate_openai", jsonParser, function (request, response_generate_op
} else if (response.status == 402) {
console.log('An active subscription is required to access this endpoint');
response_generate_openai.send({ error: true });
} else if (response.status == 429) {
console.log('Out of quota');
response_generate_openai.send({ error: true, quota_error: true, });
} else if (response.status == 500 || response.status == 409 || response.status == 504) {
if (request.body.stream) {
response.data.on('data', chunk => {