跳到正文
Vercel Blog(vercel.com)· Railly Hugo·· 4 小時前品質評分70

Chat SDK agents 透過 json-render 支援即時生成式 UI

Chat SDK agents can now stream generative UI with json-render

重點導讀

Chat SDK agents 現已支援透過 json-render 以即時串流方式渲染生成式 UI。

\n\n- 功能:Agent 以 JSON 規格描述 UI,json-render 轉成卡片,並透過各平臺 Adapter(Slack Block Kit、Teams Adaptive Cards)釋出。

AI 伴隨問答

自備 Key 深度分析

針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:

正文

You can now stream generative UI from your Chat SDK agent with json-render.

With a typed catalog of components, the agent writes a JSON spec that json-render converts into a Chat SDK card. Each adapter then posts the card in its platform’s native format, such as Block Kit on Slack and Adaptive Cards on Teams.

The catalog covers tables, charts, buttons, and more, so there’s no separate tool to build and maintain for each message shape.

Stream cards as the model writes

streamCard posts the card once its root element has content and updates the message as new elements stream in. Edits go out at most once every 500 ms by default, which matches Chat SDK’s streaming interval. Once the stream ends, the message shows the final, validated card.

Validate specs and enforce platform limits

toCard checks every element’s props against its component schema and throws CardSpecError for an invalid spec. Each problem gets its own readable issue, so you can send the list back to the model for a corrected spec.

Platforms cap what a single message can hold, and Chat SDK adapters degrade content past those caps. The Slack adapter, for example, turns a second table into a code block. Pass limits to reject those specs instead.

Read the documentation to get started, or try the playground.

Read more

來源: Vercel Blog (vercel.com)
開啟原文

讀者討論

理性交流 · 即時討論