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
- Right after the click,
#statussaysThinking…and#answeris still empty - While the answer is arriving,
#statussaysAnswering…and#answerholds part of the sentence - At the end,
#answerholds the full sentence and#statussaysDone
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.