thub-embed 9.1.4 → 9.1.5
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 +10 -10
- package/dist/components/Bot.d.ts +1 -1
- package/dist/components/bubbles/AgentReasoningBubble.d.ts +1 -1
- package/dist/components/bubbles/BotBubble.d.ts +1 -1
- package/dist/components/bubbles/GuestBubble.d.ts +1 -1
- package/dist/components/bubbles/LeadCaptureBubble.d.ts +1 -1
- package/dist/queries/sendMessageQuery.d.ts +10 -10
- package/dist/utils/index.d.ts +3 -3
- package/dist/web.d.ts +2 -2
- package/dist/web.js +1 -1
- package/dist/web.umd.js +1 -1
- package/dist/window.d.ts +1 -1
- package/package.json +1 -1
- package/public/index.html +2 -2
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ A development server will be running on http://localhost:5678 automatically. Upd
|
|
|
25
25
|
<script type="module">
|
|
26
26
|
import Chatbot from 'https://localhost:5678/web.js'; // Change to from './web.js' to 'https://localhost:5678/web.js'
|
|
27
27
|
Chatbot.init({
|
|
28
|
-
|
|
28
|
+
chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f', // Add your Flowise chatflowid
|
|
29
29
|
apiHost: 'https://your-thub-instance.com', // Add your Flowise apiHost
|
|
30
30
|
});
|
|
31
31
|
</script>
|
|
@@ -45,7 +45,7 @@ yarn build
|
|
|
45
45
|
<script type="module">
|
|
46
46
|
import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
|
|
47
47
|
Chatbot.init({
|
|
48
|
-
|
|
48
|
+
chatflowid: '<chatflowid>',
|
|
49
49
|
apiHost: 'http://localhost:3000',
|
|
50
50
|
});
|
|
51
51
|
</script>
|
|
@@ -57,7 +57,7 @@ yarn build
|
|
|
57
57
|
<script type="module">
|
|
58
58
|
import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
|
|
59
59
|
Chatbot.initFull({
|
|
60
|
-
|
|
60
|
+
chatflowid: '<chatflowid>',
|
|
61
61
|
apiHost: 'http://localhost:3000',
|
|
62
62
|
});
|
|
63
63
|
</script>
|
|
@@ -71,7 +71,7 @@ To enable full screen, add `margin: 0` to <code>body</code> style, and confirm y
|
|
|
71
71
|
<script type="module">
|
|
72
72
|
import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
|
|
73
73
|
Chatbot.initFull({
|
|
74
|
-
|
|
74
|
+
chatflowid: '<chatflowid>',
|
|
75
75
|
apiHost: 'http://localhost:3000',
|
|
76
76
|
theme: {
|
|
77
77
|
chatWindow: {
|
|
@@ -92,7 +92,7 @@ You can also customize chatbot with different configuration
|
|
|
92
92
|
<script type="module">
|
|
93
93
|
import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
|
|
94
94
|
Chatbot.init({
|
|
95
|
-
|
|
95
|
+
chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f',
|
|
96
96
|
apiHost: 'http://localhost:3000',
|
|
97
97
|
chatflowConfig: {
|
|
98
98
|
// topK: 2
|
|
@@ -266,7 +266,7 @@ yarn start
|
|
|
266
266
|
<script type="module">
|
|
267
267
|
import Chatbot from 'your-proxy-server-url/web.js'; // Must be 'your-proxy-server-url/web.js'
|
|
268
268
|
Chatbot.init({
|
|
269
|
-
|
|
269
|
+
chatflowid: 'your-identifier-here', // Must match an identifier from your .env
|
|
270
270
|
apiHost: 'your-proxy-server-url', // Must match the URL of your proxy server
|
|
271
271
|
chatflowConfig: {
|
|
272
272
|
// ...
|
|
@@ -279,7 +279,7 @@ yarn start
|
|
|
279
279
|
|
|
280
280
|
```html
|
|
281
281
|
<!-- public/index.html -->
|
|
282
|
-
|
|
282
|
+
chatflowid: 'your-identifier-here' // Must match an identifier from your .env
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
**Important Notes:**
|
|
@@ -307,14 +307,14 @@ yarn start
|
|
|
307
307
|
3. Update the test page configuration:
|
|
308
308
|
|
|
309
309
|
- Open `public/index.html` in your code editor
|
|
310
|
-
- Modify the `
|
|
310
|
+
- Modify the `chatflowid` and `apiHost` to match your `.env` settings:
|
|
311
311
|
|
|
312
312
|
```html
|
|
313
313
|
<!-- public/index.html -->
|
|
314
314
|
<script type="module">
|
|
315
315
|
import Chatbot from './web.js';
|
|
316
316
|
Chatbot.init({
|
|
317
|
-
|
|
317
|
+
chatflowid: 'agent1', // Must match an identifier from your .env
|
|
318
318
|
apiHost: 'http://localhost:3001', // Change this from window.location.origin to 'http://localhost:3001'
|
|
319
319
|
});
|
|
320
320
|
</script>
|
|
@@ -328,7 +328,7 @@ For full page testing, use this configuration instead:
|
|
|
328
328
|
<script type="module">
|
|
329
329
|
import Chatbot from './web.js';
|
|
330
330
|
Chatbot.initFull({
|
|
331
|
-
|
|
331
|
+
chatflowid: 'agent1', // Must match an identifier from your .env
|
|
332
332
|
apiHost: 'http://localhost:3000', // Change this from window.location.origin to 'http://localhost:3001'
|
|
333
333
|
});
|
|
334
334
|
</script>
|
package/dist/components/Bot.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export type MessageType = {
|
|
|
69
69
|
type observerConfigType = (accessor: string | boolean | object | MessageType[]) => void;
|
|
70
70
|
export type observersConfigType = Record<'observeUserInput' | 'observeLoading' | 'observeMessages', observerConfigType>;
|
|
71
71
|
export type BotProps = {
|
|
72
|
-
|
|
72
|
+
chatflowid: string;
|
|
73
73
|
apiHost?: string;
|
|
74
74
|
onRequest?: (request: RequestInit) => Promise<void>;
|
|
75
75
|
chatflowConfig?: Record<string, unknown>;
|
|
@@ -2,7 +2,7 @@ import { IAction, MessageType } from '../Bot';
|
|
|
2
2
|
import { DateTimeToggleTheme } from '@/features/bubble/types';
|
|
3
3
|
type Props = {
|
|
4
4
|
message: MessageType;
|
|
5
|
-
|
|
5
|
+
chatflowid: string;
|
|
6
6
|
chatId: string;
|
|
7
7
|
apiHost?: string;
|
|
8
8
|
onRequest?: (request: RequestInit) => Promise<void>;
|
|
@@ -14,7 +14,7 @@ type BaseRequest = {
|
|
|
14
14
|
onRequest?: (request: RequestInit) => Promise<void>;
|
|
15
15
|
};
|
|
16
16
|
export type MessageRequest = BaseRequest & {
|
|
17
|
-
|
|
17
|
+
chatflowid?: string;
|
|
18
18
|
body?: IncomingInput;
|
|
19
19
|
};
|
|
20
20
|
export type FeedbackRatingType = 'THUMBS_UP' | 'THUMBS_DOWN';
|
|
@@ -25,7 +25,7 @@ export type FeedbackInput = {
|
|
|
25
25
|
content?: string;
|
|
26
26
|
};
|
|
27
27
|
export type CreateFeedbackRequest = BaseRequest & {
|
|
28
|
-
|
|
28
|
+
chatflowid?: string;
|
|
29
29
|
body?: FeedbackInput;
|
|
30
30
|
};
|
|
31
31
|
export type UpdateFeedbackRequest = BaseRequest & {
|
|
@@ -33,12 +33,12 @@ export type UpdateFeedbackRequest = BaseRequest & {
|
|
|
33
33
|
body?: Partial<FeedbackInput>;
|
|
34
34
|
};
|
|
35
35
|
export type UpsertRequest = BaseRequest & {
|
|
36
|
-
|
|
36
|
+
chatflowid: string;
|
|
37
37
|
apiHost?: string;
|
|
38
38
|
formData: FormData;
|
|
39
39
|
};
|
|
40
40
|
export type LeadCaptureInput = {
|
|
41
|
-
|
|
41
|
+
chatflowid: string;
|
|
42
42
|
chatId: string;
|
|
43
43
|
name?: string;
|
|
44
44
|
email?: string;
|
|
@@ -47,7 +47,7 @@ export type LeadCaptureInput = {
|
|
|
47
47
|
export type LeadCaptureRequest = BaseRequest & {
|
|
48
48
|
body: Partial<LeadCaptureInput>;
|
|
49
49
|
};
|
|
50
|
-
export declare const sendFeedbackQuery: ({
|
|
50
|
+
export declare const sendFeedbackQuery: ({ chatflowid, apiHost, body, onRequest }: CreateFeedbackRequest) => Promise<{
|
|
51
51
|
data?: unknown;
|
|
52
52
|
error?: Error | undefined;
|
|
53
53
|
}>;
|
|
@@ -55,23 +55,23 @@ export declare const updateFeedbackQuery: ({ id, apiHost, body, onRequest }: Upd
|
|
|
55
55
|
data?: unknown;
|
|
56
56
|
error?: Error | undefined;
|
|
57
57
|
}>;
|
|
58
|
-
export declare const sendMessageQuery: ({
|
|
58
|
+
export declare const sendMessageQuery: ({ chatflowid, apiHost, body, onRequest }: MessageRequest) => Promise<{
|
|
59
59
|
data?: any;
|
|
60
60
|
error?: Error | undefined;
|
|
61
61
|
}>;
|
|
62
|
-
export declare const createAttachmentWithFormData: ({
|
|
62
|
+
export declare const createAttachmentWithFormData: ({ chatflowid, apiHost, formData, onRequest }: UpsertRequest) => Promise<{
|
|
63
63
|
data?: unknown;
|
|
64
64
|
error?: Error | undefined;
|
|
65
65
|
}>;
|
|
66
|
-
export declare const upsertVectorStoreWithFormData: ({
|
|
66
|
+
export declare const upsertVectorStoreWithFormData: ({ chatflowid, apiHost, formData, onRequest }: UpsertRequest) => Promise<{
|
|
67
67
|
data?: unknown;
|
|
68
68
|
error?: Error | undefined;
|
|
69
69
|
}>;
|
|
70
|
-
export declare const getChatbotConfig: ({
|
|
70
|
+
export declare const getChatbotConfig: ({ chatflowid, apiHost, onRequest }: MessageRequest) => Promise<{
|
|
71
71
|
data?: any;
|
|
72
72
|
error?: Error | undefined;
|
|
73
73
|
}>;
|
|
74
|
-
export declare const isStreamAvailableQuery: ({
|
|
74
|
+
export declare const isStreamAvailableQuery: ({ chatflowid, apiHost, onRequest }: MessageRequest) => Promise<{
|
|
75
75
|
data?: any;
|
|
76
76
|
error?: Error | undefined;
|
|
77
77
|
}>;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ export declare const sendRequest: <ResponseData>(params: string | {
|
|
|
14
14
|
data?: ResponseData | undefined;
|
|
15
15
|
error?: Error | undefined;
|
|
16
16
|
}>;
|
|
17
|
-
export declare const setLocalStorageChatflow: (
|
|
18
|
-
export declare const getLocalStorageChatflow: (
|
|
19
|
-
export declare const removeLocalStorageChatHistory: (
|
|
17
|
+
export declare const setLocalStorageChatflow: (chatflowid: string, chatId: string, saveObj?: Record<string, any>) => void;
|
|
18
|
+
export declare const getLocalStorageChatflow: (chatflowid: string) => any;
|
|
19
|
+
export declare const removeLocalStorageChatHistory: (chatflowid: string) => void;
|
|
20
20
|
export declare const getBubbleButtonSize: (size: 'small' | 'medium' | 'large' | number | undefined) => number;
|
|
21
21
|
export declare const setCookie: (cname: string, cvalue: string, exdays: number) => void;
|
|
22
22
|
export declare const getCookie: (cname: string) => string;
|
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const chatbot: {
|
|
2
2
|
initFull: (props: {
|
|
3
|
-
|
|
3
|
+
chatflowid: string;
|
|
4
4
|
apiHost?: string | undefined;
|
|
5
5
|
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
6
6
|
chatflowConfig?: Record<string, unknown> | undefined;
|
|
@@ -10,7 +10,7 @@ declare const chatbot: {
|
|
|
10
10
|
id?: string | undefined;
|
|
11
11
|
}) => void;
|
|
12
12
|
init: (props: {
|
|
13
|
-
|
|
13
|
+
chatflowid: string;
|
|
14
14
|
apiHost?: string | undefined;
|
|
15
15
|
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
16
16
|
chatflowConfig?: Record<string, unknown> | undefined;
|