Intermediate
Say How the Answer Ended
Two buttons ask Mitra a question: #short and #long. The route answers in the usual JSON chat shape. Show the reply text in #answer.
If choices[0].finish_reason is "length", the reply was cut off: show Cut off: Mitra ran out of room. in #note. For a normal finish leave #note empty (and clear it when a new question is asked).
What Check tests
- A normal answer shows its text and leaves
#noteempty - A cut-off answer shows its text and
Cut off: Mitra ran out of room.in#note - Asking a normal question afterwards clears the note
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.