You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/2.components/chat-message.md
+38-16Lines changed: 38 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@ The ChatMessage component renders an `<article>` element for a `user` or `assist
16
16
17
17
::u-chat-message
18
18
---
19
-
content: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
19
+
parts:
20
+
- type: 'text'
21
+
text: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
20
22
side: 'right'
21
23
variant: 'soft'
22
24
avatar:
@@ -30,18 +32,26 @@ avatar:
30
32
Use the [`ChatMessages`](/docs/components/chat-messages) component to display a list of chat messages.
31
33
::
32
34
33
-
### Content
35
+
### Parts
34
36
35
-
Use the `content` prop to display the message content.
37
+
Use the `parts` prop to display the message content using the AI SDK v5 format.
36
38
37
39
::component-code
38
40
---
39
41
prettier: true
42
+
ignore:
43
+
- parts
40
44
props:
41
-
content: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
45
+
parts:
46
+
- type: 'text'
47
+
text: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
42
48
---
43
49
::
44
50
51
+
::note
52
+
The `parts` prop is the recommended format for AI SDK v5. Each part has a `type` (e.g., 'text') and corresponding content. The ChatMessage component also supports the deprecated `content` prop for backward compatibility.
53
+
::
54
+
45
55
### Side
46
56
47
57
Use the `side` prop to display the message on the left or right.
@@ -50,10 +60,12 @@ Use the `side` prop to display the message on the left or right.
50
60
---
51
61
prettier: true
52
62
ignore:
53
-
-content
63
+
-parts
54
64
props:
55
65
side: 'right'
56
-
content: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
66
+
parts:
67
+
- type: 'text'
68
+
text: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
57
69
---
58
70
::
59
71
@@ -69,10 +81,12 @@ Use the `variant` prop to change style of the message.
69
81
---
70
82
prettier: true
71
83
ignore:
72
-
-content
84
+
-parts
73
85
props:
74
86
variant: 'soft'
75
-
content: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
87
+
parts:
88
+
- type: 'text'
89
+
text: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
76
90
---
77
91
::
78
92
@@ -88,14 +102,16 @@ Use the `icon` prop to display an [Icon](/docs/components/icon) component next t
88
102
---
89
103
prettier: true
90
104
ignore:
91
-
-content
105
+
-parts
92
106
- side
93
107
- variant
94
108
props:
95
109
icon: i-lucide-user
96
110
variant: 'soft'
97
111
side: 'right'
98
-
content: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
112
+
parts:
113
+
- type: 'text'
114
+
text: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
99
115
---
100
116
::
101
117
@@ -107,15 +123,17 @@ Use the `avatar` prop to display an [Avatar](/docs/components/avatar) component
107
123
---
108
124
prettier: true
109
125
ignore:
110
-
-content
126
+
-parts
111
127
- side
112
128
- variant
113
129
props:
114
130
avatar:
115
131
src: 'https://github.com/benjamincanac.png'
116
132
variant: 'soft'
117
133
side: 'right'
118
-
content: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
134
+
parts:
135
+
- type: 'text'
136
+
text: 'Hello! Tell me more about building AI chatbots with Nuxt UI.'
119
137
---
120
138
::
121
139
@@ -125,11 +143,13 @@ You can also use the `avatar.icon` prop to display an icon as the avatar.
125
143
---
126
144
prettier: true
127
145
ignore:
128
-
-content
146
+
-parts
129
147
props:
130
148
avatar:
131
149
icon: i-lucide-bot
132
-
content: 'Nuxt UI offers several features for building AI chatbots including the ChatMessage, ChatMessages, and ChatPrompt components. Best practices include using the useChat composable from Vercel AI SDK, implementing proper message styling with variants, and utilizing the built-in actions for message interactions. The components are fully customizable with theming support and responsive design.'
150
+
parts:
151
+
- type: 'text'
152
+
text: 'Nuxt UI offers several features for building AI chatbots including the ChatMessage, ChatMessages, and ChatPrompt components. Best practices include using the Chat class from AI SDK v5, implementing proper message styling with variants, and utilizing the built-in actions for message interactions. The components are fully customizable with theming support and responsive design.'
133
153
---
134
154
::
135
155
@@ -143,13 +163,15 @@ prettier: true
143
163
external:
144
164
- actions
145
165
ignore:
146
-
-content
166
+
-parts
147
167
- actions
148
168
props:
149
169
actions:
150
170
- label: 'Copy to clipboard'
151
171
icon: i-lucide-copy
152
-
content: 'Nuxt UI offers several features for building AI chatbots including the ChatMessage, ChatMessages, and ChatPrompt components. Best practices include using the useChat composable from Vercel AI SDK, implementing proper message styling with variants, and utilizing the built-in actions for message interactions. The components are fully customizable with theming support and responsive design.'
172
+
parts:
173
+
- type: 'text'
174
+
text: 'Nuxt UI offers several features for building AI chatbots including the ChatMessage, ChatMessages, and ChatPrompt components. Best practices include using the Chat class from AI SDK v5, implementing proper message styling with variants, and utilizing the built-in actions for message interactions. The components are fully customizable with theming support and responsive design.'
0 commit comments