Intermediate
Show the Wait
The route /api/chat answers { text }, except for a question that contains the word limit: then it answers 429 with a retry-after header of 90 seconds. Clicking #send posts the text of #prompt as { question } and shows text in #answer. That part works.
Handle the 429. Show Daily limit reached. Try again in 2 minutes. in #error (the wait in whole minutes, rounded up) and disable #send.
What Check tests
- A normal question shows the answer
- A 429 shows the wait in minutes in
#error - After the 429 the Send button is disabled
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.