Command Palette

Search for a command to run...

Hectal
Phase 8: Tools and Human Approval
AI Frontend · Exercise 1 of 5Next
Intermediate

Show the Tool at Work

The route /api/chat has one tool, lookupOrder, which takes about a third of a second. The page already has a button #ask and a paragraph #tool, and it already finds the tool part in part.

Fill #tool from the part's state. While the tool is running (input-available) it must say Looking up your order…. When the result is there (output-available) it must say ORD-1042: Masala chai 250 g, shipped. Never read part.output before it exists.

What Check tests

  1. Before the click, #tool is empty
  2. While the tool runs, #tool says Looking up your order…
  3. When the tool is done, #tool shows the order
  4. The code switches on the part's state

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.