@kaifusion/widget 1.0.1 → 1.0.3

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 ADDED
@@ -0,0 +1,70 @@
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
+ icon={<span>💬</span>} // (Optional) Custom icon for the toggle button
53
+ />
54
+ </div>
55
+ );
56
+ }
57
+
58
+ export default App;
59
+ ```
60
+
61
+ ## Props
62
+
63
+ | Prop | Type | Required | Default | Description |
64
+ | ------------ | ------------------- | -------- | ----------- | ---------------------------------------------------------------------------- |
65
+ | `targetUrl` | `string` | **Yes** | - | The address of the KAI Fusion backend API (e.g., `https://api.example.com`). |
66
+ | `workflowId` | `string` | **Yes** | - | Unique identifier (UUID) of the workflow to run. |
67
+ | `authToken` | `string` | **Yes** | - | Bearer token or API Key for API access. |
68
+ | `title` | `string` | No | `"ChatBot"` | Title of the widget window. |
69
+ | `position` | `"left" \| "right"` | No | `"right"` | Position of the widget on the screen (bottom-left or bottom-right). |
70
+ | `color` | `string` | No | `"#526cfe"` | Main theme color of the widget (Hex code). |
@@ -1,9 +1,10 @@
1
1
  export interface KaiChatWidgetProps {
2
- authToken?: string;
3
- workflowId?: string;
2
+ authToken: string;
3
+ workflowId: string;
4
4
  title?: string;
5
- targetUrl?: string;
5
+ targetUrl: string;
6
6
  position?: "left" | "right";
7
7
  color?: string;
8
+ icon?: React.ReactNode;
8
9
  }
9
- export default function KaiChatWidget({ authToken, workflowId, title, targetUrl, position, color, }: KaiChatWidgetProps): import("react/jsx-runtime").JSX.Element;
10
+ export default function KaiChatWidget({ authToken, workflowId, title, targetUrl, position, color, icon, }: KaiChatWidgetProps): import("react/jsx-runtime").JSX.Element;