Dayward AIWeChat Mini Program
Frontend Agent UX in 7 Days: From Streaming to Generative UI
Week 1 · D4🔒 LockedAbout 4 hours

Reasoning and Shared State: a Collapsible Thinking Panel and Incremental Sync

First render the model's reasoning as a collapsed-by-default panel, then introduce what really separates an agent frontend from a chat interface: a state shared with the backend, seeded by full snapshots and updated by JSON Patch, so the interface can show progress that lives outside the transcript.

Today's goals 0/3

Sign in to tick these off and save your progress.

Today's Goals

  1. Render reasoning events as a collapsible panel, and explain why reasoning must stay separate from the final answer
  2. Sync shared state with snapshots plus deltas, and say when each is the right choice
  3. Apply JSON Patch deltas, and recover when a patch does not match local state

Yesterday was about seeing what the agent intends to do. Today we go two steps further: seeing what it is thinking, and seeing the data in its hands. When you finish, scroll back up and tick the three goals off.

Plain-Language Walkthrough

The interpreter's scratch pad: worth showing, but not on the big screen

Every good simultaneous interpreter keeps a scratch pad: numbers caught on the fly, a term jotted down, half a sentence they have not settled on. That pad has value to the audience — if the interpreter stalls, a glance at it tells you which word they are stuck on rather than leaving you to wonder whether the equipment broke.

But no conference projects the scratch pad onto the main screen. It is full of crossings-out, false starts, and rejected translations. An audience staring at it would be misled by the working-out, mistaking struck-through attempts for the actual translation.

Reasoning is that scratch pad: worth offering, but offered carefully.

All three design decisions in this section follow from that: collapsed by default, a live indicator while streaming, and clear visual separation from the final answer.

Sign in and link WeChat to read

Sign in, then link your WeChat mini program account on the account page. Linked accounts share one free article per day. Unlock additional articles with rewarded videos in the mini program.

Mini program QR code

Scan in WeChat to open Dayward AI. Open the same course and chapter, choose the rewarded video, then refresh this page after completion.

Interview questions

  • Should the model's reasoning be shown to users? Collapsed or expanded by default? Justify your choice.模型的推理过程要不要展示给用户?默认收起还是默认展开?说出你的理由。
    Common in ChinaCommon overseasIntermediate#reasoning-ui#ux#protocol-design

    🔒 Unlock this chapter to see the answer keys.

  • Shared state can be sent as full snapshots or as incremental patches. How do you decide which?共享状态既可以每次发完整快照,也可以发增量补丁,你怎么决定用哪种?
    Common in ChinaCommon overseasIntermediate#state-sync#protocol-design#architecture

    🔒 Unlock this chapter to see the answer keys.

  • Your frontend receives a JSON Patch that cannot be applied. What does that tell you, and how do you recover?前端收到一个打不上的 JSON Patch,说明发生了什么?你的恢复策略是什么?
    Common in ChinaCommon overseasDeep dive#state-sync#error-handling#json-patch

    🔒 Unlock this chapter to see the answer keys.

  • What belongs in a shared state panel versus in the conversation itself?什么样的信息该放进共享状态面板,什么样的该留在对话里?
    Common in ChinaCommon overseasIntermediate#information-architecture#ux#agent-ui

    🔒 Unlock this chapter to see the answer keys.

Comments