@kaifusion/widget 1.0.1 → 1.0.2
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 +69 -0
- package/dist/KaiChatWidget.d.ts +3 -3
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/KaiChatWidget.tsx +6 -6
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @kaifusion/widget
|
|
2
|
+
|
|
3
|
+
A customizable, React-based chat widget developed for the KAI Fusion AI platform. This component allows you to easily integrate your KAI Fusion workflows into your website.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Easy Integration:** Add to your site with a single React component.
|
|
8
|
+
- 🎨 **Customizable:** Settings for color, title, and position.
|
|
9
|
+
- 📝 **Markdown Support:** Support for mathematical formulas (KaTeX), code blocks (Syntax Highlighting), and GFM.
|
|
10
|
+
- 📱 **Responsive:** Modern design compatible with mobile and desktop.
|
|
11
|
+
- ⚡ **Real-Time:** Fast interaction with streaming response support.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
You can use your favorite package manager to add the package to your project:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @kaifusion/widget
|
|
19
|
+
# or
|
|
20
|
+
yarn add @kaifusion/widget
|
|
21
|
+
# or
|
|
22
|
+
pnpm add @kaifusion/widget
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
This package requires the following peer dependencies:
|
|
28
|
+
|
|
29
|
+
- React >= 18.0.0
|
|
30
|
+
- React DOM >= 18.0.0
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
You can add the component to your React application as follows:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { KaiChatWidget } from "@kaifusion/widget";
|
|
38
|
+
// import '@kaifusion/widget/dist/style.css'; // Don't forget to include the style file if needed
|
|
39
|
+
|
|
40
|
+
function App() {
|
|
41
|
+
return (
|
|
42
|
+
<div className="App">
|
|
43
|
+
{/* Other application content */}
|
|
44
|
+
|
|
45
|
+
<KaiChatWidget
|
|
46
|
+
targetUrl="http://localhost:8000" // Backend API address
|
|
47
|
+
workflowId="your-workflow-id-value" // ID of the workflow to execute
|
|
48
|
+
authToken="your-api-key-or-token" // API authorization key or token
|
|
49
|
+
title="KAI Assistant" // (Optional) Widget title
|
|
50
|
+
position="right" // (Optional) 'left' or 'right'
|
|
51
|
+
color="#526cfe" // (Optional) Main theme color hex code
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default App;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Props
|
|
61
|
+
|
|
62
|
+
| Prop | Type | Required | Default | Description |
|
|
63
|
+
| ------------ | ------------------- | -------- | ----------- | ---------------------------------------------------------------------------- |
|
|
64
|
+
| `targetUrl` | `string` | **Yes** | - | The address of the KAI Fusion backend API (e.g., `https://api.example.com`). |
|
|
65
|
+
| `workflowId` | `string` | **Yes** | - | Unique identifier (UUID) of the workflow to run. |
|
|
66
|
+
| `authToken` | `string` | **Yes** | - | Bearer token or API Key for API access. |
|
|
67
|
+
| `title` | `string` | No | `"ChatBot"` | Title of the widget window. |
|
|
68
|
+
| `position` | `"left" \| "right"` | No | `"right"` | Position of the widget on the screen (bottom-left or bottom-right). |
|
|
69
|
+
| `color` | `string` | No | `"#526cfe"` | Main theme color of the widget (Hex code). |
|
package/dist/KaiChatWidget.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -66052,9 +66052,9 @@ function xi(e, t, n) {
|
|
|
66052
66052
|
}
|
|
66053
66053
|
function TL({
|
|
66054
66054
|
authToken: e,
|
|
66055
|
-
workflowId: t
|
|
66056
|
-
title: n = "
|
|
66057
|
-
targetUrl: r
|
|
66055
|
+
workflowId: t,
|
|
66056
|
+
title: n = "ChatBot",
|
|
66057
|
+
targetUrl: r,
|
|
66058
66058
|
position: a = "right",
|
|
66059
66059
|
color: i = "#526cfe"
|
|
66060
66060
|
}) {
|