Command Palette

Search for a command to run...

Hectal
Phase 13: Cost, Limits and Production
AI Frontend · Exercise 2 of 6 PreviousNext
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

  1. A normal question shows the answer
  2. A 429 shows the wait in minutes in #error
  3. 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.