You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/agent/guides/migrating.mdx
+65-38Lines changed: 65 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,11 @@ The legacy chat component took its backend wiring as a flat bag of props — `ap
7
7
8
8
The whole migration, in one idea: the flat backend props are **removed** (not deprecated), and their values move into `fetchLLM({ ... })` for the LLM and `restStorage({ ... })` for threads.
9
9
10
-
<Callouttype="info">Everything imports from `@openuidev/react-ui`: `AgentInterface`, the `fetchLLM` / `restStorage` / `defineArtifactRenderer` factories, the stream adapters, the message formats, and hooks like `useArtifactList`.</Callout>
10
+
<Callouttype="info">
11
+
Everything imports from `@openuidev/react-ui`: `AgentInterface`, the `fetchLLM` / `restStorage` /
12
+
`defineArtifactRenderer` factories, the stream adapters, the message formats, and hooks like
13
+
`useArtifactList`.
14
+
</Callout>
11
15
12
16
## The whole diff
13
17
@@ -22,13 +26,19 @@ If you were on the common setup — POST to a route, REST-backed threads — the
`restStorage` hits the exact endpoints the old `threadApiUrl` prop did — `GET {baseUrl}/get`, `POST {baseUrl}/create`, `GET {baseUrl}/get/{threadId}`, `PATCH {baseUrl}/update/{id}`, `DELETE {baseUrl}/delete/{id}` — so an existing backend keeps working. Pass `messageFormat` here too if your backend stores messages in a provider shape.
134
144
135
-
<Callouttype="info">If you pass no `storage` at all, `AgentInterface` uses an internal in-memory store — fine for prototyping, but wiped on reload.</Callout>
145
+
<Callouttype="info">
146
+
If you pass no `storage` at all, `AgentInterface` uses an internal in-memory store — fine for
147
+
prototyping, but wiped on reload.
148
+
</Callout>
136
149
137
150
### Custom thread callbacks → `storage.thread.*`
138
151
@@ -144,10 +157,10 @@ import { AgentInterface, type ChatStorage } from "@openuidev/react-ui";
144
157
const storage:ChatStorage= {
145
158
thread: {
146
159
listThreads: fetchThreadList, // now takes an optional cursor, returns { threads, nextCursor? }
147
-
createThread, // receives the first UserMessage, returns the new Thread
148
-
getMessages: loadThread, // was loadThread — takes threadId, returns Message[]
149
-
updateThread, // takes a full Thread, returns the updated Thread
150
-
deleteThread, // takes an id
160
+
createThread, // receives the first UserMessage, returns the new Thread
161
+
getMessages: loadThread, // was loadThread — takes threadId, returns Message[]
162
+
updateThread, // takes a full Thread, returns the updated Thread
163
+
deleteThread, // takes an id
151
164
},
152
165
};
153
166
@@ -164,13 +177,13 @@ The "app renderer" concept was renamed to **artifact renderer** throughout — t
@@ -185,7 +198,7 @@ The behavior changes inside the renderer:
185
198
186
199
-**`kind` → `type`.** A literal string that links the renderer to its stored artifacts' `type`.
187
200
-**`toolName` is now `string | string[]`.** Register one renderer for several tools by passing an array. Names are **literal only** — no RegExp. First registration wins on a duplicate `toolName`.
188
-
-**The parser returns `{ props, meta }` (or `null`), not props alone.**`meta` is `{ id, version, heading } | null`: return the object to render *and* register the artifact in the thread (so it appears in the Workspace rail and artifact lists); return `null` for `meta` to render without registering (the common move while streaming). Returning `null` from the parser entirely skips rendering.
201
+
-**The parser returns `{ props, meta }` (or `null`), not props alone.**`meta` is `{ id, version, heading } | null`: return the object to render _and_ register the artifact in the thread (so it appears in the Workspace rail and artifact lists); return `null` for `meta` to render without registering (the common move while streaming). Returning `null` from the parser entirely skips rendering.
189
202
-**The parser must tolerate partial data.** It's called on every stream update — `response` is `null` until the result lands, and `args` may be a partial JSON string. Guard accordingly.
The in-thread panel hooks that used to be named around "Artifact" are now named around **detailed view**: `useActiveDetailedView()`, `useDetailedView(viewId)`, `useDetailedViewStore()`, `useDetailedViewPortalTarget()`. If you reached into the old `Artifact*` panel hooks, swap to these.
203
216
204
-
<Callouttype="info">"Artifact" now consistently means the durable output (a dashboard, report, app); "detailed view" means the in-thread panel that shows one. The old "app" / "Artifact panel" naming conflated the two.</Callout>
217
+
<Callouttype="info">
218
+
"Artifact" now consistently means the durable output (a dashboard, report, app); "detailed view"
219
+
means the in-thread panel that shows one. The old "app" / "Artifact panel" naming conflated the
220
+
two.
221
+
</Callout>
205
222
206
223
## Migration checklist
207
224
@@ -217,9 +234,19 @@ The in-thread panel hooks that used to be named around "Artifact" are now named
217
234
## Related
218
235
219
236
<Cards>
220
-
<Cardtitle="AgentInterface props"href="/docs/agent/reference/agentinterface-props">The presentation props that stay flat on the component.</Card>
221
-
<Cardtitle="Adapters & formats"href="/docs/agent/reference/adapters-and-formats">Reference for `fetchLLM`, `restStorage`, stream adapters, and message formats.</Card>
222
-
<Cardtitle="defineArtifactRenderer"href="/docs/agent/reference/define-artifact-renderer">The renderer config, parser contract, and `meta` shape.</Card>
223
-
<Cardtitle="Conversations"href="/docs/agent/core-concepts/conversations">How `llm` and `storage` drive a thread end to end.</Card>
224
-
<Cardtitle="Hooks"href="/docs/agent/reference/hooks">`useArtifactList`, the `DetailedView*` hooks, and more.</Card>
0 commit comments