@blumessage/react-chat 1.7.0 → 1.8.0
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/README.md +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,6 +122,7 @@ function App() {
|
|
|
122
122
|
| `emptyStateText` | `string` | `"Start a conversation!"` | Text shown when no messages are present |
|
|
123
123
|
| `markdown` | `boolean` | `true` | Enable markdown rendering for messages |
|
|
124
124
|
| `disableAutoScroll` | `boolean` | `false` | Disable automatic scrolling to bottom when new messages arrive |
|
|
125
|
+
| `context` | `Record<string, any>` | - | Arbitrary user context data (name, email, etc.) passed to the AI agent for personalized responses |
|
|
125
126
|
| **Event Callbacks** |
|
|
126
127
|
| `onUserMessage` | `(message: Message) => void` | - | Called when user sends message |
|
|
127
128
|
| `onAssistantMessage` | `(message: Message) => void` | - | Called when assistant responds |
|
|
@@ -132,6 +133,25 @@ function App() {
|
|
|
132
133
|
|
|
133
134
|
## Advanced Usage Examples
|
|
134
135
|
|
|
136
|
+
### Providing User Context
|
|
137
|
+
|
|
138
|
+
Pass user data to help the AI agent personalize responses:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<BlumessageChat
|
|
142
|
+
apiKey="your-api-key"
|
|
143
|
+
context={{
|
|
144
|
+
name: "John Doe",
|
|
145
|
+
email: "john@example.com",
|
|
146
|
+
plan: "premium",
|
|
147
|
+
userId: 12345,
|
|
148
|
+
tags: ["vip", "early-adopter"],
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The `context` prop accepts any key-value pairs (`Record<string, any>`). Values can be strings, numbers, booleans, arrays, or objects. The context is sent with every message and merged on the server, so you can update it dynamically across the conversation.
|
|
154
|
+
|
|
135
155
|
### Dark Theme with Callbacks
|
|
136
156
|
|
|
137
157
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blumessage/react-chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A React TypeScript chat widget component with floating button, theming, and Blumessage API integration",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Blumessage <contact@blumessage.com>",
|