Command Palette

Search for a command to run...

Hectal
Phase 0: Start Here: AI Features Through a Frontend Developer's Eyes
AI Frontend · Exercise 2 of 5 PreviousNext
Beginner

Stream Into the Page

The route /api/ask streams its answer piece by piece. When #ask is clicked, read the stream and add each piece to #answer as it arrives.

Show the stage in #status: Thinking… from the click until the first piece, Answering… while pieces arrive, and Done when the stream ends.

What Check tests

  1. Right after the click, #status says Thinking… and #answer is still empty
  2. While the answer is arriving, #status says Answering… and #answer holds part of the sentence
  3. At the end, #answer holds the full sentence and #status says Done

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.