@object-ui/plugin-chatbot 3.1.4 → 3.3.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.
Files changed (42) hide show
  1. package/.turbo/turbo-build.log +40 -9
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +86 -4
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +11875 -2897
  6. package/dist/index.umd.cjs +71 -28
  7. package/dist/{src → packages/plugin-chatbot/src}/ChatbotEnhanced.d.ts +8 -0
  8. package/dist/packages/plugin-chatbot/src/ChatbotEnhanced.d.ts.map +1 -0
  9. package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts +15 -0
  10. package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts.map +1 -0
  11. package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts +29 -0
  12. package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts.map +1 -0
  13. package/dist/packages/plugin-chatbot/src/FloatingChatbotProvider.d.ts +37 -0
  14. package/dist/packages/plugin-chatbot/src/FloatingChatbotProvider.d.ts.map +1 -0
  15. package/dist/packages/plugin-chatbot/src/FloatingChatbotTrigger.d.ts +21 -0
  16. package/dist/packages/plugin-chatbot/src/FloatingChatbotTrigger.d.ts.map +1 -0
  17. package/dist/{src → packages/plugin-chatbot/src}/index.d.ts +10 -0
  18. package/dist/packages/plugin-chatbot/src/index.d.ts.map +1 -0
  19. package/dist/packages/plugin-chatbot/src/renderer.d.ts.map +1 -0
  20. package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts +112 -0
  21. package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts.map +1 -0
  22. package/dist/packages/plugin-chatbot/src/utils.d.ts.map +1 -0
  23. package/package.json +10 -8
  24. package/src/ChatbotEnhanced.tsx +55 -4
  25. package/src/FloatingChatbot.tsx +89 -0
  26. package/src/FloatingChatbotPanel.tsx +102 -0
  27. package/src/FloatingChatbotProvider.tsx +80 -0
  28. package/src/FloatingChatbotTrigger.tsx +55 -0
  29. package/src/__tests__/ChatbotEnhancedStreaming.test.tsx +159 -0
  30. package/src/__tests__/FloatingChatbotProvider.test.tsx +134 -0
  31. package/src/__tests__/FloatingChatbotWidgets.test.tsx +165 -0
  32. package/src/__tests__/useObjectChat.test.tsx +347 -0
  33. package/src/index.tsx +19 -0
  34. package/src/renderer.tsx +261 -92
  35. package/src/useObjectChat.ts +344 -0
  36. package/vite.config.ts +2 -1
  37. package/dist/src/ChatbotEnhanced.d.ts.map +0 -1
  38. package/dist/src/index.d.ts.map +0 -1
  39. package/dist/src/renderer.d.ts.map +0 -1
  40. package/dist/src/utils.d.ts.map +0 -1
  41. /package/dist/{src → packages/plugin-chatbot/src}/renderer.d.ts +0 -0
  42. /package/dist/{src → packages/plugin-chatbot/src}/utils.d.ts +0 -0
@@ -1,22 +1,53 @@
1
1
 
2
- > @object-ui/plugin-chatbot@3.1.4 build /home/runner/work/objectui/objectui/packages/plugin-chatbot
2
+ > @object-ui/plugin-chatbot@3.3.0 build /home/runner/work/objectui/objectui/packages/plugin-chatbot
3
3
  > vite build
4
4
 
5
- vite v8.0.1 building client environment for production...
6
- 
5
+ vite v8.0.8 building client environment for production...
6
+ 
7
7
  rendering chunks...
8
8
  
9
9
  [vite:dts] Start generate declaration files...
10
- [vite:dts] Declaration files built in 27720ms.
10
+ src/useObjectChat.ts:178:5 - error TS2353: Object literal may only specify known properties, and 'api' does not exist in type 'UseChatOptions<UIMessage<unknown, UIDataTypes, UITools>>'.
11
+
12
+ 178 api: isApiMode ? api! : '/api/noop',
13
+    ~~~
14
+ src/useObjectChat.ts:216:7 - error TS2339: Property 'isLoading' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
15
+
16
+ 216 isLoading,
17
+    ~~~~~~~~~
18
+ src/useObjectChat.ts:218:7 - error TS2339: Property 'input' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
19
+
20
+ 218 input,
21
+    ~~~~~
22
+ src/useObjectChat.ts:219:7 - error TS2339: Property 'setInput' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
23
+
24
+ 219 setInput,
25
+    ~~~~~~~~
26
+ src/useObjectChat.ts:220:7 - error TS2339: Property 'handleInputChange' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
27
+
28
+ 220 handleInputChange,
29
+    ~~~~~~~~~~~~~~~~~
30
+ src/useObjectChat.ts:221:7 - error TS2339: Property 'append' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
31
+
32
+ 221 append,
33
+    ~~~~~~
34
+ src/useObjectChat.ts:223:7 - error TS2339: Property 'reload' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
35
+
36
+ 223 reload,
37
+    ~~~~~~
38
+
39
+ [vite:dts] Declaration files built in 30288ms.
11
40
  
12
41
  computing gzip size...
13
- dist/index.js 970.49 kB │ gzip: 298.78 kB
14
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `vite:dts`. See https://rolldown.rs/options/checks#plugintimings for more details.
42
+ dist/index.js 1,222.85 kB │ gzip: 352.84 kB
15
43
 
44
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `vite:dts`. See https://rolldown.rs/options/checks#plugintimings for more details.
16
45
  
17
- 
46
+ 
18
47
  rendering chunks...
19
48
  computing gzip size...
20
- dist/index.umd.cjs 811.35 kB │ gzip: 279.70 kB
49
+ dist/index.umd.cjs 1,006.91 kB │ gzip: 327.98 kB
21
50
 
22
- ✓ built in 33.53s
51
+ [MISSING_GLOBAL_NAME] Warning: No name was provided for external module "react/jsx-runtime" in "output.globals" – guessing "react_jsx_runtime".
52
+ 
53
+ ✓ built in 37.23s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @object-ui/plugin-chatbot
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@3.3.0
8
+ - @object-ui/core@3.3.0
9
+ - @object-ui/react@3.3.0
10
+ - @object-ui/components@3.3.0
11
+
12
+ ## 3.2.0
13
+
14
+ ### Patch Changes
15
+
16
+ - @object-ui/types@3.2.0
17
+ - @object-ui/core@3.2.0
18
+ - @object-ui/react@3.2.0
19
+ - @object-ui/components@3.2.0
20
+
21
+ ## 3.1.5
22
+
23
+ ### Patch Changes
24
+
25
+ - @object-ui/react@3.1.5
26
+ - @object-ui/components@3.1.5
27
+ - @object-ui/types@3.1.5
28
+ - @object-ui/core@3.1.5
29
+
3
30
  ## 3.1.4
4
31
 
5
32
  ### 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,39 @@ 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
+
61
143
  ## License
62
144
 
63
145
  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 {}