Skip to content

Commit

Permalink
[ChatGPT] Uses 429 status code when rate limited
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeyaworski committed Mar 9, 2024
1 parent ac234f7 commit 54856c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/routes/chatgpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ async function handleMessage({
});
return res.status(200).send(chatGptResponse);
} catch (err) {
return res.status(400).send(String(err));
const errStr = String(err);
const status = errStr.includes('rate limited') ? 429 : 400;
return res.status(status).send(errStr);
}
}

Expand Down

0 comments on commit 54856c7

Please sign in to comment.