@asgard-js/react 0.0.44-canary.4 → 0.0.44
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
CHANGED
|
@@ -94,7 +94,24 @@ export default App;
|
|
|
94
94
|
|
|
95
95
|
### File Upload Support
|
|
96
96
|
|
|
97
|
-
The Chatbot component includes built-in file upload capabilities for sending images.
|
|
97
|
+
The Chatbot component includes built-in file upload capabilities for sending images. You can control this feature using the `enableUpload` prop.
|
|
98
|
+
|
|
99
|
+
#### Enabling File Upload
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
<Chatbot
|
|
103
|
+
config={{
|
|
104
|
+
apiKey: 'your-api-key',
|
|
105
|
+
botProviderEndpoint: 'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}',
|
|
106
|
+
}}
|
|
107
|
+
customChannelId="your-channel-id"
|
|
108
|
+
enableUpload={true} // Explicitly enable file upload
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Control via Remote Configuration
|
|
113
|
+
|
|
114
|
+
When `enableLoadConfigFromService` is enabled, you can also control the upload feature through the bot provider's `embedConfig`:
|
|
98
115
|
|
|
99
116
|
```javascript
|
|
100
117
|
<Chatbot
|
|
@@ -103,11 +120,17 @@ The Chatbot component includes built-in file upload capabilities for sending ima
|
|
|
103
120
|
botProviderEndpoint: 'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}',
|
|
104
121
|
}}
|
|
105
122
|
customChannelId="your-channel-id"
|
|
106
|
-
|
|
123
|
+
enableLoadConfigFromService={true}
|
|
124
|
+
// Upload feature will be controlled by annotations.embedConfig.enableUpload from the API
|
|
107
125
|
/>
|
|
108
126
|
```
|
|
109
127
|
|
|
110
|
-
**
|
|
128
|
+
**Configuration Priority** (highest to lowest):
|
|
129
|
+
1. `enableUpload` prop value
|
|
130
|
+
2. `annotations.embedConfig.enableUpload` from bot provider metadata
|
|
131
|
+
3. Default: `false`
|
|
132
|
+
|
|
133
|
+
**Features**: Multiple file selection, image preview with modal view, and responsive design. Supports JPEG, PNG, GIF, WebP up to 20MB per file, maximum 10 files at once.
|
|
111
134
|
|
|
112
135
|
### API Key Authentication
|
|
113
136
|
|
|
@@ -198,6 +221,7 @@ config: {
|
|
|
198
221
|
- `onRunError?`: `ErrorEventHandler` - Error handler for execution errors
|
|
199
222
|
- **customActions?**: `ReactNode[]` - Custom actions to display on the chatbot header
|
|
200
223
|
- **enableLoadConfigFromService?**: `boolean` - Enable loading configuration from service
|
|
224
|
+
- **enableUpload?**: `boolean` - Enable file upload functionality. When set, it takes priority over the `embedConfig.enableUpload` setting from the bot provider metadata. Defaults to `false` if not specified in either location. Supports image files (JPEG, PNG, GIF, WebP) up to 20MB per file, maximum 10 files at once.
|
|
201
225
|
- **maintainConnectionWhenClosed?**: `boolean` - Maintain connection when chat is closed, defaults to `false`
|
|
202
226
|
- **loadingComponent?**: `ReactNode` - Custom loading component
|
|
203
227
|
- **asyncInitializers?**: `Record<string, () => Promise<unknown>>` - Asynchronous initializers for app initialization before rendering any component. Good for loading data or other async operations as the initial state. It only works when `enableLoadConfigFromService` is set to `true`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAMV,MAAM,OAAO,CAAC;AAWf,wBAAgB,aAAa,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAMV,MAAM,OAAO,CAAC;AAWf,wBAAgB,aAAa,IAAI,SAAS,CAkUzC"}
|