@a.izzuddin/ai-chat 0.2.4 → 0.2.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/README.md +166 -215
- package/README.npm.md +3 -3
- package/custom-elements.json +188 -12
- package/dist/index.d.mts +55 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +384 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -65
- 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,66 @@
|
|
|
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
|
+
},
|
|
584
687
|
{
|
|
585
688
|
"kind": "field",
|
|
586
689
|
"name": "messages",
|
|
@@ -630,6 +733,31 @@
|
|
|
630
733
|
"name": "toggleWidget",
|
|
631
734
|
"privacy": "private"
|
|
632
735
|
},
|
|
736
|
+
{
|
|
737
|
+
"kind": "method",
|
|
738
|
+
"name": "lightenColor",
|
|
739
|
+
"privacy": "private",
|
|
740
|
+
"return": {
|
|
741
|
+
"type": {
|
|
742
|
+
"text": "string"
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
"parameters": [
|
|
746
|
+
{
|
|
747
|
+
"name": "hex",
|
|
748
|
+
"type": {
|
|
749
|
+
"text": "string"
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"name": "percent",
|
|
754
|
+
"default": "15",
|
|
755
|
+
"type": {
|
|
756
|
+
"text": "number"
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
]
|
|
760
|
+
},
|
|
633
761
|
{
|
|
634
762
|
"kind": "method",
|
|
635
763
|
"name": "scrollToBottom",
|
|
@@ -767,6 +895,54 @@
|
|
|
767
895
|
},
|
|
768
896
|
"default": "''",
|
|
769
897
|
"fieldName": "backgroundImageUrl"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
"name": "widget-width",
|
|
901
|
+
"type": {
|
|
902
|
+
"text": "string"
|
|
903
|
+
},
|
|
904
|
+
"default": "'380px'",
|
|
905
|
+
"fieldName": "widgetWidth"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"name": "widget-height",
|
|
909
|
+
"type": {
|
|
910
|
+
"text": "string"
|
|
911
|
+
},
|
|
912
|
+
"default": "'600px'",
|
|
913
|
+
"fieldName": "widgetHeight"
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
"name": "primary-color",
|
|
917
|
+
"type": {
|
|
918
|
+
"text": "string"
|
|
919
|
+
},
|
|
920
|
+
"default": "'#3681D3'",
|
|
921
|
+
"fieldName": "primaryColor"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"name": "primary-color-hover",
|
|
925
|
+
"type": {
|
|
926
|
+
"text": "string"
|
|
927
|
+
},
|
|
928
|
+
"default": "'#3457C7'",
|
|
929
|
+
"fieldName": "primaryColorHover"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"name": "user-message-bg",
|
|
933
|
+
"type": {
|
|
934
|
+
"text": "string"
|
|
935
|
+
},
|
|
936
|
+
"default": "'#D6E4FF'",
|
|
937
|
+
"fieldName": "userMessageBg"
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
"name": "bot-message-bg",
|
|
941
|
+
"type": {
|
|
942
|
+
"text": "string"
|
|
943
|
+
},
|
|
944
|
+
"default": "'#F5F5F5'",
|
|
945
|
+
"fieldName": "botMessageBg"
|
|
770
946
|
}
|
|
771
947
|
],
|
|
772
948
|
"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,12 @@ 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;
|
|
41
70
|
private messages;
|
|
42
71
|
private input;
|
|
43
72
|
private isLoading;
|
|
@@ -74,9 +103,34 @@ declare class AIChat extends LitElement {
|
|
|
74
103
|
type: StringConstructor;
|
|
75
104
|
attribute: string;
|
|
76
105
|
};
|
|
106
|
+
widgetWidth: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
attribute: string;
|
|
109
|
+
};
|
|
110
|
+
widgetHeight: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
attribute: string;
|
|
113
|
+
};
|
|
114
|
+
primaryColor: {
|
|
115
|
+
type: StringConstructor;
|
|
116
|
+
attribute: string;
|
|
117
|
+
};
|
|
118
|
+
primaryColorHover: {
|
|
119
|
+
type: StringConstructor;
|
|
120
|
+
attribute: string;
|
|
121
|
+
};
|
|
122
|
+
userMessageBg: {
|
|
123
|
+
type: StringConstructor;
|
|
124
|
+
attribute: string;
|
|
125
|
+
};
|
|
126
|
+
botMessageBg: {
|
|
127
|
+
type: StringConstructor;
|
|
128
|
+
attribute: string;
|
|
129
|
+
};
|
|
77
130
|
};
|
|
78
131
|
constructor();
|
|
79
132
|
private toggleWidget;
|
|
133
|
+
private lightenColor;
|
|
80
134
|
connectedCallback(): void;
|
|
81
135
|
updated(changedProperties: PropertyValues): void;
|
|
82
136
|
private scrollToBottom;
|
|
@@ -92,4 +146,4 @@ declare global {
|
|
|
92
146
|
}
|
|
93
147
|
}
|
|
94
148
|
|
|
95
|
-
export { AIChat, type Message };
|
|
149
|
+
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,12 @@ 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;
|
|
41
70
|
private messages;
|
|
42
71
|
private input;
|
|
43
72
|
private isLoading;
|
|
@@ -74,9 +103,34 @@ declare class AIChat extends LitElement {
|
|
|
74
103
|
type: StringConstructor;
|
|
75
104
|
attribute: string;
|
|
76
105
|
};
|
|
106
|
+
widgetWidth: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
attribute: string;
|
|
109
|
+
};
|
|
110
|
+
widgetHeight: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
attribute: string;
|
|
113
|
+
};
|
|
114
|
+
primaryColor: {
|
|
115
|
+
type: StringConstructor;
|
|
116
|
+
attribute: string;
|
|
117
|
+
};
|
|
118
|
+
primaryColorHover: {
|
|
119
|
+
type: StringConstructor;
|
|
120
|
+
attribute: string;
|
|
121
|
+
};
|
|
122
|
+
userMessageBg: {
|
|
123
|
+
type: StringConstructor;
|
|
124
|
+
attribute: string;
|
|
125
|
+
};
|
|
126
|
+
botMessageBg: {
|
|
127
|
+
type: StringConstructor;
|
|
128
|
+
attribute: string;
|
|
129
|
+
};
|
|
77
130
|
};
|
|
78
131
|
constructor();
|
|
79
132
|
private toggleWidget;
|
|
133
|
+
private lightenColor;
|
|
80
134
|
connectedCallback(): void;
|
|
81
135
|
updated(changedProperties: PropertyValues): void;
|
|
82
136
|
private scrollToBottom;
|
|
@@ -92,4 +146,4 @@ declare global {
|
|
|
92
146
|
}
|
|
93
147
|
}
|
|
94
148
|
|
|
95
|
-
export { AIChat, type Message };
|
|
149
|
+
export { AIChat, type FAQ, type Message };
|