Redirect to OpenAI site to view usage

This commit is contained in:
Cohee1207
2023-07-21 23:35:54 +03:00
parent 8d5fbbe2bc
commit f28e7cf47c
3 changed files with 7 additions and 24 deletions

View File

@ -2927,7 +2927,8 @@ app.post("/openai_bias", jsonParser, async function (request, response) {
return response.send(result);
});
// Shamelessly stolen from Agnai
// TODO: Dead code, consider deleting. Users will get redirected to OpenAI site instead.
// 'Your request to GET /v1/dashboard/billing/usage must be made with a session key (that is, it can only be made from the browser). You made it with the following key type: secret.'
app.post("/openai_usage", jsonParser, async function (request, response) {
if (!request.body) return response.sendStatus(400);
const key = readSecret(SECRET_KEYS.OPENAI);
@ -2958,7 +2959,8 @@ app.post("/openai_usage", jsonParser, async function (request, response) {
);
return response.send(res);
}
catch {
catch (error) {
console.log(error);
return response.sendStatus(400);
}
});