cmcts-c-agent-embedding 1.0.4 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmcts-c-agent-embedding",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Javascript library to display flowise chatbot on your website",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,6 +20,7 @@
20
20
  "@babel/core": "^7.22.1",
21
21
  "@microsoft/fetch-event-source": "^2.0.1",
22
22
  "@ts-stack/markdown": "^1.4.0",
23
+ "@types/pdfjs-dist": "^2.10.378",
23
24
  "axios": "^1.7.7",
24
25
  "c-agent-embedding": "^1.0.4",
25
26
  "c-agent-embedding-react": "^1.0.1",
@@ -32,6 +33,7 @@
32
33
  "lodash": "^4.17.21",
33
34
  "multer": "^1.4.5-lts.1",
34
35
  "node-fetch": "^3.3.2",
36
+ "pdfjs-dist": "3.11.174",
35
37
  "prettier": "^3.4.2",
36
38
  "solid-element": "1.7.0",
37
39
  "solid-js": "1.7.1",
package/public/index.html CHANGED
@@ -1,153 +1,154 @@
1
- <!--
2
- NOTE: This .html file (and public folder) is optional and can be safely deleted.
3
- It serves only as a demo/test page.
4
-
5
- The chatbot can be embedded directly on any allowed domain using the embed script that
6
- is generated when starting the server.
7
- -->
8
-
9
- <!doctype html>
10
- <html lang="en">
11
- <head>
12
- <meta charset="UTF-8" />
13
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
- <title>Flowise Chatbot Widget</title>
15
- </head>
16
-
17
- <body>
18
- <div id="root">
19
- <flowise-fullchatbot></flowise-fullchatbot>
20
- </div>
21
- <script type="module">
22
- import Chatbot from './web.js';
23
-
24
- const customStringify = (obj) => {
25
- let stringified = JSON.stringify(obj, null, 4)
26
- .replace(/"([^"]+)":/g, '$1:')
27
- .replace(/: "([^"]+)"/g, (match, value) => (value.includes('<') ? `: "${value}"` : `: '${value}'`))
28
- .replace(/: "(true|false|\d+)"/g, ': $1')
29
- .replace(/customCSS: ""/g, 'customCSS: ``');
30
- return stringified
31
- .split('\n')
32
- .map((line, index) => {
33
- if (index === 0) return line;
34
- return ' '.repeat(8) + line;
35
- })
36
- .join('\n');
37
- };
38
-
39
- // Example initialization:
40
- // If your .env contains:
41
- // agent1=xyz789-uvw456,https://example.com
42
- // support=abc123-def456,https://example.com
43
- // salesbot=ghi123-jkl456,https://example.com
44
- //
45
- // Then use the environment variable name as chatflowid:
46
- Chatbot.initFull({
47
- // chatflowid: '6a63bb88-88f7-4c4d-805e-9c027c85707b', // or 'support', 'salesbot', etc.
48
- chatflowid: 'b573e66d-0e28-4798-8e4f-fbbaff8e236f', // or 'support', 'salesbot', etc.
49
- // apiHost: 'https://stock.cmcts.ai/c-agent',
50
- apiHost: 'http://localhost:3003',
51
- chatwootUrl: 'http://203.145.47.214:8003',
52
- roomIds: {
53
- '012345678': 'PED74dTXmVBBdjYGKntbFsMm', // CMC UNI thủ tục nhập học
54
- '023456781': 'NhRMijqmRGJ6wX657H62HNz5', // CMC UNI Chuyên ngành học
55
- '034567812': 'ATkjNjV9VBDr4jrN25zRAm1u', // Học phí
56
- '045678123': 'sWUzHjyjJ81QsdGQScwTkyxn', // CMC UNI công tác sinh viên
57
- '056781234': 'ncR4YYe2MMeBk6F2AGydw5g9', // CMC UNI General
58
- },
59
- theme: customStringify({
60
- button: {
61
- backgroundColor: '#3B81F6',
62
- right: 20,
63
- bottom: 20,
64
- size: 48,
65
- dragAndDrop: true,
66
- iconColor: 'white',
67
- customIconSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
68
- autoWindowOpen: {
69
- autoOpen: true,
70
- openDelay: 2,
71
- autoOpenOnMobile: false,
72
- },
73
- },
74
- tooltip: {
75
- showTooltip: true,
76
- tooltipMessage: 'Hi There 👋!',
77
- tooltipBackgroundColor: 'black',
78
- tooltipTextColor: 'white',
79
- tooltipFontSize: 16,
80
- },
81
- disclaimer: {
82
- title: 'Disclaimer',
83
- message: 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>',
84
- textColor: 'black',
85
- buttonColor: '#3b82f6',
86
- buttonText: 'Start Chatting',
87
- buttonTextColor: 'white',
88
- blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)',
89
- backgroundColor: 'white',
90
- },
91
- customCSS: ``,
92
- chatWindow: {
93
- showTitle: true,
94
- showAgentMessages: true,
95
- title: 'Agent Studio Bot',
96
- titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
97
- welcomeMessage: 'Hello! This is custom welcome message',
98
- errorMessage: 'This is a custom error message',
99
- backgroundColor: '#ffffff',
100
- backgroundImage: 'enter image path or link',
101
- height: 700,
102
- width: 400,
103
- fontSize: 16,
104
- starterPrompts: ['What is a bot?', 'Who are you?'],
105
- starterPromptFontSize: 15,
106
- clearChatOnReload: false,
107
- sourceDocsTitle: 'Sources:',
108
- renderHTML: true,
109
- botMessage: {
110
- backgroundColor: '#f7f8ff',
111
- textColor: '#303235',
112
- showAvatar: true,
113
- avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png',
114
- },
115
- userMessage: {
116
- backgroundColor: '#3B81F6',
117
- textColor: '#ffffff',
118
- showAvatar: true,
119
- avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png',
120
- },
121
- textInput: {
122
- placeholder: 'Type your question',
123
- backgroundColor: '#ffffff',
124
- textColor: '#303235',
125
- sendButtonColor: '#3B81F6',
126
- maxChars: 50,
127
- maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.',
128
- autoFocus: true,
129
- sendMessageSound: true,
130
- sendSoundLocation: 'send_message.mp3',
131
- receiveMessageSound: true,
132
- receiveSoundLocation: 'receive_message.mp3',
133
- },
134
- feedback: {
135
- color: '#303235',
136
- },
137
- dateTimeToggle: {
138
- date: true,
139
- time: true,
140
- },
141
- footer: {
142
- textColor: '#303235',
143
- text: 'Powered by',
144
- company: 'Agent Studio',
145
- // companyLink: 'https://flowiseai.com'
146
- companyLink: '#',
147
- },
148
- },
149
- }),
150
- });
151
- </script>
152
- </body>
153
- </html>
1
+ <!--
2
+ NOTE: This .html file (and public folder) is optional and can be safely deleted.
3
+ It serves only as a demo/test page.
4
+
5
+ The chatbot can be embedded directly on any allowed domain using the embed script that
6
+ is generated when starting the server.
7
+ -->
8
+
9
+ <!doctype html>
10
+ <html lang="en">
11
+ <head>
12
+ <meta charset="UTF-8" />
13
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
+ <title>Flowise Chatbot Widget</title>
15
+ </head>
16
+
17
+ <body>
18
+ <div id="root">
19
+ <flowise-fullchatbot></flowise-fullchatbot>
20
+ </div>
21
+ <script type="module">
22
+ import Chatbot from './web.js';
23
+
24
+ const customStringify = (obj) => {
25
+ let stringified = JSON.stringify(obj, null, 4)
26
+ .replace(/"([^"]+)":/g, '$1:')
27
+ .replace(/: "([^"]+)"/g, (match, value) => (value.includes('<') ? `: "${value}"` : `: '${value}'`))
28
+ .replace(/: "(true|false|\d+)"/g, ': $1')
29
+ .replace(/customCSS: ""/g, 'customCSS: ``');
30
+ return stringified
31
+ .split('\n')
32
+ .map((line, index) => {
33
+ if (index === 0) return line;
34
+ return ' '.repeat(8) + line;
35
+ })
36
+ .join('\n');
37
+ };
38
+
39
+ // Example initialization:
40
+ // If your .env contains:
41
+ // agent1=xyz789-uvw456,https://example.com
42
+ // support=abc123-def456,https://example.com
43
+ // salesbot=ghi123-jkl456,https://example.com
44
+ //
45
+ // Then use the environment variable name as chatflowid:
46
+ Chatbot.initFull({
47
+ // chatflowid: '6a63bb88-88f7-4c4d-805e-9c027c85707b', // or 'support', 'salesbot', etc.
48
+ // chatflowid: 'b573e66d-0e28-4798-8e4f-fbbaff8e236f', // or 'support', 'salesbot', etc.
49
+ chatflowid: '7ee803b4-e3f8-4f33-bf85-ef9ab9d6f693', // or 'support', 'salesbot', etc.
50
+ // apiHost: 'https://stock.cmcts.ai/c-agent',
51
+ apiHost: 'http://localhost:3003',
52
+ chatwootUrl: 'http://203.145.47.214:8003',
53
+ roomIds: {
54
+ '012345678': 'PED74dTXmVBBdjYGKntbFsMm', // CMC UNI thủ tục nhập học
55
+ '023456781': 'NhRMijqmRGJ6wX657H62HNz5', // CMC UNI Chuyên ngành học
56
+ '034567812': 'ATkjNjV9VBDr4jrN25zRAm1u', // Học phí
57
+ '045678123': 'sWUzHjyjJ81QsdGQScwTkyxn', // CMC UNI công tác sinh viên
58
+ '056781234': 'ncR4YYe2MMeBk6F2AGydw5g9', // CMC UNI General
59
+ },
60
+ theme: customStringify({
61
+ button: {
62
+ backgroundColor: '#3B81F6',
63
+ right: 20,
64
+ bottom: 20,
65
+ size: 48,
66
+ dragAndDrop: true,
67
+ iconColor: 'white',
68
+ customIconSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
69
+ autoWindowOpen: {
70
+ autoOpen: true,
71
+ openDelay: 2,
72
+ autoOpenOnMobile: false,
73
+ },
74
+ },
75
+ tooltip: {
76
+ showTooltip: true,
77
+ tooltipMessage: 'Hi There 👋!',
78
+ tooltipBackgroundColor: 'black',
79
+ tooltipTextColor: 'white',
80
+ tooltipFontSize: 16,
81
+ },
82
+ disclaimer: {
83
+ title: 'Disclaimer',
84
+ message: 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>',
85
+ textColor: 'black',
86
+ buttonColor: '#3b82f6',
87
+ buttonText: 'Start Chatting',
88
+ buttonTextColor: 'white',
89
+ blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)',
90
+ backgroundColor: 'white',
91
+ },
92
+ customCSS: ``,
93
+ chatWindow: {
94
+ showTitle: true,
95
+ showAgentMessages: true,
96
+ title: 'Agent Studio Bot',
97
+ titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
98
+ welcomeMessage: 'Hello! This is custom welcome message',
99
+ errorMessage: 'This is a custom error message',
100
+ backgroundColor: '#ffffff',
101
+ backgroundImage: 'enter image path or link',
102
+ height: 700,
103
+ width: 400,
104
+ fontSize: 16,
105
+ starterPrompts: ['What is a bot?', 'Who are you?'],
106
+ starterPromptFontSize: 15,
107
+ clearChatOnReload: false,
108
+ sourceDocsTitle: 'Sources:',
109
+ renderHTML: true,
110
+ botMessage: {
111
+ backgroundColor: '#f7f8ff',
112
+ textColor: '#303235',
113
+ showAvatar: true,
114
+ avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png',
115
+ },
116
+ userMessage: {
117
+ backgroundColor: '#3B81F6',
118
+ textColor: '#ffffff',
119
+ showAvatar: true,
120
+ avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png',
121
+ },
122
+ textInput: {
123
+ placeholder: 'Type your question',
124
+ backgroundColor: '#ffffff',
125
+ textColor: '#303235',
126
+ sendButtonColor: '#3B81F6',
127
+ maxChars: 50,
128
+ maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.',
129
+ autoFocus: true,
130
+ sendMessageSound: true,
131
+ sendSoundLocation: 'send_message.mp3',
132
+ receiveMessageSound: true,
133
+ receiveSoundLocation: 'receive_message.mp3',
134
+ },
135
+ feedback: {
136
+ color: '#303235',
137
+ },
138
+ dateTimeToggle: {
139
+ date: true,
140
+ time: true,
141
+ },
142
+ footer: {
143
+ textColor: '#303235',
144
+ text: 'Powered by',
145
+ company: 'Agent Studio',
146
+ // companyLink: 'https://flowiseai.com'
147
+ companyLink: '#',
148
+ },
149
+ },
150
+ }),
151
+ });
152
+ </script>
153
+ </body>
154
+ </html>