@object-ui/plugin-chatbot 3.1.5 → 3.3.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +106 -4
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +12293 -2897
  5. package/dist/index.umd.cjs +101 -28
  6. package/dist/{src → packages/plugin-chatbot/src}/ChatbotEnhanced.d.ts +8 -0
  7. package/dist/packages/plugin-chatbot/src/ChatbotEnhanced.d.ts.map +1 -0
  8. package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts +15 -0
  9. package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts.map +1 -0
  10. package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts +29 -0
  11. package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts.map +1 -0
  12. package/dist/packages/plugin-chatbot/src/FloatingChatbotProvider.d.ts +37 -0
  13. package/dist/packages/plugin-chatbot/src/FloatingChatbotProvider.d.ts.map +1 -0
  14. package/dist/packages/plugin-chatbot/src/FloatingChatbotTrigger.d.ts +21 -0
  15. package/dist/packages/plugin-chatbot/src/FloatingChatbotTrigger.d.ts.map +1 -0
  16. package/dist/{src → packages/plugin-chatbot/src}/index.d.ts +10 -0
  17. package/dist/packages/plugin-chatbot/src/index.d.ts.map +1 -0
  18. package/dist/packages/plugin-chatbot/src/renderer.d.ts.map +1 -0
  19. package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts +112 -0
  20. package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts.map +1 -0
  21. package/dist/packages/plugin-chatbot/src/utils.d.ts.map +1 -0
  22. package/package.json +36 -10
  23. package/.turbo/turbo-build.log +0 -22
  24. package/dist/src/ChatbotEnhanced.d.ts.map +0 -1
  25. package/dist/src/index.d.ts.map +0 -1
  26. package/dist/src/renderer.d.ts.map +0 -1
  27. package/dist/src/utils.d.ts.map +0 -1
  28. package/src/ChatbotEnhanced.tsx +0 -375
  29. package/src/__tests__/ChatbotEnhanced.test.tsx +0 -199
  30. package/src/index.tsx +0 -248
  31. package/src/renderer.tsx +0 -314
  32. package/src/utils.ts +0 -18
  33. package/tsconfig.json +0 -18
  34. package/vite.config.ts +0 -54
  35. /package/dist/{src → packages/plugin-chatbot/src}/renderer.d.ts +0 -0
  36. /package/dist/{src → packages/plugin-chatbot/src}/utils.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @object-ui/plugin-chatbot
2
2
 
3
+ ## 3.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b429568]
8
+ - @object-ui/components@3.3.1
9
+ - @object-ui/types@3.3.1
10
+ - @object-ui/core@3.3.1
11
+ - @object-ui/react@3.3.1
12
+
13
+ ## 3.3.0
14
+
15
+ ### Patch Changes
16
+
17
+ - @object-ui/types@3.3.0
18
+ - @object-ui/core@3.3.0
19
+ - @object-ui/react@3.3.0
20
+ - @object-ui/components@3.3.0
21
+
22
+ ## 3.2.0
23
+
24
+ ### Patch Changes
25
+
26
+ - @object-ui/types@3.2.0
27
+ - @object-ui/core@3.2.0
28
+ - @object-ui/react@3.2.0
29
+ - @object-ui/components@3.2.0
30
+
3
31
  ## 3.1.5
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @object-ui/plugin-chatbot
2
2
 
3
- Chatbot interface plugin for Object UI.
3
+ Chatbot interface plugin for Object UI with full AI SDUI support.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,6 +10,8 @@ npm install @object-ui/plugin-chatbot
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### Basic (Local/Demo Mode)
14
+
13
15
  ```tsx
14
16
  import { Chatbot } from '@object-ui/plugin-chatbot';
15
17
 
@@ -41,6 +43,63 @@ function App() {
41
43
  }
42
44
  ```
43
45
 
46
+ ### AI Streaming Mode (service-ai)
47
+
48
+ When `api` is set in the schema, the chatbot connects to a backend SSE endpoint
49
+ using `@ai-sdk/react` for streaming, tool-calling, and production-grade chat:
50
+
51
+ ```tsx
52
+ import '@object-ui/plugin-chatbot';
53
+
54
+ const schema = {
55
+ type: 'chatbot',
56
+ api: '/api/v1/ai/chat',
57
+ model: 'gpt-4o',
58
+ systemPrompt: 'You are a helpful assistant.',
59
+ streamingEnabled: true,
60
+ conversationId: 'conv-123',
61
+ messages: [
62
+ { id: '1', role: 'assistant', content: 'Hello! Ask me anything.' }
63
+ ],
64
+ placeholder: 'Type your message...',
65
+ };
66
+ ```
67
+
68
+ ### Using the `useObjectChat` Hook
69
+
70
+ For custom integrations, you can use the `useObjectChat` hook directly:
71
+
72
+ ```tsx
73
+ import { useObjectChat } from '@object-ui/plugin-chatbot';
74
+
75
+ function MyChat() {
76
+ const {
77
+ messages,
78
+ isLoading,
79
+ error,
80
+ sendMessage,
81
+ stop,
82
+ reload,
83
+ clear,
84
+ isApiMode,
85
+ } = useObjectChat({
86
+ api: '/api/v1/ai/chat',
87
+ model: 'gpt-4o',
88
+ systemPrompt: 'You are helpful.',
89
+ });
90
+
91
+ return (
92
+ <div>
93
+ {messages.map(msg => (
94
+ <div key={msg.id}>{msg.content}</div>
95
+ ))}
96
+ {isLoading && <button onClick={stop}>Stop</button>}
97
+ {error && <button onClick={reload}>Retry</button>}
98
+ </div>
99
+ );
100
+ }
101
+ ```
102
+
44
103
  ## Schema-Driven Usage
45
104
 
46
105
  This plugin automatically registers with ObjectUI's component registry when imported:
@@ -48,16 +107,59 @@ This plugin automatically registers with ObjectUI's component registry when impo
48
107
  ```tsx
49
108
  import '@object-ui/plugin-chatbot';
50
109
 
51
- const schema = {
52
- component: 'chatbot',
110
+ // Local/demo mode
111
+ const demoSchema = {
112
+ type: 'chatbot',
53
113
  messages: [
54
114
  { id: '1', role: 'assistant', content: 'Hello!' }
55
115
  ],
56
116
  placeholder: 'Type your message...',
57
- autoResponse: true
117
+ autoResponse: true,
118
+ };
119
+
120
+ // AI streaming mode
121
+ const aiSchema = {
122
+ type: 'chatbot',
123
+ api: '/api/v1/ai/chat',
124
+ model: 'gpt-4o',
125
+ systemPrompt: 'You are a helpful assistant.',
126
+ streamingEnabled: true,
127
+ messages: [],
128
+ placeholder: 'Ask the AI...',
58
129
  };
59
130
  ```
60
131
 
132
+ ## Two Operating Modes
133
+
134
+ | Feature | Local/Demo Mode | AI Streaming Mode |
135
+ |---------|----------------|-------------------|
136
+ | `api` | Not set | Set to SSE endpoint |
137
+ | Responses | Auto-response (configurable) | Real AI streaming via SSE |
138
+ | Streaming | Simulated | Full SSE streaming |
139
+ | Tool calling | N/A | Supported via vercel/ai |
140
+ | Stop/Reload | Stop cancels timer | Stop interrupts stream |
141
+ | Backend | None required | service-ai (IAIService) |
142
+
143
+ <!-- release-metadata:v3.3.0 -->
144
+
145
+ ## Compatibility
146
+
147
+ - **React:** 18.x or 19.x
148
+ - **Node.js:** ≥ 18
149
+ - **TypeScript:** ≥ 5.0 (strict mode)
150
+ - **`@objectstack/spec`:** ^3.3.0
151
+ - **`@objectstack/client`:** ^3.3.0
152
+ - **Tailwind CSS:** ≥ 3.4 (for packages with UI)
153
+
154
+ ## Links
155
+
156
+ - 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-chatbot)
157
+ - 📦 [npm package](https://www.npmjs.com/package/@object-ui/plugin-chatbot)
158
+ - 📝 [Changelog](./CHANGELOG.md)
159
+ - 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
160
+ - 🤝 [Contributing Guide](https://github.com/objectstack-ai/objectui/blob/main/CONTRIBUTING.md)
161
+ - 🗺️ [Roadmap](https://github.com/objectstack-ai/objectui/blob/main/ROADMAP.md)
162
+
61
163
  ## License
62
164
 
63
165
  MIT © ObjectStack Inc.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './src/index'
1
+ export * from './packages/plugin-chatbot/src/index'
2
2
  export {}