@a.izzuddin/ai-chat 0.2.4 → 0.2.7
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 +230 -192
- package/README.npm.md +3 -3
- package/custom-elements.json +242 -12
- package/dist/index.d.mts +66 -1
- package/dist/index.d.ts +66 -1
- package/dist/index.js +548 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +548 -75
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
package/custom-elements.json
CHANGED
|
@@ -66,6 +66,23 @@
|
|
|
66
66
|
}
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
|
+
{
|
|
70
|
+
"kind": "javascript-module",
|
|
71
|
+
"path": "dist/index.js",
|
|
72
|
+
"declarations": [
|
|
73
|
+
{
|
|
74
|
+
"kind": "variable",
|
|
75
|
+
"name": "faqs",
|
|
76
|
+
"default": "void 0"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"kind": "variable",
|
|
80
|
+
"name": "suggestedQuestions",
|
|
81
|
+
"default": "void 0"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"exports": []
|
|
85
|
+
},
|
|
69
86
|
{
|
|
70
87
|
"kind": "javascript-module",
|
|
71
88
|
"path": "examples/angular.component.ts",
|
|
@@ -156,18 +173,6 @@
|
|
|
156
173
|
}
|
|
157
174
|
]
|
|
158
175
|
},
|
|
159
|
-
{
|
|
160
|
-
"kind": "javascript-module",
|
|
161
|
-
"path": "dist/index.js",
|
|
162
|
-
"declarations": [
|
|
163
|
-
{
|
|
164
|
-
"kind": "variable",
|
|
165
|
-
"name": "faqs",
|
|
166
|
-
"default": "void 0"
|
|
167
|
-
}
|
|
168
|
-
],
|
|
169
|
-
"exports": []
|
|
170
|
-
},
|
|
171
176
|
{
|
|
172
177
|
"kind": "javascript-module",
|
|
173
178
|
"path": "lib/utils.ts",
|
|
@@ -216,21 +221,59 @@
|
|
|
216
221
|
"name": "Message",
|
|
217
222
|
"module": "./components/ai-chat"
|
|
218
223
|
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"kind": "js",
|
|
227
|
+
"name": "FAQ",
|
|
228
|
+
"declaration": {
|
|
229
|
+
"name": "FAQ",
|
|
230
|
+
"module": "./components/ai-chat"
|
|
231
|
+
}
|
|
219
232
|
}
|
|
220
233
|
]
|
|
221
234
|
},
|
|
235
|
+
{
|
|
236
|
+
"kind": "javascript-module",
|
|
237
|
+
"path": "tests/cdn-examples.spec.ts",
|
|
238
|
+
"declarations": [],
|
|
239
|
+
"exports": []
|
|
240
|
+
},
|
|
222
241
|
{
|
|
223
242
|
"kind": "javascript-module",
|
|
224
243
|
"path": "tests/chat.spec.ts",
|
|
225
244
|
"declarations": [],
|
|
226
245
|
"exports": []
|
|
227
246
|
},
|
|
247
|
+
{
|
|
248
|
+
"kind": "javascript-module",
|
|
249
|
+
"path": "tests/check-widget.spec.ts",
|
|
250
|
+
"declarations": [],
|
|
251
|
+
"exports": []
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"kind": "javascript-module",
|
|
255
|
+
"path": "tests/final-widget-test.spec.ts",
|
|
256
|
+
"declarations": [],
|
|
257
|
+
"exports": []
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"kind": "javascript-module",
|
|
261
|
+
"path": "tests/live-server-test.spec.ts",
|
|
262
|
+
"declarations": [],
|
|
263
|
+
"exports": []
|
|
264
|
+
},
|
|
228
265
|
{
|
|
229
266
|
"kind": "javascript-module",
|
|
230
267
|
"path": "tests/web-component.spec.ts",
|
|
231
268
|
"declarations": [],
|
|
232
269
|
"exports": []
|
|
233
270
|
},
|
|
271
|
+
{
|
|
272
|
+
"kind": "javascript-module",
|
|
273
|
+
"path": "tests/widget-visibility.spec.ts",
|
|
274
|
+
"declarations": [],
|
|
275
|
+
"exports": []
|
|
276
|
+
},
|
|
234
277
|
{
|
|
235
278
|
"kind": "javascript-module",
|
|
236
279
|
"path": "components/ui/avatar.tsx",
|
|
@@ -581,6 +624,86 @@
|
|
|
581
624
|
"default": "''",
|
|
582
625
|
"attribute": "background-image-url"
|
|
583
626
|
},
|
|
627
|
+
{
|
|
628
|
+
"kind": "field",
|
|
629
|
+
"name": "widgetWidth",
|
|
630
|
+
"privacy": "public",
|
|
631
|
+
"type": {
|
|
632
|
+
"text": "string"
|
|
633
|
+
},
|
|
634
|
+
"default": "'380px'",
|
|
635
|
+
"attribute": "widget-width"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"kind": "field",
|
|
639
|
+
"name": "widgetHeight",
|
|
640
|
+
"privacy": "public",
|
|
641
|
+
"type": {
|
|
642
|
+
"text": "string"
|
|
643
|
+
},
|
|
644
|
+
"default": "'600px'",
|
|
645
|
+
"attribute": "widget-height"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"kind": "field",
|
|
649
|
+
"name": "primaryColor",
|
|
650
|
+
"privacy": "public",
|
|
651
|
+
"type": {
|
|
652
|
+
"text": "string"
|
|
653
|
+
},
|
|
654
|
+
"default": "'#3681D3'",
|
|
655
|
+
"attribute": "primary-color"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"kind": "field",
|
|
659
|
+
"name": "primaryColorHover",
|
|
660
|
+
"privacy": "public",
|
|
661
|
+
"type": {
|
|
662
|
+
"text": "string"
|
|
663
|
+
},
|
|
664
|
+
"default": "'#3457C7'",
|
|
665
|
+
"attribute": "primary-color-hover"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
"kind": "field",
|
|
669
|
+
"name": "userMessageBg",
|
|
670
|
+
"privacy": "public",
|
|
671
|
+
"type": {
|
|
672
|
+
"text": "string"
|
|
673
|
+
},
|
|
674
|
+
"default": "'#D6E4FF'",
|
|
675
|
+
"attribute": "user-message-bg"
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
"kind": "field",
|
|
679
|
+
"name": "botMessageBg",
|
|
680
|
+
"privacy": "public",
|
|
681
|
+
"type": {
|
|
682
|
+
"text": "string"
|
|
683
|
+
},
|
|
684
|
+
"default": "'#F5F5F5'",
|
|
685
|
+
"attribute": "bot-message-bg"
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"kind": "field",
|
|
689
|
+
"name": "welcomeMessage",
|
|
690
|
+
"privacy": "public",
|
|
691
|
+
"type": {
|
|
692
|
+
"text": "string"
|
|
693
|
+
},
|
|
694
|
+
"default": "'How can I help you today?'",
|
|
695
|
+
"attribute": "welcome-message"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"kind": "field",
|
|
699
|
+
"name": "welcomeSubtitle",
|
|
700
|
+
"privacy": "public",
|
|
701
|
+
"type": {
|
|
702
|
+
"text": "string"
|
|
703
|
+
},
|
|
704
|
+
"default": "''",
|
|
705
|
+
"attribute": "welcome-subtitle"
|
|
706
|
+
},
|
|
584
707
|
{
|
|
585
708
|
"kind": "field",
|
|
586
709
|
"name": "messages",
|
|
@@ -630,6 +753,49 @@
|
|
|
630
753
|
"name": "toggleWidget",
|
|
631
754
|
"privacy": "private"
|
|
632
755
|
},
|
|
756
|
+
{
|
|
757
|
+
"kind": "method",
|
|
758
|
+
"name": "lightenColor",
|
|
759
|
+
"privacy": "private",
|
|
760
|
+
"return": {
|
|
761
|
+
"type": {
|
|
762
|
+
"text": "string"
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
"parameters": [
|
|
766
|
+
{
|
|
767
|
+
"name": "hex",
|
|
768
|
+
"type": {
|
|
769
|
+
"text": "string"
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"name": "percent",
|
|
774
|
+
"default": "15",
|
|
775
|
+
"type": {
|
|
776
|
+
"text": "number"
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
]
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
"kind": "method",
|
|
783
|
+
"name": "formatMessageContent",
|
|
784
|
+
"privacy": "private",
|
|
785
|
+
"return": {
|
|
786
|
+
"type": {
|
|
787
|
+
"text": "string"
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
"parameters": [
|
|
791
|
+
{
|
|
792
|
+
"name": "content",
|
|
793
|
+
"type": {
|
|
794
|
+
"text": "string"
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
]
|
|
798
|
+
},
|
|
633
799
|
{
|
|
634
800
|
"kind": "method",
|
|
635
801
|
"name": "scrollToBottom",
|
|
@@ -767,6 +933,70 @@
|
|
|
767
933
|
},
|
|
768
934
|
"default": "''",
|
|
769
935
|
"fieldName": "backgroundImageUrl"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
"name": "widget-width",
|
|
939
|
+
"type": {
|
|
940
|
+
"text": "string"
|
|
941
|
+
},
|
|
942
|
+
"default": "'380px'",
|
|
943
|
+
"fieldName": "widgetWidth"
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
"name": "widget-height",
|
|
947
|
+
"type": {
|
|
948
|
+
"text": "string"
|
|
949
|
+
},
|
|
950
|
+
"default": "'600px'",
|
|
951
|
+
"fieldName": "widgetHeight"
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"name": "primary-color",
|
|
955
|
+
"type": {
|
|
956
|
+
"text": "string"
|
|
957
|
+
},
|
|
958
|
+
"default": "'#3681D3'",
|
|
959
|
+
"fieldName": "primaryColor"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
"name": "primary-color-hover",
|
|
963
|
+
"type": {
|
|
964
|
+
"text": "string"
|
|
965
|
+
},
|
|
966
|
+
"default": "'#3457C7'",
|
|
967
|
+
"fieldName": "primaryColorHover"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
"name": "user-message-bg",
|
|
971
|
+
"type": {
|
|
972
|
+
"text": "string"
|
|
973
|
+
},
|
|
974
|
+
"default": "'#D6E4FF'",
|
|
975
|
+
"fieldName": "userMessageBg"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
"name": "bot-message-bg",
|
|
979
|
+
"type": {
|
|
980
|
+
"text": "string"
|
|
981
|
+
},
|
|
982
|
+
"default": "'#F5F5F5'",
|
|
983
|
+
"fieldName": "botMessageBg"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"name": "welcome-message",
|
|
987
|
+
"type": {
|
|
988
|
+
"text": "string"
|
|
989
|
+
},
|
|
990
|
+
"default": "'How can I help you today?'",
|
|
991
|
+
"fieldName": "welcomeMessage"
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
"name": "welcome-subtitle",
|
|
995
|
+
"type": {
|
|
996
|
+
"text": "string"
|
|
997
|
+
},
|
|
998
|
+
"default": "''",
|
|
999
|
+
"fieldName": "welcomeSubtitle"
|
|
770
1000
|
}
|
|
771
1001
|
],
|
|
772
1002
|
"superclass": {
|
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ interface Message {
|
|
|
11
11
|
role: 'user' | 'assistant';
|
|
12
12
|
content: string;
|
|
13
13
|
faqs?: FAQ[];
|
|
14
|
+
suggestedQuestions?: string[];
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* AI Chat Web Component
|
|
@@ -21,11 +22,33 @@ interface Message {
|
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* ```html
|
|
25
|
+
* <!-- Basic usage -->
|
|
24
26
|
* <ai-chat
|
|
25
27
|
* api-url="https://api.example.com"
|
|
26
28
|
* session-id="user-123"
|
|
27
29
|
* title="My AI Assistant">
|
|
28
30
|
* </ai-chat>
|
|
31
|
+
*
|
|
32
|
+
* <!-- Widget mode with custom size -->
|
|
33
|
+
* <ai-chat
|
|
34
|
+
* api-url="https://api.example.com"
|
|
35
|
+
* session-id="user-123"
|
|
36
|
+
* title="My AI Assistant"
|
|
37
|
+
* mode="widget"
|
|
38
|
+
* widget-width="400px"
|
|
39
|
+
* widget-height="650px">
|
|
40
|
+
* </ai-chat>
|
|
41
|
+
*
|
|
42
|
+
* <!-- Custom theme colors -->
|
|
43
|
+
* <ai-chat
|
|
44
|
+
* api-url="https://api.example.com"
|
|
45
|
+
* session-id="user-123"
|
|
46
|
+
* title="My AI Assistant"
|
|
47
|
+
* primary-color="#10B981"
|
|
48
|
+
* primary-color-hover="#059669"
|
|
49
|
+
* user-message-bg="#D1FAE5"
|
|
50
|
+
* bot-message-bg="#F3F4F6">
|
|
51
|
+
* </ai-chat>
|
|
29
52
|
* ```
|
|
30
53
|
*/
|
|
31
54
|
declare class AIChat extends LitElement {
|
|
@@ -38,6 +61,14 @@ declare class AIChat extends LitElement {
|
|
|
38
61
|
initialMessages: Message[];
|
|
39
62
|
botAvatarUrl: string;
|
|
40
63
|
backgroundImageUrl: string;
|
|
64
|
+
widgetWidth: string;
|
|
65
|
+
widgetHeight: string;
|
|
66
|
+
primaryColor: string;
|
|
67
|
+
primaryColorHover: string;
|
|
68
|
+
userMessageBg: string;
|
|
69
|
+
botMessageBg: string;
|
|
70
|
+
welcomeMessage: string;
|
|
71
|
+
welcomeSubtitle: string;
|
|
41
72
|
private messages;
|
|
42
73
|
private input;
|
|
43
74
|
private isLoading;
|
|
@@ -74,9 +105,43 @@ declare class AIChat extends LitElement {
|
|
|
74
105
|
type: StringConstructor;
|
|
75
106
|
attribute: string;
|
|
76
107
|
};
|
|
108
|
+
widgetWidth: {
|
|
109
|
+
type: StringConstructor;
|
|
110
|
+
attribute: string;
|
|
111
|
+
};
|
|
112
|
+
widgetHeight: {
|
|
113
|
+
type: StringConstructor;
|
|
114
|
+
attribute: string;
|
|
115
|
+
};
|
|
116
|
+
primaryColor: {
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
attribute: string;
|
|
119
|
+
};
|
|
120
|
+
primaryColorHover: {
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
attribute: string;
|
|
123
|
+
};
|
|
124
|
+
userMessageBg: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
attribute: string;
|
|
127
|
+
};
|
|
128
|
+
botMessageBg: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
attribute: string;
|
|
131
|
+
};
|
|
132
|
+
welcomeMessage: {
|
|
133
|
+
type: StringConstructor;
|
|
134
|
+
attribute: string;
|
|
135
|
+
};
|
|
136
|
+
welcomeSubtitle: {
|
|
137
|
+
type: StringConstructor;
|
|
138
|
+
attribute: string;
|
|
139
|
+
};
|
|
77
140
|
};
|
|
78
141
|
constructor();
|
|
79
142
|
private toggleWidget;
|
|
143
|
+
private lightenColor;
|
|
144
|
+
private formatMessageContent;
|
|
80
145
|
connectedCallback(): void;
|
|
81
146
|
updated(changedProperties: PropertyValues): void;
|
|
82
147
|
private scrollToBottom;
|
|
@@ -92,4 +157,4 @@ declare global {
|
|
|
92
157
|
}
|
|
93
158
|
}
|
|
94
159
|
|
|
95
|
-
export { AIChat, type Message };
|
|
160
|
+
export { AIChat, type FAQ, type Message };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface Message {
|
|
|
11
11
|
role: 'user' | 'assistant';
|
|
12
12
|
content: string;
|
|
13
13
|
faqs?: FAQ[];
|
|
14
|
+
suggestedQuestions?: string[];
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* AI Chat Web Component
|
|
@@ -21,11 +22,33 @@ interface Message {
|
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* ```html
|
|
25
|
+
* <!-- Basic usage -->
|
|
24
26
|
* <ai-chat
|
|
25
27
|
* api-url="https://api.example.com"
|
|
26
28
|
* session-id="user-123"
|
|
27
29
|
* title="My AI Assistant">
|
|
28
30
|
* </ai-chat>
|
|
31
|
+
*
|
|
32
|
+
* <!-- Widget mode with custom size -->
|
|
33
|
+
* <ai-chat
|
|
34
|
+
* api-url="https://api.example.com"
|
|
35
|
+
* session-id="user-123"
|
|
36
|
+
* title="My AI Assistant"
|
|
37
|
+
* mode="widget"
|
|
38
|
+
* widget-width="400px"
|
|
39
|
+
* widget-height="650px">
|
|
40
|
+
* </ai-chat>
|
|
41
|
+
*
|
|
42
|
+
* <!-- Custom theme colors -->
|
|
43
|
+
* <ai-chat
|
|
44
|
+
* api-url="https://api.example.com"
|
|
45
|
+
* session-id="user-123"
|
|
46
|
+
* title="My AI Assistant"
|
|
47
|
+
* primary-color="#10B981"
|
|
48
|
+
* primary-color-hover="#059669"
|
|
49
|
+
* user-message-bg="#D1FAE5"
|
|
50
|
+
* bot-message-bg="#F3F4F6">
|
|
51
|
+
* </ai-chat>
|
|
29
52
|
* ```
|
|
30
53
|
*/
|
|
31
54
|
declare class AIChat extends LitElement {
|
|
@@ -38,6 +61,14 @@ declare class AIChat extends LitElement {
|
|
|
38
61
|
initialMessages: Message[];
|
|
39
62
|
botAvatarUrl: string;
|
|
40
63
|
backgroundImageUrl: string;
|
|
64
|
+
widgetWidth: string;
|
|
65
|
+
widgetHeight: string;
|
|
66
|
+
primaryColor: string;
|
|
67
|
+
primaryColorHover: string;
|
|
68
|
+
userMessageBg: string;
|
|
69
|
+
botMessageBg: string;
|
|
70
|
+
welcomeMessage: string;
|
|
71
|
+
welcomeSubtitle: string;
|
|
41
72
|
private messages;
|
|
42
73
|
private input;
|
|
43
74
|
private isLoading;
|
|
@@ -74,9 +105,43 @@ declare class AIChat extends LitElement {
|
|
|
74
105
|
type: StringConstructor;
|
|
75
106
|
attribute: string;
|
|
76
107
|
};
|
|
108
|
+
widgetWidth: {
|
|
109
|
+
type: StringConstructor;
|
|
110
|
+
attribute: string;
|
|
111
|
+
};
|
|
112
|
+
widgetHeight: {
|
|
113
|
+
type: StringConstructor;
|
|
114
|
+
attribute: string;
|
|
115
|
+
};
|
|
116
|
+
primaryColor: {
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
attribute: string;
|
|
119
|
+
};
|
|
120
|
+
primaryColorHover: {
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
attribute: string;
|
|
123
|
+
};
|
|
124
|
+
userMessageBg: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
attribute: string;
|
|
127
|
+
};
|
|
128
|
+
botMessageBg: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
attribute: string;
|
|
131
|
+
};
|
|
132
|
+
welcomeMessage: {
|
|
133
|
+
type: StringConstructor;
|
|
134
|
+
attribute: string;
|
|
135
|
+
};
|
|
136
|
+
welcomeSubtitle: {
|
|
137
|
+
type: StringConstructor;
|
|
138
|
+
attribute: string;
|
|
139
|
+
};
|
|
77
140
|
};
|
|
78
141
|
constructor();
|
|
79
142
|
private toggleWidget;
|
|
143
|
+
private lightenColor;
|
|
144
|
+
private formatMessageContent;
|
|
80
145
|
connectedCallback(): void;
|
|
81
146
|
updated(changedProperties: PropertyValues): void;
|
|
82
147
|
private scrollToBottom;
|
|
@@ -92,4 +157,4 @@ declare global {
|
|
|
92
157
|
}
|
|
93
158
|
}
|
|
94
159
|
|
|
95
|
-
export { AIChat, type Message };
|
|
160
|
+
export { AIChat, type FAQ, type Message };
|