@assistant-ui/mcp-docs-server 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/waterfall.md +3 -3
- package/.docs/organized/code-examples/with-a2a.md +5 -4
- package/.docs/organized/code-examples/with-ag-ui.md +7 -6
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +14 -13
- package/.docs/organized/code-examples/with-artifacts.md +12 -11
- package/.docs/organized/code-examples/with-assistant-transport.md +6 -5
- package/.docs/organized/code-examples/with-browser-extension.md +6 -6
- package/.docs/organized/code-examples/with-chain-of-thought.md +16 -14
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +11 -10
- package/.docs/organized/code-examples/with-custom-thread-list.md +11 -10
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +14 -13
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +15 -14
- package/.docs/organized/code-examples/with-eve.md +6 -5
- package/.docs/organized/code-examples/with-expo.md +213 -36
- package/.docs/organized/code-examples/with-external-store.md +6 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +11 -10
- package/.docs/organized/code-examples/with-generative-ui.md +263 -29
- package/.docs/organized/code-examples/with-google-adk.md +5 -4
- package/.docs/organized/code-examples/with-heat-graph.md +3 -3
- package/.docs/organized/code-examples/with-image-generation.md +8 -7
- package/.docs/organized/code-examples/with-interactables.md +11 -10
- package/.docs/organized/code-examples/with-langchain.md +10 -9
- package/.docs/organized/code-examples/with-langgraph.md +7 -6
- package/.docs/organized/code-examples/with-livekit.md +15 -14
- package/.docs/organized/code-examples/with-mcp.md +14 -12
- package/.docs/organized/code-examples/with-nuxt.md +511 -575
- package/.docs/organized/code-examples/with-opencode.md +4 -4
- package/.docs/organized/code-examples/with-openui.md +450 -0
- package/.docs/organized/code-examples/with-pi.md +6 -5
- package/.docs/organized/code-examples/with-react-hook-form.md +16 -13
- package/.docs/organized/code-examples/with-react-ink-web.md +65 -15
- package/.docs/organized/code-examples/with-react-ink.md +5 -4
- package/.docs/organized/code-examples/with-react-router.md +8 -7
- package/.docs/organized/code-examples/with-resumable-stream.md +13 -12
- package/.docs/organized/code-examples/with-store.md +3 -3
- package/.docs/organized/code-examples/with-svelte.md +415 -0
- package/.docs/organized/code-examples/with-sveltekit.md +1061 -0
- package/.docs/organized/code-examples/with-tanstack.md +10 -9
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -4
- package/.docs/organized/code-examples/with-virtualized-thread.md +6 -5
- package/.docs/organized/code-examples/with-vue.md +2 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +6 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +26 -26
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +5 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +9 -2
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +43 -18
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +61 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +32 -1
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -1
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +4 -2
- package/.docs/raw/docs/cloud/index.mdx +1 -1
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/context-api.mdx +15 -17
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- package/.docs/raw/docs/guides/mentions.mdx +2 -0
- package/.docs/raw/docs/guides/message-timing.mdx +11 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
- package/.docs/raw/docs/guides/speech.mdx +1 -1
- package/.docs/raw/docs/guides/suggestions.mdx +8 -5
- package/.docs/raw/docs/guides/voice.mdx +1 -1
- package/.docs/raw/docs/ink/hooks.mdx +1 -1
- package/.docs/raw/docs/ink/index.mdx +3 -2
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +1 -1
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/index.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +149 -131
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- package/.docs/raw/docs/migrations/v0-15.mdx +34 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
- package/.docs/raw/docs/primitives/attachment.mdx +1 -1
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
- package/.docs/raw/docs/primitives/composer.mdx +1 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -1
- package/.docs/raw/docs/primitives/message.mdx +1 -1
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +4 -2
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +2 -2
- package/.docs/raw/docs/react-native/adapters.mdx +1 -1
- package/.docs/raw/docs/react-native/index.mdx +2 -2
- package/.docs/raw/docs/react-native/migration.mdx +2 -2
- package/.docs/raw/docs/react-native/primitives.mdx +142 -5
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +48 -6
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
- package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +118 -0
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +2 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +73 -33
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +4 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +9 -2
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +21 -2
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +180 -0
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +167 -0
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +160 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +224 -211
- package/.docs/raw/docs/tools/index.mdx +2 -1
- package/.docs/raw/docs/tools/interactables.mdx +8 -7
- package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
- package/.docs/raw/docs/tools/mcp.mdx +2 -2
- package/.docs/raw/docs/tools/openui.mdx +175 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +18 -7
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +7 -3
- package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
- package/.docs/raw/docs/ui/attachment.mdx +50 -3
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -1
- package/.docs/raw/docs/ui/directive-text.mdx +1 -1
- package/.docs/raw/docs/ui/file.mdx +2 -2
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +2 -2
- package/.docs/raw/docs/ui/markdown.mdx +40 -1
- package/.docs/raw/docs/ui/mermaid.mdx +1 -1
- package/.docs/raw/docs/ui/message-timing.mdx +1 -1
- package/.docs/raw/docs/ui/model-selector.mdx +4 -4
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
- package/.docs/raw/docs/ui/quote.mdx +3 -3
- package/.docs/raw/docs/ui/reasoning.mdx +31 -3
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
- package/.docs/raw/docs/ui/sources.mdx +10 -1
- package/.docs/raw/docs/ui/streamdown.mdx +2 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread-list.mdx +40 -1
- package/.docs/raw/docs/ui/thread.mdx +49 -2
- package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
- package/.docs/raw/docs/ui/tool-group.mdx +1 -1
- package/.docs/raw/docs/ui/voice.mdx +1 -1
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/xulux/catalog-client.d.ts.map +1 -1
- package/dist/xulux/catalog-client.js +51 -6
- package/dist/xulux/catalog-client.js.map +1 -1
- package/dist/xulux/types.d.ts +7 -7
- package/dist/xulux/types.d.ts.map +1 -1
- package/dist/xulux/types.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/tests/docs.test.ts +10 -7
- package/src/tools/tests/path-traversal.test.ts +5 -2
- package/src/tools/tests/xulux-templates.test.ts +63 -0
- package/src/xulux/catalog-client.ts +68 -23
- package/src/xulux/types.ts +17 -13
- package/.docs/raw/docs/tools/interactables-legacy.mdx +0 -423
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- package/.docs/raw/docs/ui/number-roll.mdx +0 -154
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
|
@@ -36,15 +36,36 @@ Converts an assistant-ui append message into the message payload accepted by
|
|
|
36
36
|
Eve's `send` API.
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
const getEveMessageContent: (message: AppendMessage) =>
|
|
39
|
+
const getEveMessageContent: (message: AppendMessage) => EveMessageContent;
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### toEveInputResponse
|
|
43
43
|
|
|
44
44
|
Converts an assistant-ui tool approval response into an Eve input response.
|
|
45
45
|
|
|
46
|
+
When `inputRequest` is known, every returned response carries either an
|
|
47
|
+
option the request declares or a free-form answer. A literal option match
|
|
48
|
+
wins, then the `"approve"` / `"cancel"` option the response's boolean decision
|
|
49
|
+
names, then the response's `reason` text when the request takes a free-form
|
|
50
|
+
answer (`display: "text"`, `allowFreeform`, or no options at all, and never
|
|
51
|
+
`display: "confirmation"`) and the response is not a refusal.
|
|
52
|
+
A one-argument call, or a part with no request, still forwards a caller
|
|
53
|
+
`optionId` as it always has, including ids the request never declared.
|
|
54
|
+
|
|
55
|
+
A response the known request cannot record as the answer it asked for throws
|
|
56
|
+
instead of being submitted, because eve resolves a request the moment any
|
|
57
|
+
response for it arrives, and an empty one is recorded as an answer with no
|
|
58
|
+
content. Not sending leaves the request pending, so the caller can retry or
|
|
59
|
+
the user can answer it as an ordinary message.
|
|
60
|
+
|
|
61
|
+
With no request to map against — a one-argument call, or a part carrying no
|
|
62
|
+
`toolMetadata.eve.inputRequest` — the response maps as it always has, to the
|
|
63
|
+
literal `"approve"` / `"cancel"` option every eve approval declares. Guessing
|
|
64
|
+
a display mode is what this mapper stopped doing; an unknown request is not
|
|
65
|
+
a guess about one.
|
|
66
|
+
|
|
46
67
|
```ts
|
|
47
|
-
const toEveInputResponse: (response: RespondToToolApprovalOptions) => InputResponse;
|
|
68
|
+
const toEveInputResponse: (response: RespondToToolApprovalOptions, inputRequest?: EveMessageInputRequest) => InputResponse;
|
|
48
69
|
```
|
|
49
70
|
|
|
50
71
|
### useEveAgentRuntime
|
|
@@ -56,4 +77,42 @@ session, supports cancellation, and maps Eve input requests to assistant-ui
|
|
|
56
77
|
tool approval UI.
|
|
57
78
|
|
|
58
79
|
<ParametersTable {...eve_useEveAgentRuntime} />
|
|
80
|
+
|
|
81
|
+
### useEveError
|
|
82
|
+
|
|
83
|
+
Read the last Eve session error from the runtime extras.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const useEveError: () => Error | undefined;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### useEveEvents
|
|
90
|
+
|
|
91
|
+
Read the authoritative Eve server event stream from the runtime extras.
|
|
92
|
+
Defaults to an empty array outside an Eve runtime.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const useEveEvents: () => EveRuntimeExtras["events"];
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### useEveReset
|
|
99
|
+
|
|
100
|
+
Returns a function that resets the Eve session: aborts any in-flight turn,
|
|
101
|
+
recreates the owned session, and clears events and projected data. Pending
|
|
102
|
+
staged messages and tool execution state are discarded. Safe to render
|
|
103
|
+
outside an Eve runtime; invoking the returned function there throws.
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
const useEveReset: () => () => void;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### useEveSession
|
|
110
|
+
|
|
111
|
+
Read the current Eve session cursor from the runtime extras. Persist it to
|
|
112
|
+
resume the session later via `initialSession`. `undefined` when no session
|
|
113
|
+
exists yet or outside an Eve runtime.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const useEveSession: () => EveRuntimeExtras["session"] | undefined;
|
|
117
|
+
```
|
|
59
118
|
{/* api-reference:end */}
|
|
@@ -7,14 +7,14 @@ description: Package-level APIs for connecting assistant-ui React to the Vercel
|
|
|
7
7
|
{/* The page list is generated from exported APIs; edit only the manual prose slot. */}
|
|
8
8
|
|
|
9
9
|
{/* api-manual:start */}
|
|
10
|
-
Integration packages connect assistant-ui to adjacent React and AI ecosystems. Use this section when you need the exact hooks, options, and helper exports for a package such as `@assistant-ui/
|
|
10
|
+
Integration packages connect assistant-ui to adjacent React and AI ecosystems. Use this section when you need the exact hooks, options, and helper exports for a package such as `@assistant-ui/ai-sdk`, `@assistant-ui/react-data-stream`, `@assistant-ui/cloud-ai-sdk`, or `@assistant-ui/eve`.
|
|
11
11
|
{/* api-manual:end */}
|
|
12
12
|
|
|
13
13
|
## Pages
|
|
14
14
|
|
|
15
15
|
<Cards>
|
|
16
|
-
<Card title={"@assistant-ui/
|
|
17
|
-
{"Vercel AI SDK runtime hooks, chat transports, and message conversion utilities for assistant-ui
|
|
16
|
+
<Card title={"@assistant-ui/ai-sdk"} href={"/docs/api-reference/integrations/ai-sdk"}>
|
|
17
|
+
{"Vercel AI SDK runtime hooks, chat transports, and message conversion utilities for assistant-ui applications."}
|
|
18
18
|
</Card>
|
|
19
19
|
<Card title={"@assistant-ui/react-data-stream"} href={"/docs/api-reference/integrations/react-data-stream"}>
|
|
20
20
|
{"Data stream runtime hook and message conversion utilities for custom assistant-ui streaming backends."}
|
|
@@ -46,8 +46,8 @@ The React API reference is organized by how you build with assistant-ui:
|
|
|
46
46
|
<Card title="Adapters" href="/docs/api-reference/adapters/model">
|
|
47
47
|
Runtime extension points for attachments, persistence, feedback, speech, dictation, and suggestions.
|
|
48
48
|
</Card>
|
|
49
|
-
<Card title="Integrations" href="/docs/api-reference/integrations/
|
|
50
|
-
Package-level APIs for integrations such as `@assistant-ui/
|
|
49
|
+
<Card title="Integrations" href="/docs/api-reference/integrations/ai-sdk">
|
|
50
|
+
Package-level APIs for integrations such as `@assistant-ui/ai-sdk` and `@assistant-ui/cloud-ai-sdk`.
|
|
51
51
|
</Card>
|
|
52
52
|
<Card title="Runtime State" href="/docs/api-reference/runtimes/assistant-runtime">
|
|
53
53
|
Runtime action and state shapes used by `useAui` and `useAuiState`.
|
|
@@ -336,11 +336,11 @@ Only takes effect when `submitMode` resolves to `"enter"` (the default); `"ctrlE
|
|
|
336
336
|
)}
|
|
337
337
|
|
|
338
338
|
```tsx
|
|
339
|
-
<
|
|
339
|
+
<AuiIf condition={(s) => s.composer.dictation != null}>
|
|
340
340
|
<div className="dictation-preview">
|
|
341
341
|
<ComposerPrimitive.DictationTranscript />
|
|
342
342
|
</div>
|
|
343
|
-
</
|
|
343
|
+
</AuiIf>
|
|
344
344
|
```
|
|
345
345
|
|
|
346
346
|
<ParametersTable {...ComposerPrimitiveDictationTranscriptProps} />
|
|
@@ -616,4 +616,22 @@ Only takes effect when `submitMode` resolves to `"enter"` (the default); `"ctrlE
|
|
|
616
616
|
{ComposerPrimitiveDocs.Unstable_RegisteredTrigger?.props && (
|
|
617
617
|
<ParametersTable type={ComposerPrimitiveDocs.Unstable_RegisteredTrigger?.element} parameters={ComposerPrimitiveDocs.Unstable_RegisteredTrigger.props} />
|
|
618
618
|
)}
|
|
619
|
+
|
|
620
|
+
### Unstable_TriggerMatcher
|
|
621
|
+
|
|
622
|
+
{ComposerPrimitiveDocs.Unstable_TriggerMatcher?.deprecated && (
|
|
623
|
+
<Callout type="warn">
|
|
624
|
+
<strong>Deprecated.</strong> {ComposerPrimitiveDocs.Unstable_TriggerMatcher.deprecated}
|
|
625
|
+
</Callout>
|
|
626
|
+
)}
|
|
627
|
+
|
|
628
|
+
{ComposerPrimitiveDocs.Unstable_TriggerMatcher?.description}
|
|
629
|
+
|
|
630
|
+
{ComposerPrimitiveDocs.Unstable_TriggerMatcher?.element && (
|
|
631
|
+
<p>This primitive renders a <code>{`<${ComposerPrimitiveDocs.Unstable_TriggerMatcher?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
632
|
+
)}
|
|
633
|
+
|
|
634
|
+
{ComposerPrimitiveDocs.Unstable_TriggerMatcher?.props && (
|
|
635
|
+
<ParametersTable type={ComposerPrimitiveDocs.Unstable_TriggerMatcher?.element} parameters={ComposerPrimitiveDocs.Unstable_TriggerMatcher.props} />
|
|
636
|
+
)}
|
|
619
637
|
{/* api-reference:end */}
|
|
@@ -114,7 +114,7 @@ Reads the interactable snapshots stamped on a message's
|
|
|
114
114
|
`metadata.custom.interactables`, or `undefined` if none. This is the read
|
|
115
115
|
half of the snapshot channel — integrations use it to surface interactable
|
|
116
116
|
state to the model (see `unstable_injectInteractableContext` in
|
|
117
|
-
`@assistant-ui/
|
|
117
|
+
`@assistant-ui/ai-sdk` for the AI SDK implementation).
|
|
118
118
|
|
|
119
119
|
<ParametersTable {...unstable_getInteractableSnapshots} />
|
|
120
120
|
|
|
@@ -3,7 +3,7 @@ title: Utilities
|
|
|
3
3
|
description: Miscellaneous @assistant-ui/react utilities for custom rendering, composition, and advanced assistant UI behavior.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { AssistantCloud, AuiConfig, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList, Suggestions, useSmooth } from "@/generated/typeDocs";
|
|
6
|
+
import { AssistantCloud, AuiConfig, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, MessageNotSentError, RemoteThreadList, SingleThreadList, Suggestions, useSmooth } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
8
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
9
|
{/* Do not edit manually. */}
|
|
@@ -59,6 +59,34 @@ const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController
|
|
|
59
59
|
|
|
60
60
|
<ParametersTable {...InMemoryThreadList} />
|
|
61
61
|
|
|
62
|
+
### isMessageNotSentError
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const isMessageNotSentError: (error: unknown) => error is MessageNotSentError;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### MessageNotSentError
|
|
69
|
+
|
|
70
|
+
Rejection reason for a send that never reached the backend, so nothing ran
|
|
71
|
+
and nothing is recoverable from the thread. A runtime adapter throws it from
|
|
72
|
+
`onNew` to hand the message back to the thread composer, which restores the
|
|
73
|
+
draft it cleared at dispatch time when nothing has claimed the composer
|
|
74
|
+
since. An edit composer closes at dispatch, so a rejected edit is not
|
|
75
|
+
restored.
|
|
76
|
+
|
|
77
|
+
<ParametersTable {...MessageNotSentError} />
|
|
78
|
+
|
|
79
|
+
### RemoteThreadList
|
|
80
|
+
|
|
81
|
+
`AuiConfig` `threads` entry backed by a `RemoteThreadListAdapter`. Thread
|
|
82
|
+
bodies are born from the `thread` factory inside the client tree, so any
|
|
83
|
+
`AssistantClient` host can run a remote or cloud list. Per-thread history
|
|
84
|
+
and attachments come from `unstable_useAdapters`. `useRemoteThreadListRuntime`
|
|
85
|
+
uses the same hook when `unstable_Provider` is omitted. Key the factory
|
|
86
|
+
with `withKey` so history reloads when the visible thread changes.
|
|
87
|
+
|
|
88
|
+
<ParametersTable {...RemoteThreadList} />
|
|
89
|
+
|
|
62
90
|
### SingleThreadList
|
|
63
91
|
|
|
64
92
|
<ParametersTable {...SingleThreadList} />
|
|
@@ -85,6 +113,9 @@ Takes the current part state and a `smooth` argument: `false` disables,
|
|
|
85
113
|
`true` uses the default rate, and a SmoothOptions object tunes
|
|
86
114
|
the reveal. Returns the part state with `text` replaced by the revealed
|
|
87
115
|
prefix and `status` reporting `running` until the reveal catches up.
|
|
116
|
+
If the source settles before any character has been revealed, the text
|
|
117
|
+
is committed immediately so a missed animation frame cannot leave an
|
|
118
|
+
empty bubble.
|
|
88
119
|
|
|
89
120
|
The reveal auto-disables under `prefers-reduced-motion: reduce`,
|
|
90
121
|
committing the full text immediately; this takes precedence over an
|
|
@@ -19,7 +19,7 @@ This integration provides:
|
|
|
19
19
|
|
|
20
20
|
## How It Works
|
|
21
21
|
|
|
22
|
-
The `useChatRuntime` hook from `@assistant-ui/
|
|
22
|
+
The `useChatRuntime` hook from `@assistant-ui/ai-sdk` wraps AI SDK's `useChat` and adds cloud persistence via the `cloud` parameter. `AISDKThreads({ cloud })` is the store-entry list for `AuiConfig` / `createAssistantClient` hosts. That host mounts only the visible thread, so a switch cancels an in-flight run. The runtime automatically:
|
|
23
23
|
|
|
24
24
|
1. Creates a cloud thread on the first user message
|
|
25
25
|
2. Persists messages as they complete streaming
|
|
@@ -102,17 +102,17 @@ Install the required packages:
|
|
|
102
102
|
<PlatformTabs>
|
|
103
103
|
<Tab value="React">
|
|
104
104
|
|
|
105
|
-
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/
|
|
105
|
+
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/ai-sdk"]} />
|
|
106
106
|
|
|
107
107
|
</Tab>
|
|
108
108
|
<Tab value="React Native">
|
|
109
109
|
|
|
110
|
-
<InstallCommand expo={["@assistant-ui/react-native", "@assistant-ui/
|
|
110
|
+
<InstallCommand expo={["@assistant-ui/react-native", "@assistant-ui/ai-sdk", "assistant-cloud"]} />
|
|
111
111
|
|
|
112
112
|
</Tab>
|
|
113
113
|
<Tab value="React Ink">
|
|
114
114
|
|
|
115
|
-
<InstallCommand npm={["@assistant-ui/react-ink", "@assistant-ui/
|
|
115
|
+
<InstallCommand npm={["@assistant-ui/react-ink", "@assistant-ui/ai-sdk", "assistant-cloud", "ink", "react"]} />
|
|
116
116
|
|
|
117
117
|
</Tab>
|
|
118
118
|
</PlatformTabs>
|
|
@@ -133,7 +133,7 @@ Create a client-side AssistantCloud instance and integrate it with your AI SDK r
|
|
|
133
133
|
|
|
134
134
|
import { useMemo } from "react";
|
|
135
135
|
import { AssistantCloud, AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
136
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
136
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
137
137
|
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
|
138
138
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
139
139
|
|
|
@@ -174,7 +174,7 @@ import {
|
|
|
174
174
|
ThreadListPrimitive,
|
|
175
175
|
} from "@assistant-ui/react-native";
|
|
176
176
|
import { AssistantCloud } from "assistant-cloud";
|
|
177
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
177
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
178
178
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
179
179
|
|
|
180
180
|
async function getAssistantToken() {
|
|
@@ -236,7 +236,7 @@ import {
|
|
|
236
236
|
ThreadListPrimitive,
|
|
237
237
|
} from "@assistant-ui/react-ink";
|
|
238
238
|
import { AssistantCloud } from "assistant-cloud";
|
|
239
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
239
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
240
240
|
import { Thread } from "./components/thread.js";
|
|
241
241
|
|
|
242
242
|
async function getAssistantToken() {
|
|
@@ -453,7 +453,7 @@ The React example above uses anonymous mode for quick demos. For production apps
|
|
|
453
453
|
import { useMemo } from "react";
|
|
454
454
|
import { useAuth } from "@clerk/nextjs";
|
|
455
455
|
import { AssistantCloud } from "@assistant-ui/react";
|
|
456
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
456
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
457
457
|
|
|
458
458
|
function Chat() {
|
|
459
459
|
const { getToken } = useAuth();
|
|
@@ -474,7 +474,7 @@ function Chat() {
|
|
|
474
474
|
```tsx
|
|
475
475
|
import { useMemo } from "react";
|
|
476
476
|
import { AssistantCloud } from "assistant-cloud";
|
|
477
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
477
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
478
478
|
|
|
479
479
|
async function getAssistantToken() {
|
|
480
480
|
// Return a user token from your native auth provider.
|
|
@@ -498,7 +498,7 @@ function Chat() {
|
|
|
498
498
|
```tsx
|
|
499
499
|
import { useMemo } from "react";
|
|
500
500
|
import { AssistantCloud } from "assistant-cloud";
|
|
501
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
501
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
502
502
|
|
|
503
503
|
async function getAssistantToken() {
|
|
504
504
|
// Return a user token from your CLI auth flow.
|
|
@@ -332,7 +332,7 @@ Plus all other properties from AI SDK's [`UseChatHelpers`](https://sdk.vercel.ai
|
|
|
332
332
|
| Value | Type | Description |
|
|
333
333
|
|-------|------|-------------|
|
|
334
334
|
| `threads.cloud` | `AssistantCloud` | The cloud instance used for thread operations |
|
|
335
|
-
| `threads.threads` | `CloudThread[]` |
|
|
335
|
+
| `threads.threads` | `CloudThread[]` | Threads sorted by recency; includes archived threads when supplied by `useThreads({ includeArchived: true })` |
|
|
336
336
|
| `threads.threadId` | `string \| null` | Current thread ID (`null` for a new unsaved chat) |
|
|
337
337
|
| `threads.selectThread` | `(id: string \| null) => void` | Switch threads or pass `null` for a new chat |
|
|
338
338
|
| `threads.isLoading` | `boolean` | `true` during initial load or refresh |
|
|
@@ -355,6 +355,8 @@ const myThreads = useThreads({ cloud: myCloud });
|
|
|
355
355
|
const { messages, sendMessage } = useCloudChat({ threads: myThreads });
|
|
356
356
|
```
|
|
357
357
|
|
|
358
|
+
`useThreads` requests 20 threads per page and follows Cloud cursors until all matching threads are loaded. With `includeArchived`, active and archived pages load concurrently and the complete list is committed after both finish.
|
|
359
|
+
|
|
358
360
|
**Parameters:**
|
|
359
361
|
|
|
360
362
|
| Parameter | Type | Description |
|
|
@@ -378,7 +380,7 @@ The `useCloudChat` hook automatically reports run telemetry to Assistant Cloud a
|
|
|
378
380
|
**Requires route configuration:**
|
|
379
381
|
- `model_id` — The model used for the response
|
|
380
382
|
- `input_tokens` / `output_tokens` — Token usage statistics
|
|
381
|
-
- `reasoning_tokens` — Tokens used for chain-of-thought reasoning (e.g. GPT-5.
|
|
383
|
+
- `reasoning_tokens` — Tokens used for chain-of-thought reasoning (e.g. GPT-5.6 Luna or other reasoning models)
|
|
382
384
|
- `cached_input_tokens` — Input tokens served from the provider's prompt cache
|
|
383
385
|
|
|
384
386
|
To capture model and usage data, configure the `messageMetadata` callback in your AI SDK route:
|
|
@@ -16,7 +16,7 @@ Assistant Cloud is a hosted service that adds thread management, message persist
|
|
|
16
16
|
|
|
17
17
|
| Backend | Standalone Mode | With assistant-ui |
|
|
18
18
|
|---------|----------------|-------------------|
|
|
19
|
-
| AI SDK | [`useCloudChat`](/docs/cloud/ai-sdk) | [`useChatRuntime`](/docs/cloud/ai-sdk-assistant-ui) |
|
|
19
|
+
| AI SDK | [`useCloudChat`](/docs/cloud/ai-sdk) | [`useChatRuntime`](/docs/cloud/ai-sdk-assistant-ui) / `AISDKThreads` |
|
|
20
20
|
| LangGraph | — | [`useLangGraphRuntime`](/docs/cloud/langgraph) |
|
|
21
21
|
| Custom | — | Local Runtime |
|
|
22
22
|
|
|
@@ -29,7 +29,10 @@ import { z } from "zod";
|
|
|
29
29
|
const registry = new ModelContextRegistry();
|
|
30
30
|
|
|
31
31
|
// Expose the registry to the parent window
|
|
32
|
-
AssistantFrameProvider.addModelContextProvider(
|
|
32
|
+
AssistantFrameProvider.addModelContextProvider(
|
|
33
|
+
registry,
|
|
34
|
+
"https://parent-app.com",
|
|
35
|
+
);
|
|
33
36
|
|
|
34
37
|
// Add tools that will be available to the parent assistant
|
|
35
38
|
registry.addTool({
|
|
@@ -70,7 +73,7 @@ function ParentComponent() {
|
|
|
70
73
|
// Connect to the iframe's model context
|
|
71
74
|
useAssistantFrameHost({
|
|
72
75
|
iframeRef,
|
|
73
|
-
targetOrigin: "https://trusted-iframe-domain.com",
|
|
76
|
+
targetOrigin: "https://trusted-iframe-domain.com",
|
|
74
77
|
});
|
|
75
78
|
|
|
76
79
|
return (
|
|
@@ -160,9 +163,15 @@ analyticsRegistry.addTool({
|
|
|
160
163
|
|
|
161
164
|
// Register both providers
|
|
162
165
|
const unsubscribe1 =
|
|
163
|
-
AssistantFrameProvider.addModelContextProvider(
|
|
166
|
+
AssistantFrameProvider.addModelContextProvider(
|
|
167
|
+
catalogRegistry,
|
|
168
|
+
"https://parent-app.com",
|
|
169
|
+
);
|
|
164
170
|
const unsubscribe2 =
|
|
165
|
-
AssistantFrameProvider.addModelContextProvider(
|
|
171
|
+
AssistantFrameProvider.addModelContextProvider(
|
|
172
|
+
analyticsRegistry,
|
|
173
|
+
"https://parent-app.com",
|
|
174
|
+
);
|
|
166
175
|
|
|
167
176
|
// Later, unsubscribe if needed
|
|
168
177
|
unsubscribe1();
|
|
@@ -173,7 +182,7 @@ unsubscribe2();
|
|
|
173
182
|
|
|
174
183
|
#### Origin Validation
|
|
175
184
|
|
|
176
|
-
Both the provider and host
|
|
185
|
+
Both the provider and host validate message origins. They default to the current page's origin, so cross-origin frames must specify the exact trusted origin on both sides:
|
|
177
186
|
|
|
178
187
|
```tsx
|
|
179
188
|
// In iframe - only accept messages from specific parent
|
|
@@ -222,10 +231,12 @@ Registers a model context provider to share with parent windows.
|
|
|
222
231
|
```tsx
|
|
223
232
|
const unsubscribe = AssistantFrameProvider.addModelContextProvider(
|
|
224
233
|
registry,
|
|
225
|
-
"https://parent-domain.com",
|
|
234
|
+
"https://parent-domain.com",
|
|
226
235
|
);
|
|
227
236
|
```
|
|
228
237
|
|
|
238
|
+
When `targetOrigin` is omitted, the provider only communicates with `window.location.origin`. All providers in a frame share one origin policy. Registering an explicit origin tightens an existing wildcard policy, while registering two different explicit origins throws an error. Unsubscribing drops that registration's requirement. The wildcard value `*` is available as an explicit opt-in, but it should not be used for contexts that expose tools or sensitive instructions.
|
|
239
|
+
|
|
229
240
|
##### `dispose()`
|
|
230
241
|
|
|
231
242
|
Cleans up all resources and removes all providers.
|
|
@@ -243,7 +254,7 @@ Class that connects to an iframe's model context providers.
|
|
|
243
254
|
```tsx
|
|
244
255
|
const host = new AssistantFrameHost(
|
|
245
256
|
iframeWindow,
|
|
246
|
-
targetOrigin
|
|
257
|
+
targetOrigin?, // Defaults to window.location.origin
|
|
247
258
|
);
|
|
248
259
|
```
|
|
249
260
|
|
|
@@ -283,7 +294,7 @@ React hook that manages the lifecycle of an AssistantFrameHost.
|
|
|
283
294
|
```tsx
|
|
284
295
|
useAssistantFrameHost({
|
|
285
296
|
iframeRef: RefObject<HTMLIFrameElement>,
|
|
286
|
-
targetOrigin?: string,
|
|
297
|
+
targetOrigin?: string, // Defaults to window.location.origin
|
|
287
298
|
});
|
|
288
299
|
```
|
|
289
300
|
|
|
@@ -4,7 +4,7 @@ description: Let users attach images, PDFs, and other files to AI chat messages
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AttachmentSample } from "@/components/docs/samples/attachment";
|
|
7
|
+
import { AttachmentSample } from "@/components/pages/docs/samples/attachment";
|
|
8
8
|
|
|
9
9
|
Enable users to attach files to their messages, enhancing conversations with images, documents, and other content.
|
|
10
10
|
|
|
@@ -44,7 +44,7 @@ This adds `/components/assistant-ui/attachment.tsx` to your project.
|
|
|
44
44
|
For `useChatRuntime`, attachments work automatically without additional configuration:
|
|
45
45
|
|
|
46
46
|
```tsx title="/app/MyRuntimeProvider.tsx"
|
|
47
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
47
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
48
48
|
|
|
49
49
|
const runtime = useChatRuntime();
|
|
50
50
|
```
|
|
@@ -118,7 +118,7 @@ Build your own adapters for specialized file handling. Below are complete exampl
|
|
|
118
118
|
|
|
119
119
|
### Vision-Capable Image Adapter
|
|
120
120
|
|
|
121
|
-
Send images to vision-capable LLMs like GPT-5.
|
|
121
|
+
Send images to vision-capable LLMs like GPT-5.6, Claude Sonnet 4.6, or Gemini Pro Vision:
|
|
122
122
|
|
|
123
123
|
```tsx
|
|
124
124
|
import {
|
|
@@ -276,7 +276,7 @@ const MyModelAdapter: ChatModelAdapter = {
|
|
|
276
276
|
msg.role === "user" &&
|
|
277
277
|
msg.content.some((part) => part.type === "image")
|
|
278
278
|
) {
|
|
279
|
-
// Format for GPT-5.
|
|
279
|
+
// Format for GPT-5.6 or similar vision models
|
|
280
280
|
return {
|
|
281
281
|
role: "user",
|
|
282
282
|
content: msg.content.map((part) => {
|
|
@@ -4,7 +4,7 @@ description: Edit messages or regenerate AI responses, then switch between alter
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { BranchingSample } from "@/components/docs/samples/branching";
|
|
7
|
+
import { BranchingSample } from "@/components/pages/docs/samples/branching";
|
|
8
8
|
|
|
9
9
|
Branching lets users navigate between alternative versions of a message. A new branch is created when:
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ In your chat route, swap `@ai-sdk/openai` for the OAuth provider. Starting from
|
|
|
30
30
|
|
|
31
31
|
```ts title="/app/api/chat/route.ts" {10}
|
|
32
32
|
import { createOpenAIOAuth } from "openai-oauth-provider";
|
|
33
|
-
import { frontendTools } from "@assistant-ui/
|
|
33
|
+
import { frontendTools } from "@assistant-ui/ai-sdk";
|
|
34
34
|
import {
|
|
35
35
|
type JSONSchema7,
|
|
36
36
|
streamText,
|
|
@@ -519,34 +519,32 @@ The table below covers the most commonly used actions. For the full catalog, see
|
|
|
519
519
|
|
|
520
520
|
### Events vs State Observation
|
|
521
521
|
|
|
522
|
-
`
|
|
522
|
+
Use `useAuiState` to render the current value of something; use `useAuiEvent` to react to the moment something happens. Both are supported: many events mark a transition you could also observe in state, and subscribing to the event is the intended way to run a side effect at that transition.
|
|
523
523
|
|
|
524
524
|
The rule of thumb:
|
|
525
525
|
|
|
526
|
-
1.
|
|
526
|
+
1. Rendering a value? → use `useAuiState`.
|
|
527
527
|
2. Are you the caller and want immediate feedback? → catch the rejection / read the return value.
|
|
528
|
-
3.
|
|
528
|
+
3. Running a side effect when something happens? → use `useAuiEvent`.
|
|
529
529
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
#### Currently Recommended (Truly Transient)
|
|
530
|
+
#### Available Events
|
|
533
531
|
|
|
534
532
|
| Event | When It Fires |
|
|
535
533
|
| ----------------------------- | ---------------------------------------------------------------------------- |
|
|
536
|
-
| `
|
|
534
|
+
| `threads.selectionChanged` | The main thread selection changed. Payload carries `threadId` (newly selected) and `previousThreadId`. Does not fire for the initially selected thread on mount. |
|
|
535
|
+
| `thread.runStart` / `runEnd` | A run started / ended on the thread (also visible as `isRunning` flipping) |
|
|
536
|
+
| `thread.initialize` | The thread transitioned from new to initialized, before the first message is added |
|
|
537
537
|
| `thread.modelContextUpdate` | The model context provider notified a change. The model context lives in a provider, not in thread state, so this event has no state-derivable equivalent. |
|
|
538
|
+
| `composer.send` | The user sent the composer contents; `messageId` is set for edit-composer sends |
|
|
539
|
+
| `composer.attachmentAdd` | An attachment was added to the composer |
|
|
540
|
+
| `composer.attachmentAddError` | An `addAttachment()` call failed. Payload `reason` discriminates `no-adapter` / `not-accepted` / `adapter-error`. The event additionally surfaces a human-readable `message` (and the underlying `Error` instance via the low-level `runtime.unstable_on("attachmentAddError")` API; `useAuiEvent` payloads omit it because raw `Error` objects are not store-serializable). |
|
|
538
541
|
|
|
539
|
-
####
|
|
540
|
-
|
|
541
|
-
These events fire at the same transition you can observe via state. They are kept for backward compatibility but new code should observe state instead.
|
|
542
|
+
#### Deprecated Events
|
|
542
543
|
|
|
543
|
-
|
|
|
544
|
-
|
|
|
545
|
-
| `
|
|
546
|
-
| `
|
|
547
|
-
| `thread.runStart` / `runEnd` | thread `isRunning` flipping to `true` / `false` |
|
|
548
|
-
| `thread.initialize` | thread `messages` becoming non-empty (or `isEmpty` flipping) |
|
|
549
|
-
| `threadListItem.switchedTo` / `switchedAway` | compare `s.threads.mainThreadId` against `s.threadListItem.id` |
|
|
544
|
+
| Deprecated Event | Use Instead |
|
|
545
|
+
| ----------------------------- | ---------------------------------------------------------------------------- |
|
|
546
|
+
| `threadListItem.switchedTo` | `threads.selectionChanged` — its `threadId` is the newly selected thread |
|
|
547
|
+
| `threadListItem.switchedAway` | `threads.selectionChanged` — its `previousThreadId` is the thread switched away from |
|
|
550
548
|
|
|
551
549
|
## Troubleshooting
|
|
552
550
|
|
|
@@ -4,7 +4,7 @@ description: Add voice dictation to your AI chat composer with the Web Speech AP
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { DictationSample } from "@/components/docs/samples/dictation";
|
|
7
|
+
import { DictationSample } from "@/components/pages/docs/samples/dictation";
|
|
8
8
|
|
|
9
9
|
assistant-ui supports speech-to-text (dictation) via the `DictationAdapter` interface. Users speak into the microphone and transcribed text lands in the composer, either as interim preview or as committed final text.
|
|
10
10
|
|
|
@@ -283,7 +283,7 @@ This pattern records until the user stops dictation, then commits a single final
|
|
|
283
283
|
|
|
284
284
|
## Custom realtime providers
|
|
285
285
|
|
|
286
|
-
You can implement `DictationAdapter` against any streaming STT service. [ElevenLabs Scribe](https://elevenlabs.io/docs/capabilities/speech-to-text) is one option for low-latency WebSocket transcription; scaffold a full example with:
|
|
286
|
+
You can implement `DictationAdapter` against any streaming STT service. [ElevenLabs Scribe](https://elevenlabs.io/docs/overview/capabilities/speech-to-text) is one option for low-latency WebSocket transcription; scaffold a full example with:
|
|
287
287
|
|
|
288
288
|
```bash
|
|
289
289
|
npx assistant-ui create my-app -e with-elevenlabs-scribe
|
|
@@ -38,7 +38,7 @@ import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
|
38
38
|
import {
|
|
39
39
|
AssistantChatTransport,
|
|
40
40
|
useChatRuntime,
|
|
41
|
-
} from "@assistant-ui/
|
|
41
|
+
} from "@assistant-ui/ai-sdk";
|
|
42
42
|
|
|
43
43
|
const transport = new AssistantChatTransport({
|
|
44
44
|
api: "https://api.example.com/chat",
|
|
@@ -4,7 +4,7 @@ description: Render LaTeX math expressions in AI chat messages with KaTeX — dr
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { PackageManagerTabs } from "@/components/docs/fumadocs/install/package-manager-tabs";
|
|
7
|
+
import { PackageManagerTabs } from "@/components/pages/docs/fumadocs/install/package-manager-tabs";
|
|
8
8
|
|
|
9
9
|
Render LaTeX mathematical expressions in chat messages using KaTeX.
|
|
10
10
|
|
|
@@ -82,6 +82,8 @@ const myAdapter: Unstable_TriggerAdapter = {
|
|
|
82
82
|
|
|
83
83
|
The built-in `unstable_useLiveCompletionAdapter` wraps an async fetcher with debouncing, stale-request cancellation (results for an outdated query are dropped), and a single-entry cache. Its `search` returns the last results synchronously and schedules a debounced fetch when the query changes; when results arrive the returned `adapter` re-creates, which re-runs the popover lookup so the fresh items render. It also reports `isLoading`, which you pass to the popover to show a loading state.
|
|
84
84
|
|
|
85
|
+
When the fetcher reads from an account- or workspace-specific source, pass that source ID as `cacheKey`. Changing the key clears cached results and cancels any pending result from the previous source.
|
|
86
|
+
|
|
85
87
|
```tsx
|
|
86
88
|
import {
|
|
87
89
|
unstable_useLiveCompletionAdapter,
|
|
@@ -100,7 +100,7 @@ Timing is tracked automatically on the client side by observing streaming state
|
|
|
100
100
|
</Callout>
|
|
101
101
|
|
|
102
102
|
```tsx
|
|
103
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
103
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
104
104
|
|
|
105
105
|
const runtime = useChatRuntime();
|
|
106
106
|
// useMessageTiming() works out of the box
|
|
@@ -174,14 +174,20 @@ const runtime = useLangGraphRuntime({ stream: myStream });
|
|
|
174
174
|
// useMessageTiming() works out of the box
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
### AG-UI (`
|
|
177
|
+
### AG-UI (`useAgUiRuntime`)
|
|
178
178
|
|
|
179
179
|
Timing is tracked automatically on the client side by the AG-UI run aggregator. Each emitted message includes timing metadata computed from stream chunk observations.
|
|
180
180
|
|
|
181
181
|
```tsx
|
|
182
|
-
import {
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
import { useMemo } from "react";
|
|
183
|
+
import { useAgUiRuntime } from "@assistant-ui/react-ag-ui";
|
|
184
|
+
import { HttpAgent } from "@ag-ui/client";
|
|
185
|
+
|
|
186
|
+
const agent = useMemo(
|
|
187
|
+
() => new HttpAgent({ url: "http://localhost:8000/agent" }),
|
|
188
|
+
[],
|
|
189
|
+
);
|
|
190
|
+
const runtime = useAgUiRuntime({ agent });
|
|
185
191
|
// useMessageTiming() works out of the box
|
|
186
192
|
```
|
|
187
193
|
|