Command Palette

Search for a command to run...

Hectal
Phase 3: Stop, Retry and Failure
AI Frontend · Exercise 3 of 5 PreviousNext
Intermediate

Keep What Arrived

This route sends part of an answer and then the connection breaks. Right now the page throws the partial text away.

When #ask is clicked, show the pieces in #answer as they arrive. If the stream breaks, keep the text and show The answer was cut off. Please try again. in #error. If the stream completes normally, #error stays empty.

What Check tests

  1. After the first click, the partial text is still in #answer
  2. #error says The answer was cut off. Please try again.
  3. A second click gives the full answer and clears the error

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.