Command Palette

Search for a command to run...

Hectal
Phase 15: Interviews and Capstone
AI Frontend · Exercise 6 of 6 Previous
Advanced

Build Mitra's Core

A capstone-sized build. The server is ready: /api/chat streams answers with streamText, has a tool lookupOrder, and refuses the fourth question with a 429 (retry-after: 3600). You write the whole page.

Requirements: a list #messages with one <li> per message; a text box #prompt and a button #send (disabled while empty or while Mitra is working); a button #stop that exists only while Mitra is working and keeps the partial answer; #status showing the useChat status; a lookup result drawn as <p class="card">ORD-1042 · Masala chai 250 g · shipped</p> (validate the tool output with zod before drawing it); and at the limit #error saying You have used all 3 questions for today. Try again in 1 hour. with the box locked.

What Check tests

  1. The page starts with an empty list, #status ready and Send disabled
  2. A question gets a streamed answer in #messages (two items)
  3. A lookup shows the card ORD-1042 · Masala chai 250 g · shipped
  4. #stop exists while Mitra works, and stopping keeps the partial answer
  5. The fourth question shows the limit message in #error and locks the box

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.