@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.
- package/.turbo/turbo-build.log +40 -9
- package/CHANGELOG.md +27 -0
- package/README.md +86 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11875 -2897
- package/dist/index.umd.cjs +71 -28
- package/dist/{src → packages/plugin-chatbot/src}/ChatbotEnhanced.d.ts +8 -0
- package/dist/packages/plugin-chatbot/src/ChatbotEnhanced.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts +15 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts +29 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbotProvider.d.ts +37 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbotProvider.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbotTrigger.d.ts +21 -0
- package/dist/packages/plugin-chatbot/src/FloatingChatbotTrigger.d.ts.map +1 -0
- package/dist/{src → packages/plugin-chatbot/src}/index.d.ts +10 -0
- package/dist/packages/plugin-chatbot/src/index.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/renderer.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts +112 -0
- package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/utils.d.ts.map +1 -0
- package/package.json +10 -8
- package/src/ChatbotEnhanced.tsx +55 -4
- package/src/FloatingChatbot.tsx +89 -0
- package/src/FloatingChatbotPanel.tsx +102 -0
- package/src/FloatingChatbotProvider.tsx +80 -0
- package/src/FloatingChatbotTrigger.tsx +55 -0
- package/src/__tests__/ChatbotEnhancedStreaming.test.tsx +159 -0
- package/src/__tests__/FloatingChatbotProvider.test.tsx +134 -0
- package/src/__tests__/FloatingChatbotWidgets.test.tsx +165 -0
- package/src/__tests__/useObjectChat.test.tsx +347 -0
- package/src/index.tsx +19 -0
- package/src/renderer.tsx +261 -92
- package/src/useObjectChat.ts +344 -0
- package/vite.config.ts +2 -1
- package/dist/src/ChatbotEnhanced.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/renderer.d.ts.map +0 -1
- package/dist/src/utils.d.ts.map +0 -1
- /package/dist/{src → packages/plugin-chatbot/src}/renderer.d.ts +0 -0
- /package/dist/{src → packages/plugin-chatbot/src}/utils.d.ts +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,22 +1,53 @@
|
|
|
1
1
|
|
|
2
|
-
> @object-ui/plugin-chatbot@3.
|
|
2
|
+
> @object-ui/plugin-chatbot@3.3.0 build /home/runner/work/objectui/objectui/packages/plugin-chatbot
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
|
-
[36mvite v8.0.
|
|
6
|
-
[2K
|
|
5
|
+
[36mvite v8.0.8 [32mbuilding client environment for production...[36m[39m
|
|
6
|
+
[2K
|
|
7
7
|
rendering chunks...
|
|
8
8
|
[32m
|
|
9
9
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
10
|
-
[
|
|
10
|
+
[96msrc/useObjectChat.ts[0m:[93m178[0m:[93m5[0m - [91merror[0m[90m TS2353: [0mObject literal may only specify known properties, and 'api' does not exist in type 'UseChatOptions<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
11
|
+
|
|
12
|
+
[7m178[0m api: isApiMode ? api! : '/api/noop',
|
|
13
|
+
[7m [0m [91m ~~~[0m
|
|
14
|
+
[96msrc/useObjectChat.ts[0m:[93m216[0m:[93m7[0m - [91merror[0m[90m TS2339: [0mProperty 'isLoading' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
15
|
+
|
|
16
|
+
[7m216[0m isLoading,
|
|
17
|
+
[7m [0m [91m ~~~~~~~~~[0m
|
|
18
|
+
[96msrc/useObjectChat.ts[0m:[93m218[0m:[93m7[0m - [91merror[0m[90m TS2339: [0mProperty 'input' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
19
|
+
|
|
20
|
+
[7m218[0m input,
|
|
21
|
+
[7m [0m [91m ~~~~~[0m
|
|
22
|
+
[96msrc/useObjectChat.ts[0m:[93m219[0m:[93m7[0m - [91merror[0m[90m TS2339: [0mProperty 'setInput' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
23
|
+
|
|
24
|
+
[7m219[0m setInput,
|
|
25
|
+
[7m [0m [91m ~~~~~~~~[0m
|
|
26
|
+
[96msrc/useObjectChat.ts[0m:[93m220[0m:[93m7[0m - [91merror[0m[90m TS2339: [0mProperty 'handleInputChange' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
27
|
+
|
|
28
|
+
[7m220[0m handleInputChange,
|
|
29
|
+
[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
|
|
30
|
+
[96msrc/useObjectChat.ts[0m:[93m221[0m:[93m7[0m - [91merror[0m[90m TS2339: [0mProperty 'append' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
31
|
+
|
|
32
|
+
[7m221[0m append,
|
|
33
|
+
[7m [0m [91m ~~~~~~[0m
|
|
34
|
+
[96msrc/useObjectChat.ts[0m:[93m223[0m:[93m7[0m - [91merror[0m[90m TS2339: [0mProperty 'reload' does not exist on type 'UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>'.
|
|
35
|
+
|
|
36
|
+
[7m223[0m reload,
|
|
37
|
+
[7m [0m [91m ~~~~~~[0m
|
|
38
|
+
|
|
39
|
+
[32m[36m[vite:dts][32m Declaration files built in 30288ms.
|
|
11
40
|
[39m
|
|
12
41
|
computing gzip size...
|
|
13
|
-
dist/index.js
|
|
14
|
-
[33m[33m[PLUGIN_TIMINGS] Warning:[0m 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
|
+
[33m[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `vite:dts`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
16
45
|
[39m
|
|
17
|
-
[2K
|
|
46
|
+
[2K
|
|
18
47
|
rendering chunks...
|
|
19
48
|
computing gzip size...
|
|
20
|
-
dist/index.umd.cjs
|
|
49
|
+
dist/index.umd.cjs 1,006.91 kB │ gzip: 327.98 kB
|
|
21
50
|
|
|
22
|
-
[
|
|
51
|
+
[33m[33m[MISSING_GLOBAL_NAME] Warning:[0m No name was provided for external module "react/jsx-runtime" in "output.globals" – guessing "react_jsx_runtime".
|
|
52
|
+
[39m
|
|
53
|
+
[32m✓ built in 37.23s[39m
|
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
|
-
|
|
52
|
-
|
|
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 {}
|