Command Palette

Search for a command to run...

Hectal
Phase 10: AI Product UX
AI Frontend · Exercise 1 of 5Next
Beginner

A Starter That Sends Once

The page shows two starter buttons inside #starters. Each button carries its question in data-prompt. When a starter is clicked, send that question to /api/ask with POST and a JSON body { "question": … }, read the streamed reply and add each piece to #answer.

Then hide the whole #starters list (set its hidden property to true). Two clicks in the same instant must reach the server only once.

What Check tests

  1. Before any click, #answer is empty and #starters is visible
  2. Two quick clicks on a starter send the question to the server exactly once
  3. #answer shows the whole reply
  4. #starters is hidden after a starter was used
  5. The other starter does not send a second question

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.