@assistant-ui/mcp-docs-server 0.1.31 → 0.1.33
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 +23 -25
- package/.docs/organized/code-examples/with-a2a.md +28 -28
- package/.docs/organized/code-examples/with-ag-ui.md +35 -30
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +16 -14
- package/.docs/organized/code-examples/with-artifacts.md +44 -38
- package/.docs/organized/code-examples/with-assistant-transport.md +68 -56
- package/.docs/organized/code-examples/with-browser-extension.md +357 -0
- package/.docs/organized/code-examples/with-chain-of-thought.md +425 -90
- package/.docs/organized/code-examples/with-cloud-standalone.md +30 -29
- package/.docs/organized/code-examples/with-cloud.md +16 -14
- package/.docs/organized/code-examples/with-custom-thread-list.md +19 -17
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +29 -26
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +20 -18
- package/.docs/organized/code-examples/with-expo.md +37 -31
- package/.docs/organized/code-examples/with-external-store.md +13 -11
- package/.docs/organized/code-examples/with-ffmpeg.md +327 -290
- package/.docs/organized/code-examples/with-generative-ui.md +1195 -194
- package/.docs/organized/code-examples/with-google-adk.md +13 -11
- package/.docs/organized/code-examples/with-heat-graph.md +16 -14
- package/.docs/organized/code-examples/with-image-generation.md +456 -0
- package/.docs/organized/code-examples/with-interactables.md +322 -244
- package/.docs/organized/code-examples/with-langchain.md +18 -16
- package/.docs/organized/code-examples/with-langgraph.md +95 -88
- package/.docs/organized/code-examples/with-livekit.md +30 -27
- package/.docs/organized/code-examples/with-mcp.md +754 -0
- package/.docs/organized/code-examples/with-opencode.md +70 -70
- package/.docs/organized/code-examples/with-react-hook-form.md +24 -22
- package/.docs/organized/code-examples/with-react-ink.md +4 -4
- package/.docs/organized/code-examples/with-react-router.md +20 -18
- package/.docs/organized/code-examples/with-resumable-stream.md +661 -0
- package/.docs/organized/code-examples/with-store.md +22 -20
- package/.docs/organized/code-examples/with-tanstack.md +18 -19
- package/.docs/organized/code-examples/with-tap-runtime.md +31 -28
- package/.docs/raw/docs/(docs)/architecture.mdx +43 -2
- package/.docs/raw/docs/(docs)/cli.mdx +2 -2
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +34 -26
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +32 -26
- package/.docs/raw/docs/(docs)/index.mdx +2 -2
- package/.docs/raw/docs/(docs)/installation.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +26 -24
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +20 -12
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +41 -16
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +12 -23
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +11 -9
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +46 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +18 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +33 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +45 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +18 -13
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +31 -52
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +15 -28
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +64 -18
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +434 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +11 -12
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +109 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +58 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +109 -132
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +39 -20
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +29 -24
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +202 -588
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +77 -96
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -349
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +18 -13
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -47
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +85 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +127 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +91 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +143 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
- package/.docs/raw/docs/cloud/ai-sdk.mdx +1 -3
- package/.docs/raw/docs/cloud/index.mdx +2 -2
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chain-of-thought.mdx +12 -14
- package/.docs/raw/docs/guides/context-api.mdx +6 -5
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/editing.mdx +1 -1
- package/.docs/raw/docs/guides/image-generation.mdx +74 -0
- package/.docs/raw/docs/guides/index.mdx +5 -14
- package/.docs/raw/docs/guides/latex.mdx +2 -2
- package/.docs/raw/docs/guides/mentions.mdx +6 -6
- package/.docs/raw/docs/guides/message-timing.mdx +38 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
- package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
- package/.docs/raw/docs/guides/slash-commands.mdx +2 -2
- package/.docs/raw/docs/guides/speech.mdx +2 -2
- package/.docs/raw/docs/guides/suggestions.mdx +89 -5
- package/.docs/raw/docs/guides/voice.mdx +2 -2
- package/.docs/raw/docs/ink/adapters.mdx +37 -1
- package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
- package/.docs/raw/docs/ink/hooks.mdx +98 -85
- package/.docs/raw/docs/ink/index.mdx +10 -11
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +350 -9
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/clerk.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +2 -2
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/gateways/index.mdx +9 -4
- package/.docs/raw/docs/integrations/index.mdx +17 -5
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +8 -1
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +8 -4
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +17 -2
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +226 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +10 -16
- package/.docs/raw/docs/primitives/composer.mdx +53 -0
- package/.docs/raw/docs/primitives/index.mdx +2 -2
- package/.docs/raw/docs/primitives/message.mdx +9 -10
- package/.docs/raw/docs/primitives/suggestion.mdx +9 -0
- package/.docs/raw/docs/react-native/hooks.mdx +57 -82
- package/.docs/raw/docs/react-native/index.mdx +4 -4
- package/.docs/raw/docs/react-native/migration.mdx +1 -1
- package/.docs/raw/docs/react-native/primitives.mdx +2 -2
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +7 -4
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +32 -1
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +7 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +1 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +129 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +7 -1
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +27 -2
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -1
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +18 -7
- package/.docs/raw/docs/runtimes/custom/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +108 -38
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +64 -50
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +98 -86
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +12 -5
- package/.docs/raw/docs/tools/backend.mdx +136 -0
- package/.docs/raw/docs/tools/defining-tools.mdx +413 -0
- package/.docs/raw/docs/tools/dynamic-tools.mdx +110 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +214 -0
- package/.docs/raw/docs/tools/index.mdx +76 -0
- package/.docs/raw/docs/{guides → tools}/interactables.mdx +3 -3
- package/.docs/raw/docs/tools/mcp-apps.mdx +231 -0
- package/.docs/raw/docs/{integrations/tools → tools}/mcp.mdx +77 -50
- package/.docs/raw/docs/{guides → tools}/multi-agent.mdx +19 -21
- package/.docs/raw/docs/tools/tool-ui.mdx +967 -0
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +337 -0
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +11 -1
- package/.docs/raw/docs/ui/directive-text.mdx +3 -3
- package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +84 -50
- package/.docs/raw/docs/ui/reasoning.mdx +4 -5
- package/.docs/raw/docs/ui/sources.mdx +17 -0
- package/.docs/raw/docs/ui/streamdown.mdx +34 -2
- package/.docs/raw/docs/ui/thread-list.mdx +2 -2
- package/.docs/raw/docs/ui/thread.mdx +2 -2
- package/.docs/raw/docs/ui/tool-group.mdx +5 -6
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -1
- package/README.md +14 -72
- package/dist/constants.d.ts +12 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -9
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts +4 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.js +109 -121
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts +4 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.js +45 -42
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -2
- package/dist/prepare-docs/prepare.js +17 -17
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.d.ts +1 -3
- package/dist/stdio.js +6 -3
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.d.ts +20 -15
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +140 -161
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +20 -15
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +74 -86
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.d.ts +5 -2
- package/dist/tools/tests/test-setup.d.ts.map +1 -1
- package/dist/tools/tests/test-setup.js +21 -28
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +17 -17
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp-format.d.ts +8 -5
- package/dist/utils/mcp-format.d.ts.map +1 -1
- package/dist/utils/mcp-format.js +9 -9
- package/dist/utils/mcp-format.js.map +1 -1
- package/dist/utils/mdx.d.ts +8 -6
- package/dist/utils/mdx.d.ts.map +1 -1
- package/dist/utils/mdx.js +22 -22
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.d.ts +9 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +66 -76
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/security.d.ts +4 -1
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js +19 -40
- package/dist/utils/security.js.map +1 -1
- package/package.json +5 -5
- package/.docs/organized/code-examples/with-parent-id-grouping.md +0 -596
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -151
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -230
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +0 -41
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
- package/.docs/raw/docs/guides/tool-ui.mdx +0 -858
- package/.docs/raw/docs/guides/tools.mdx +0 -675
- package/dist/prepare-docs/prepare.d.ts.map +0 -1
- package/dist/stdio.d.ts.map +0 -1
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
- /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-14.mdx +0 -0
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: MessagePrimitive
|
|
3
|
-
description:
|
|
3
|
+
description: Message primitives for rendering assistant and user turns, message parts, attachments, actions, editing, and branch controls.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
import { MessagePrimitiveAttachmentByIndexProps, MessagePrimitiveAttachmentsProps, MessagePrimitiveContentProps, MessagePrimitiveGenerativeUIProps, MessagePrimitiveGroupedPartsProps, MessagePrimitiveIfProps, MessagePrimitivePartByIndexProps, MessagePrimitivePartsProps, MessagePrimitiveQuoteProps, MessagePrimitiveRootProps, MessagePrimitiveUnstable_PartsGroupedByParentIdProps, MessagePrimitiveUnstable_PartsGroupedProps } from "@/generated/typeDocs";
|
|
6
7
|
import { MessagePrimitive as MessagePrimitiveDocs } from "@/generated/primitiveDocs";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
10
|
+
{/* Do not edit manually. */}
|
|
9
11
|
|
|
12
|
+
For examples and usage patterns, see [Message](/docs/primitives/message).
|
|
10
13
|
|
|
14
|
+
{/* api-manual:start */}
|
|
11
15
|
## Anatomy
|
|
12
16
|
|
|
13
17
|
```tsx
|
|
@@ -29,641 +33,251 @@ const AssistantMessage = () => (
|
|
|
29
33
|
</MessagePrimitive.Root>
|
|
30
34
|
);
|
|
31
35
|
```
|
|
36
|
+
{/* api-manual:end */}
|
|
37
|
+
|
|
38
|
+
{/* api-reference:start */}
|
|
39
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
40
|
+
{/* Do not edit this block manually. */}
|
|
32
41
|
|
|
33
42
|
## API Reference
|
|
34
43
|
|
|
35
44
|
### Root
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
{MessagePrimitiveDocs.Root?.deprecated && (
|
|
47
|
+
<Callout type="warn">
|
|
48
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Root.deprecated}
|
|
49
|
+
</Callout>
|
|
50
|
+
)}
|
|
38
51
|
|
|
39
|
-
|
|
52
|
+
{MessagePrimitiveDocs.Root?.description}
|
|
40
53
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
name: "asChild",
|
|
46
|
-
},
|
|
47
|
-
]}
|
|
48
|
-
/>
|
|
54
|
+
{MessagePrimitiveDocs.Root?.element && (
|
|
55
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Root?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
56
|
+
)}
|
|
49
57
|
|
|
50
|
-
|
|
58
|
+
<ParametersTable {...MessagePrimitiveRootProps} />
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<ParametersTable
|
|
55
|
-
type="MessagePrimitivePartsProps"
|
|
56
|
-
parameters={[
|
|
57
|
-
{
|
|
58
|
-
name: "components",
|
|
59
|
-
required: false,
|
|
60
|
-
type: "MessagePartComponents",
|
|
61
|
-
description: "The components to render for each message part.",
|
|
62
|
-
children: [
|
|
63
|
-
{
|
|
64
|
-
type: "MessagePartComponents",
|
|
65
|
-
parameters: [
|
|
66
|
-
{
|
|
67
|
-
name: "Text",
|
|
68
|
-
type: "TextMessagePartComponent",
|
|
69
|
-
description:
|
|
70
|
-
"The component to render for each text message part.",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "Image",
|
|
74
|
-
type: "ImageMessagePartComponent",
|
|
75
|
-
description:
|
|
76
|
-
"The component to render for each image message part.",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "Source",
|
|
80
|
-
type: "SourceMessagePartComponent",
|
|
81
|
-
description:
|
|
82
|
-
"The component to render for each source message part.",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "File",
|
|
86
|
-
type: "FileMessagePartComponent",
|
|
87
|
-
description:
|
|
88
|
-
"The component to render for each file message part.",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "Unstable_Audio",
|
|
92
|
-
type: "Unstable_AudioMessagePartComponent",
|
|
93
|
-
description:
|
|
94
|
-
"The component to render for each audio message part.",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "Reasoning",
|
|
98
|
-
type: "ReasoningMessagePartComponent",
|
|
99
|
-
description:
|
|
100
|
-
"Deprecated components-map renderer for each reasoning message part. Prefer the children render function or MessagePrimitive.GroupedParts.",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "tools",
|
|
104
|
-
type: "object",
|
|
105
|
-
description:
|
|
106
|
-
"Deprecated components-map configuration for tool call rendering. Prefer part.toolUI in the children render function or MessagePrimitive.GroupedParts.",
|
|
107
|
-
children: [
|
|
108
|
-
{
|
|
109
|
-
parameters: [
|
|
110
|
-
{
|
|
111
|
-
name: "by_name",
|
|
112
|
-
type: "Record<string, ToolCallMessagePartComponent>",
|
|
113
|
-
description:
|
|
114
|
-
"Map of tool names to their specific components.",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "Fallback",
|
|
118
|
-
type: "ToolCallMessagePartComponent",
|
|
119
|
-
description:
|
|
120
|
-
"Fallback component for tool calls not matched by by_name.",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: "Override",
|
|
124
|
-
type: "ComponentType<ToolCallMessagePartProps>",
|
|
125
|
-
description:
|
|
126
|
-
"Override component that handles all tool calls. When set, by_name and Fallback are ignored.",
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "data",
|
|
134
|
-
type: "object",
|
|
135
|
-
description:
|
|
136
|
-
"Configuration for data part rendering.",
|
|
137
|
-
children: [
|
|
138
|
-
{
|
|
139
|
-
parameters: [
|
|
140
|
-
{
|
|
141
|
-
name: "by_name",
|
|
142
|
-
type: "Record<string, DataMessagePartComponent>",
|
|
143
|
-
description:
|
|
144
|
-
"Map of data event names to their specific components.",
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "Fallback",
|
|
148
|
-
type: "DataMessagePartComponent",
|
|
149
|
-
description:
|
|
150
|
-
"Fallback component for data events not matched by by_name.",
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "ToolGroup",
|
|
158
|
-
type: "ComponentType<PropsWithChildren<{ startIndex: number; endIndex: number }>>",
|
|
159
|
-
description:
|
|
160
|
-
"Deprecated legacy wrapper for grouped consecutive tool calls. Prefer MessagePrimitive.GroupedParts with groupBy returning \"group-tool\".",
|
|
161
|
-
children: [
|
|
162
|
-
{
|
|
163
|
-
type: "ToolGroupProps",
|
|
164
|
-
parameters: [
|
|
165
|
-
{
|
|
166
|
-
name: "startIndex",
|
|
167
|
-
type: "number",
|
|
168
|
-
description: "Index of the first tool call in the group.",
|
|
169
|
-
required: true,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: "endIndex",
|
|
173
|
-
type: "number",
|
|
174
|
-
description: "Index of the last tool call in the group.",
|
|
175
|
-
required: true,
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: "children",
|
|
179
|
-
type: "ReactNode",
|
|
180
|
-
description:
|
|
181
|
-
"The rendered tool call components within the group.",
|
|
182
|
-
required: true,
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
name: "ReasoningGroup",
|
|
190
|
-
type: "ReasoningGroupComponent",
|
|
191
|
-
description:
|
|
192
|
-
"Deprecated legacy wrapper for grouped consecutive reasoning parts. Prefer MessagePrimitive.GroupedParts with groupBy returning \"group-reasoning\".",
|
|
193
|
-
children: [
|
|
194
|
-
{
|
|
195
|
-
type: "ReasoningGroupProps",
|
|
196
|
-
parameters: [
|
|
197
|
-
{
|
|
198
|
-
name: "startIndex",
|
|
199
|
-
type: "number",
|
|
200
|
-
description: "Index of the first reasoning part in the group.",
|
|
201
|
-
required: true,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: "endIndex",
|
|
205
|
-
type: "number",
|
|
206
|
-
description: "Index of the last reasoning part in the group.",
|
|
207
|
-
required: true,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
name: "children",
|
|
211
|
-
type: "ReactNode",
|
|
212
|
-
description:
|
|
213
|
-
"The rendered reasoning part components within the group.",
|
|
214
|
-
required: true,
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
},
|
|
218
|
-
],
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "ChainOfThought",
|
|
222
|
-
type: "ComponentType",
|
|
223
|
-
description:
|
|
224
|
-
"Deprecated legacy grouping path. Prefer MessagePrimitive.GroupedParts for grouped reasoning and tool calls.",
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
name: "Empty",
|
|
228
|
-
type: "EmptyMessagePartComponent",
|
|
229
|
-
description:
|
|
230
|
-
"Component to render when the message has no parts, or when unstable_showEmptyOnNonTextEnd is enabled and the last part is not text or reasoning.",
|
|
231
|
-
},
|
|
232
|
-
],
|
|
233
|
-
},
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
name: "unstable_showEmptyOnNonTextEnd",
|
|
238
|
-
required: false,
|
|
239
|
-
type: "boolean",
|
|
240
|
-
description:
|
|
241
|
-
"When enabled, shows the Empty component if the last part in the message is anything other than Text or Reasoning. Defaults to true.",
|
|
242
|
-
},
|
|
243
|
-
]}
|
|
244
|
-
/>
|
|
60
|
+
### Parts
|
|
245
61
|
|
|
246
|
-
|
|
62
|
+
{MessagePrimitiveDocs.Parts?.deprecated && (
|
|
63
|
+
<Callout type="warn">
|
|
64
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Parts.deprecated}
|
|
65
|
+
</Callout>
|
|
66
|
+
)}
|
|
247
67
|
|
|
248
|
-
|
|
68
|
+
{MessagePrimitiveDocs.Parts?.description}
|
|
249
69
|
|
|
250
|
-
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
</MessagePrimitive.Quote>
|
|
254
|
-
```
|
|
70
|
+
{MessagePrimitiveDocs.Parts?.element && (
|
|
71
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Parts?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
72
|
+
)}
|
|
255
73
|
|
|
256
|
-
<ParametersTable
|
|
257
|
-
type="MessagePrimitiveQuoteProps"
|
|
258
|
-
parameters={[
|
|
259
|
-
{
|
|
260
|
-
name: "children",
|
|
261
|
-
required: true,
|
|
262
|
-
type: "(quote: QuoteInfo) => ReactNode",
|
|
263
|
-
description: "Render function called when a quote is present. Receives { text, messageId }.",
|
|
264
|
-
},
|
|
265
|
-
]}
|
|
266
|
-
/>
|
|
74
|
+
<ParametersTable {...MessagePrimitivePartsProps} />
|
|
267
75
|
|
|
268
76
|
### PartByIndex
|
|
269
77
|
|
|
270
|
-
|
|
78
|
+
{MessagePrimitiveDocs.PartByIndex?.deprecated && (
|
|
79
|
+
<Callout type="warn">
|
|
80
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.PartByIndex.deprecated}
|
|
81
|
+
</Callout>
|
|
82
|
+
)}
|
|
271
83
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
84
|
+
{MessagePrimitiveDocs.PartByIndex?.description}
|
|
85
|
+
|
|
86
|
+
{MessagePrimitiveDocs.PartByIndex?.element && (
|
|
87
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.PartByIndex?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
<ParametersTable {...MessagePrimitivePartByIndexProps} />
|
|
91
|
+
|
|
92
|
+
### Content
|
|
93
|
+
|
|
94
|
+
{MessagePrimitiveDocs.Content?.deprecated && (
|
|
95
|
+
<Callout type="warn">
|
|
96
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Content.deprecated}
|
|
97
|
+
</Callout>
|
|
98
|
+
)}
|
|
99
|
+
|
|
100
|
+
{MessagePrimitiveDocs.Content?.description}
|
|
101
|
+
|
|
102
|
+
{MessagePrimitiveDocs.Content?.element && (
|
|
103
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Content?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
104
|
+
)}
|
|
105
|
+
|
|
106
|
+
<ParametersTable {...MessagePrimitiveContentProps} />
|
|
281
107
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
]}
|
|
298
|
-
/>
|
|
108
|
+
### If
|
|
109
|
+
|
|
110
|
+
{MessagePrimitiveDocs.If?.deprecated && (
|
|
111
|
+
<Callout type="warn">
|
|
112
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.If.deprecated}
|
|
113
|
+
</Callout>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
{MessagePrimitiveDocs.If?.description}
|
|
117
|
+
|
|
118
|
+
{MessagePrimitiveDocs.If?.element && (
|
|
119
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.If?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
120
|
+
)}
|
|
121
|
+
|
|
122
|
+
<ParametersTable {...MessagePrimitiveIfProps} />
|
|
299
123
|
|
|
300
124
|
### Attachments
|
|
301
125
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
<
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
{
|
|
316
|
-
name: "Image",
|
|
317
|
-
type: "ComponentType",
|
|
318
|
-
description: "The component to render for image attachments.",
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: "Document",
|
|
322
|
-
type: "ComponentType",
|
|
323
|
-
description: "The component to render for document attachments.",
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: "File",
|
|
327
|
-
type: "ComponentType",
|
|
328
|
-
description: "The component to render for file attachments.",
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
name: "Attachment",
|
|
332
|
-
type: "ComponentType",
|
|
333
|
-
description: "The fallback component to render for any attachment type.",
|
|
334
|
-
},
|
|
335
|
-
],
|
|
336
|
-
},
|
|
337
|
-
],
|
|
338
|
-
},
|
|
339
|
-
]}
|
|
340
|
-
/>
|
|
126
|
+
{MessagePrimitiveDocs.Attachments?.deprecated && (
|
|
127
|
+
<Callout type="warn">
|
|
128
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Attachments.deprecated}
|
|
129
|
+
</Callout>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
{MessagePrimitiveDocs.Attachments?.description}
|
|
133
|
+
|
|
134
|
+
{MessagePrimitiveDocs.Attachments?.element && (
|
|
135
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Attachments?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
<ParametersTable {...MessagePrimitiveAttachmentsProps} />
|
|
341
139
|
|
|
342
140
|
### AttachmentByIndex
|
|
343
141
|
|
|
344
|
-
|
|
142
|
+
{MessagePrimitiveDocs.AttachmentByIndex?.deprecated && (
|
|
143
|
+
<Callout type="warn">
|
|
144
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.AttachmentByIndex.deprecated}
|
|
145
|
+
</Callout>
|
|
146
|
+
)}
|
|
345
147
|
|
|
346
|
-
|
|
347
|
-
<MessagePrimitive.AttachmentByIndex
|
|
348
|
-
index={0}
|
|
349
|
-
components={{
|
|
350
|
-
Image: MyImageAttachment,
|
|
351
|
-
Document: MyDocumentAttachment
|
|
352
|
-
}}
|
|
353
|
-
/>
|
|
354
|
-
```
|
|
148
|
+
{MessagePrimitiveDocs.AttachmentByIndex?.description}
|
|
355
149
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
{
|
|
360
|
-
name: "index",
|
|
361
|
-
type: "number",
|
|
362
|
-
required: true,
|
|
363
|
-
description: "The index of the attachment to render.",
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
name: "components",
|
|
367
|
-
type: "AttachmentComponents",
|
|
368
|
-
description: "The components to render for the attachment.",
|
|
369
|
-
},
|
|
370
|
-
]}
|
|
371
|
-
/>
|
|
372
|
-
|
|
373
|
-
### useMessageQuote()
|
|
374
|
-
|
|
375
|
-
A hook that returns the quote info attached to the current message, if any. Reads from `message.metadata.custom.quote`.
|
|
150
|
+
{MessagePrimitiveDocs.AttachmentByIndex?.element && (
|
|
151
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.AttachmentByIndex?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
152
|
+
)}
|
|
376
153
|
|
|
377
|
-
|
|
378
|
-
import { useMessageQuote } from "@assistant-ui/react";
|
|
379
|
-
|
|
380
|
-
const QuoteBlock = () => {
|
|
381
|
-
const quote = useMessageQuote();
|
|
382
|
-
if (!quote) return null;
|
|
383
|
-
|
|
384
|
-
return (
|
|
385
|
-
<div className="mb-2 flex items-start gap-1.5 text-sm italic text-muted-foreground">
|
|
386
|
-
{quote.text}
|
|
387
|
-
</div>
|
|
388
|
-
);
|
|
389
|
-
};
|
|
390
|
-
```
|
|
154
|
+
<ParametersTable {...MessagePrimitiveAttachmentByIndexProps} />
|
|
391
155
|
|
|
392
|
-
|
|
156
|
+
### Quote
|
|
393
157
|
|
|
394
|
-
|
|
395
|
-
type
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
|
|
158
|
+
{MessagePrimitiveDocs.Quote?.deprecated && (
|
|
159
|
+
<Callout type="warn">
|
|
160
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Quote.deprecated}
|
|
161
|
+
</Callout>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
{MessagePrimitiveDocs.Quote?.description}
|
|
165
|
+
|
|
166
|
+
{MessagePrimitiveDocs.Quote?.element && (
|
|
167
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Quote?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
168
|
+
)}
|
|
400
169
|
|
|
401
|
-
<
|
|
402
|
-
|
|
403
|
-
|
|
170
|
+
<ParametersTable {...MessagePrimitiveQuoteProps} />
|
|
171
|
+
|
|
172
|
+
### Error
|
|
173
|
+
|
|
174
|
+
{MessagePrimitiveDocs.Error?.deprecated && (
|
|
175
|
+
<Callout type="warn">
|
|
176
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Error.deprecated}
|
|
177
|
+
</Callout>
|
|
178
|
+
)}
|
|
179
|
+
|
|
180
|
+
{MessagePrimitiveDocs.Error?.description}
|
|
181
|
+
|
|
182
|
+
{MessagePrimitiveDocs.Error?.element && (
|
|
183
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Error?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
{MessagePrimitiveDocs.Error?.props && (
|
|
187
|
+
<ParametersTable type={MessagePrimitiveDocs.Error?.element} parameters={MessagePrimitiveDocs.Error.props} />
|
|
188
|
+
)}
|
|
404
189
|
|
|
405
190
|
### GroupedParts
|
|
406
191
|
|
|
407
|
-
|
|
192
|
+
{MessagePrimitiveDocs.GroupedParts?.deprecated && (
|
|
193
|
+
<Callout type="warn">
|
|
194
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.GroupedParts.deprecated}
|
|
195
|
+
</Callout>
|
|
196
|
+
)}
|
|
408
197
|
|
|
409
|
-
|
|
410
|
-
<MessagePrimitive.GroupedParts
|
|
411
|
-
groupBy={(part) => {
|
|
412
|
-
if (part.type === "reasoning")
|
|
413
|
-
return ["group-chainOfThought", "group-reasoning"];
|
|
414
|
-
if (part.type === "tool-call")
|
|
415
|
-
return ["group-chainOfThought", "group-tool"];
|
|
416
|
-
return null;
|
|
417
|
-
}}
|
|
418
|
-
>
|
|
419
|
-
{({ part, children }) => {
|
|
420
|
-
switch (part.type) {
|
|
421
|
-
case "group-chainOfThought":
|
|
422
|
-
return <div>{children}</div>;
|
|
423
|
-
case "group-reasoning":
|
|
424
|
-
return <ReasoningRoot>{children}</ReasoningRoot>;
|
|
425
|
-
case "group-tool":
|
|
426
|
-
return <ToolGroupRoot>{children}</ToolGroupRoot>;
|
|
427
|
-
case "text":
|
|
428
|
-
return <MarkdownText />;
|
|
429
|
-
case "reasoning":
|
|
430
|
-
return <Reasoning {...part} />;
|
|
431
|
-
case "tool-call":
|
|
432
|
-
return part.toolUI ?? <ToolFallback {...part} />;
|
|
433
|
-
case "data":
|
|
434
|
-
return part.dataRendererUI;
|
|
435
|
-
default:
|
|
436
|
-
return null;
|
|
437
|
-
}
|
|
438
|
-
}}
|
|
439
|
-
</MessagePrimitive.GroupedParts>
|
|
440
|
-
```
|
|
198
|
+
{MessagePrimitiveDocs.GroupedParts?.description}
|
|
441
199
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
/>
|
|
200
|
+
{MessagePrimitiveDocs.GroupedParts?.element && (
|
|
201
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.GroupedParts?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
202
|
+
)}
|
|
446
203
|
|
|
447
|
-
|
|
204
|
+
<ParametersTable {...MessagePrimitiveGroupedPartsProps} />
|
|
448
205
|
|
|
449
|
-
|
|
206
|
+
### GenerativeUI
|
|
450
207
|
|
|
451
|
-
|
|
208
|
+
{MessagePrimitiveDocs.GenerativeUI?.deprecated && (
|
|
209
|
+
<Callout type="warn">
|
|
210
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.GenerativeUI.deprecated}
|
|
211
|
+
</Callout>
|
|
212
|
+
)}
|
|
452
213
|
|
|
453
|
-
|
|
454
|
-
This API is unstable and may change in a future release.
|
|
455
|
-
</Callout>
|
|
214
|
+
{MessagePrimitiveDocs.GenerativeUI?.description}
|
|
456
215
|
|
|
457
|
-
|
|
458
|
-
<
|
|
459
|
-
|
|
460
|
-
const groups = new Map<string, number[]>();
|
|
461
|
-
parts.forEach((part, i) => {
|
|
462
|
-
const key = part.parentId ?? `__ungrouped_${i}`;
|
|
463
|
-
const indices = groups.get(key) ?? [];
|
|
464
|
-
indices.push(i);
|
|
465
|
-
groups.set(key, indices);
|
|
466
|
-
});
|
|
467
|
-
return Array.from(groups.entries()).map(([key, indices]) => ({
|
|
468
|
-
groupKey: key.startsWith("__ungrouped_") ? undefined : key,
|
|
469
|
-
indices,
|
|
470
|
-
}));
|
|
471
|
-
}}
|
|
472
|
-
components={{
|
|
473
|
-
Text: ({ text }) => <p>{text}</p>,
|
|
474
|
-
Group: ({ groupKey, indices, children }) => {
|
|
475
|
-
if (!groupKey) return <>{children}</>;
|
|
476
|
-
return (
|
|
477
|
-
<div className="parent-group">
|
|
478
|
-
<h4>Parent: {groupKey}</h4>
|
|
479
|
-
{children}
|
|
480
|
-
</div>
|
|
481
|
-
);
|
|
482
|
-
},
|
|
483
|
-
}}
|
|
484
|
-
/>
|
|
485
|
-
```
|
|
216
|
+
{MessagePrimitiveDocs.GenerativeUI?.element && (
|
|
217
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.GenerativeUI?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
218
|
+
)}
|
|
486
219
|
|
|
487
|
-
<ParametersTable
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
parameters: [
|
|
505
|
-
{
|
|
506
|
-
name: "Text",
|
|
507
|
-
type: "TextMessagePartComponent",
|
|
508
|
-
description: "The component to render for each text message part.",
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: "Reasoning",
|
|
512
|
-
type: "ReasoningMessagePartComponent",
|
|
513
|
-
description: "The component to render for each reasoning message part.",
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
name: "Source",
|
|
517
|
-
type: "SourceMessagePartComponent",
|
|
518
|
-
description: "The component to render for each source message part.",
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
name: "Image",
|
|
522
|
-
type: "ImageMessagePartComponent",
|
|
523
|
-
description: "The component to render for each image message part.",
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
name: "File",
|
|
527
|
-
type: "FileMessagePartComponent",
|
|
528
|
-
description: "The component to render for each file message part.",
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
name: "Unstable_Audio",
|
|
532
|
-
type: "Unstable_AudioMessagePartComponent",
|
|
533
|
-
description: "The component to render for each audio message part.",
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
name: "Empty",
|
|
537
|
-
type: "EmptyMessagePartComponent",
|
|
538
|
-
description: "Component to render when the message has no parts.",
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
name: "tools",
|
|
542
|
-
type: "object",
|
|
543
|
-
description: "Configuration for tool call rendering.",
|
|
544
|
-
children: [
|
|
545
|
-
{
|
|
546
|
-
parameters: [
|
|
547
|
-
{
|
|
548
|
-
name: "by_name",
|
|
549
|
-
type: "Record<string, ToolCallMessagePartComponent>",
|
|
550
|
-
description: "Map of tool names to their specific components.",
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
name: "Fallback",
|
|
554
|
-
type: "ToolCallMessagePartComponent",
|
|
555
|
-
description:
|
|
556
|
-
"Fallback component for tool calls not matched by by_name.",
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
name: "Override",
|
|
560
|
-
type: "ComponentType<ToolCallMessagePartProps>",
|
|
561
|
-
description:
|
|
562
|
-
"Override component that handles all tool calls. When set, by_name and Fallback are ignored.",
|
|
563
|
-
},
|
|
564
|
-
],
|
|
565
|
-
},
|
|
566
|
-
],
|
|
567
|
-
},
|
|
568
|
-
{
|
|
569
|
-
name: "data",
|
|
570
|
-
type: "object",
|
|
571
|
-
description: "Configuration for data part rendering.",
|
|
572
|
-
children: [
|
|
573
|
-
{
|
|
574
|
-
parameters: [
|
|
575
|
-
{
|
|
576
|
-
name: "by_name",
|
|
577
|
-
type: "Record<string, DataMessagePartComponent>",
|
|
578
|
-
description:
|
|
579
|
-
"Map of data event names to their specific components.",
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
name: "Fallback",
|
|
583
|
-
type: "DataMessagePartComponent",
|
|
584
|
-
description:
|
|
585
|
-
"Fallback component for data events not matched by by_name.",
|
|
586
|
-
},
|
|
587
|
-
],
|
|
588
|
-
},
|
|
589
|
-
],
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
name: "Group",
|
|
593
|
-
type: "ComponentType<PropsWithChildren<{ groupKey: string | undefined; indices: number[] }>>",
|
|
594
|
-
description:
|
|
595
|
-
"Component for rendering a group of message parts. Receives the groupKey (undefined for ungrouped parts), the indices of all parts in the group, and the rendered part children.",
|
|
596
|
-
children: [
|
|
597
|
-
{
|
|
598
|
-
type: "GroupProps",
|
|
599
|
-
parameters: [
|
|
600
|
-
{
|
|
601
|
-
name: "groupKey",
|
|
602
|
-
type: "string | undefined",
|
|
603
|
-
description:
|
|
604
|
-
"The group key, or undefined for ungrouped parts.",
|
|
605
|
-
required: true,
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
name: "indices",
|
|
609
|
-
type: "number[]",
|
|
610
|
-
description:
|
|
611
|
-
"Array of indices of the message parts belonging to this group.",
|
|
612
|
-
required: true,
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
name: "children",
|
|
616
|
-
type: "ReactNode",
|
|
617
|
-
description:
|
|
618
|
-
"The rendered message part components within the group.",
|
|
619
|
-
required: true,
|
|
620
|
-
},
|
|
621
|
-
],
|
|
622
|
-
},
|
|
623
|
-
],
|
|
624
|
-
},
|
|
625
|
-
],
|
|
626
|
-
},
|
|
627
|
-
],
|
|
628
|
-
},
|
|
629
|
-
]}
|
|
630
|
-
/>
|
|
220
|
+
<ParametersTable {...MessagePrimitiveGenerativeUIProps} />
|
|
221
|
+
|
|
222
|
+
### Unstable_PartsGrouped
|
|
223
|
+
|
|
224
|
+
{MessagePrimitiveDocs.Unstable_PartsGrouped?.deprecated && (
|
|
225
|
+
<Callout type="warn">
|
|
226
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Unstable_PartsGrouped.deprecated}
|
|
227
|
+
</Callout>
|
|
228
|
+
)}
|
|
229
|
+
|
|
230
|
+
{MessagePrimitiveDocs.Unstable_PartsGrouped?.description}
|
|
231
|
+
|
|
232
|
+
{MessagePrimitiveDocs.Unstable_PartsGrouped?.element && (
|
|
233
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Unstable_PartsGrouped?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
<ParametersTable {...MessagePrimitiveUnstable_PartsGroupedProps} />
|
|
631
237
|
|
|
632
238
|
### Unstable_PartsGroupedByParentId
|
|
633
239
|
|
|
634
|
-
|
|
240
|
+
{MessagePrimitiveDocs.Unstable_PartsGroupedByParentId?.deprecated && (
|
|
241
|
+
<Callout type="warn">
|
|
242
|
+
<strong>Deprecated.</strong> {MessagePrimitiveDocs.Unstable_PartsGroupedByParentId.deprecated}
|
|
243
|
+
</Callout>
|
|
244
|
+
)}
|
|
635
245
|
|
|
636
|
-
|
|
637
|
-
This API is unstable and may change in a future release.
|
|
638
|
-
</Callout>
|
|
246
|
+
{MessagePrimitiveDocs.Unstable_PartsGroupedByParentId?.description}
|
|
639
247
|
|
|
640
|
-
|
|
641
|
-
<
|
|
642
|
-
|
|
643
|
-
Group: ({ groupKey, children }) => {
|
|
644
|
-
if (!groupKey) return <>{children}</>;
|
|
645
|
-
return (
|
|
646
|
-
<div className="parent-group border rounded p-4">
|
|
647
|
-
<h4>Parent ID: {groupKey}</h4>
|
|
648
|
-
{children}
|
|
649
|
-
</div>
|
|
650
|
-
);
|
|
651
|
-
},
|
|
652
|
-
}}
|
|
653
|
-
/>
|
|
654
|
-
```
|
|
248
|
+
{MessagePrimitiveDocs.Unstable_PartsGroupedByParentId?.element && (
|
|
249
|
+
<p>This primitive renders a <code>{`<${MessagePrimitiveDocs.Unstable_PartsGroupedByParentId?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
250
|
+
)}
|
|
655
251
|
|
|
656
|
-
|
|
252
|
+
<ParametersTable {...MessagePrimitiveUnstable_PartsGroupedByParentIdProps} />
|
|
657
253
|
|
|
658
|
-
###
|
|
254
|
+
### groupPartByType
|
|
255
|
+
|
|
256
|
+
Build a `groupBy` from a `part.type → group-key path` lookup.
|
|
257
|
+
Parts whose type isn't in the map are left ungrouped. The returned
|
|
258
|
+
function carries a stable GROUPBY_MEMO_KEY fingerprint so
|
|
259
|
+
`<MessagePrimitive.GroupedParts>` can memoize its tree across renders.
|
|
659
260
|
|
|
660
|
-
|
|
261
|
+
The synthetic `"standalone-tool-call"` key matches tool calls that should
|
|
262
|
+
render outside the chain-of-thought grouping. MCP-app calls are detected from
|
|
263
|
+
the part alone; the registry-driven cases (human tools, the generative-UI
|
|
264
|
+
tool, `display: "standalone"` opt-ins) are resolved from the
|
|
265
|
+
GroupByContext that `<MessagePrimitive.GroupedParts>` passes to the
|
|
266
|
+
`groupBy` function — the helper needs nothing threaded into it.
|
|
661
267
|
|
|
662
268
|
```tsx
|
|
663
|
-
<MessagePrimitive.
|
|
664
|
-
{
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
269
|
+
<MessagePrimitive.GroupedParts
|
|
270
|
+
groupBy={groupPartByType({
|
|
271
|
+
reasoning: ["group-thought", "group-reasoning"],
|
|
272
|
+
"tool-call": ["group-thought", "group-tool"],
|
|
273
|
+
"standalone-tool-call": [],
|
|
274
|
+
})}
|
|
275
|
+
>
|
|
276
|
+
{({ part, children }) => { ... }}
|
|
277
|
+
</MessagePrimitive.GroupedParts>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
const groupPartByType: <TKey extends `group-${string}`>(map: Partial<Readonly<Record<GroupPartType, readonly TKey[]>>>) => ((part: PartState, context?: GroupByContext) => readonly TKey[]);
|
|
669
282
|
```
|
|
283
|
+
{/* api-reference:end */}
|