@a.izzuddin/ai-chat 0.2.25 → 0.2.26
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +87 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5373,7 +5373,7 @@ MarkdownIt.prototype.renderInline = function(src, env) {
|
|
|
5373
5373
|
var lib_default = MarkdownIt;
|
|
5374
5374
|
|
|
5375
5375
|
// src/components/ai-chat.ts
|
|
5376
|
-
console.log("Chatbot Ver = 0.2.
|
|
5376
|
+
console.log("Chatbot Ver = 0.2.25-beta.5");
|
|
5377
5377
|
var md = new lib_default({
|
|
5378
5378
|
html: false,
|
|
5379
5379
|
// Disable HTML tags in source for security
|
|
@@ -5791,7 +5791,8 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
5791
5791
|
id: (Date.now() + 1).toString(),
|
|
5792
5792
|
role: "assistant",
|
|
5793
5793
|
content: responseText,
|
|
5794
|
-
suggestedQuestions
|
|
5794
|
+
suggestedQuestions,
|
|
5795
|
+
language: this.language
|
|
5795
5796
|
};
|
|
5796
5797
|
this.messages = [...this.messages, assistantMessage];
|
|
5797
5798
|
this.clearPendingRequest();
|
|
@@ -5940,7 +5941,8 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
5940
5941
|
content: responseText,
|
|
5941
5942
|
faqs,
|
|
5942
5943
|
suggestedQuestions,
|
|
5943
|
-
confidence
|
|
5944
|
+
confidence,
|
|
5945
|
+
language: this.language
|
|
5944
5946
|
};
|
|
5945
5947
|
this.messages = [...this.messages, assistantMessage];
|
|
5946
5948
|
this.clearPendingRequest();
|
|
@@ -6027,7 +6029,8 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
6027
6029
|
id: (Date.now() + 1).toString(),
|
|
6028
6030
|
role: "assistant",
|
|
6029
6031
|
content: responseText,
|
|
6030
|
-
suggestedQuestions
|
|
6032
|
+
suggestedQuestions,
|
|
6033
|
+
language: this.language
|
|
6031
6034
|
};
|
|
6032
6035
|
this.messages = [...this.messages, assistantMessage];
|
|
6033
6036
|
this.clearPendingRequest();
|
|
@@ -6196,7 +6199,8 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
6196
6199
|
content: responseText,
|
|
6197
6200
|
faqs,
|
|
6198
6201
|
suggestedQuestions,
|
|
6199
|
-
confidence
|
|
6202
|
+
confidence,
|
|
6203
|
+
language: this.language
|
|
6200
6204
|
};
|
|
6201
6205
|
this.messages = [...this.messages, assistantMessage];
|
|
6202
6206
|
this.clearPendingRequest();
|
|
@@ -6228,6 +6232,13 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
6228
6232
|
<!-- Header -->
|
|
6229
6233
|
<div class="header" style="--primary-color: ${this.primaryColor}; --primary-color-light: ${primaryColorLight}; --primary-color-hover: ${this.primaryColorHover};">
|
|
6230
6234
|
<div class="header-content">
|
|
6235
|
+
${this.mode === "widget" ? lit.html`
|
|
6236
|
+
<button class="header-back-button" @click=${this.toggleWidget} aria-label="Back">
|
|
6237
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
6238
|
+
<polyline points="15 18 9 12 15 6"></polyline>
|
|
6239
|
+
</svg>
|
|
6240
|
+
</button>
|
|
6241
|
+
` : ""}
|
|
6231
6242
|
<div class="header-avatar">
|
|
6232
6243
|
${this.botAvatarUrl ? lit.html`<img src="${this.botAvatarUrl}" alt="Bot" class="header-avatar-image" />` : lit.html`<svg viewBox="0 0 24 24" fill="none" stroke="${this.primaryColor}" stroke-width="2" style="width: 1.5rem; height: 1.5rem;">
|
|
6233
6244
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
|
|
@@ -6278,7 +6289,7 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
6278
6289
|
` : ""}
|
|
6279
6290
|
${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? lit.html`
|
|
6280
6291
|
<div class="faq-section">
|
|
6281
|
-
<p class="faq-title">${
|
|
6292
|
+
<p class="faq-title">${msg.language === "ms" || msg.language === "my" ? "Cadangan Soalan:" : "Suggested Questions:"}</p>
|
|
6282
6293
|
<ul class="faq-list">
|
|
6283
6294
|
${msg.suggestedQuestions.map((question) => lit.html`
|
|
6284
6295
|
<li class="faq-item" @click=${(e) => this.handleFAQClick(question, e)}>
|
|
@@ -6370,14 +6381,18 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
6370
6381
|
<button
|
|
6371
6382
|
class=${classMap_js.classMap({
|
|
6372
6383
|
"widget-button": true,
|
|
6373
|
-
"widget-button-no-bg": !!this.widgetIconUrl,
|
|
6374
|
-
"widget-button-
|
|
6384
|
+
"widget-button-no-bg": !this.isOpen && !!this.widgetIconUrl,
|
|
6385
|
+
"widget-button-close": this.isOpen
|
|
6375
6386
|
})}
|
|
6376
6387
|
style="--primary-color: ${this.primaryColor}; --primary-color-light: ${primaryColorLight};"
|
|
6377
6388
|
@click=${this.toggleWidget}
|
|
6378
6389
|
aria-label=${this.isOpen ? "Close chat" : "Open chat"}
|
|
6379
6390
|
>
|
|
6380
|
-
${this.
|
|
6391
|
+
${this.isOpen ? lit.html`
|
|
6392
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
6393
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
6394
|
+
</svg>
|
|
6395
|
+
` : this.widgetIconUrl ? lit.html`
|
|
6381
6396
|
<img src="${this.widgetIconUrl}" alt="Chat" class="widget-button-icon" />
|
|
6382
6397
|
` : lit.html`
|
|
6383
6398
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
@@ -6453,8 +6468,19 @@ exports.AIChat.styles = lit.css`
|
|
|
6453
6468
|
transform: scale(1.1);
|
|
6454
6469
|
}
|
|
6455
6470
|
|
|
6456
|
-
.widget-button-
|
|
6457
|
-
|
|
6471
|
+
.widget-button-close {
|
|
6472
|
+
background: var(--primary-color, #3681D3);
|
|
6473
|
+
box-shadow: 0 4px 16px rgba(54, 129, 211, 0.3);
|
|
6474
|
+
}
|
|
6475
|
+
|
|
6476
|
+
.widget-button-close:hover {
|
|
6477
|
+
background: var(--primary-color, #3681D3);
|
|
6478
|
+
box-shadow: 0 6px 20px rgba(54, 129, 211, 0.4);
|
|
6479
|
+
transform: scale(1.05);
|
|
6480
|
+
}
|
|
6481
|
+
|
|
6482
|
+
.widget-button-close svg {
|
|
6483
|
+
color: #ffffff;
|
|
6458
6484
|
}
|
|
6459
6485
|
|
|
6460
6486
|
.widget-speech-bubble {
|
|
@@ -6505,7 +6531,7 @@ exports.AIChat.styles = lit.css`
|
|
|
6505
6531
|
|
|
6506
6532
|
.widget-window {
|
|
6507
6533
|
position: absolute;
|
|
6508
|
-
bottom:
|
|
6534
|
+
bottom: 90px;
|
|
6509
6535
|
right: 0;
|
|
6510
6536
|
width: var(--widget-width, 380px);
|
|
6511
6537
|
height: var(--widget-height, 600px);
|
|
@@ -6551,10 +6577,14 @@ exports.AIChat.styles = lit.css`
|
|
|
6551
6577
|
/* Mobile portrait */
|
|
6552
6578
|
@media (max-width: 480px) and (orientation: portrait) {
|
|
6553
6579
|
.widget-window {
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6580
|
+
position: fixed;
|
|
6581
|
+
top: 0;
|
|
6582
|
+
left: 0;
|
|
6557
6583
|
right: 0;
|
|
6584
|
+
bottom: 0;
|
|
6585
|
+
width: 100vw;
|
|
6586
|
+
height: 100vh;
|
|
6587
|
+
border-radius: 0;
|
|
6558
6588
|
}
|
|
6559
6589
|
|
|
6560
6590
|
.widget-button {
|
|
@@ -6571,10 +6601,14 @@ exports.AIChat.styles = lit.css`
|
|
|
6571
6601
|
/* Mobile landscape */
|
|
6572
6602
|
@media (max-width: 900px) and (orientation: landscape) {
|
|
6573
6603
|
.widget-window {
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6604
|
+
position: fixed;
|
|
6605
|
+
top: 0;
|
|
6606
|
+
left: 0;
|
|
6577
6607
|
right: 0;
|
|
6608
|
+
bottom: 0;
|
|
6609
|
+
width: 100vw;
|
|
6610
|
+
height: 100vh;
|
|
6611
|
+
border-radius: 0;
|
|
6578
6612
|
}
|
|
6579
6613
|
|
|
6580
6614
|
.widget-button {
|
|
@@ -6835,6 +6869,41 @@ exports.AIChat.styles = lit.css`
|
|
|
6835
6869
|
height: 1.25rem;
|
|
6836
6870
|
}
|
|
6837
6871
|
|
|
6872
|
+
.header-back-button {
|
|
6873
|
+
display: none;
|
|
6874
|
+
background: none;
|
|
6875
|
+
border: none;
|
|
6876
|
+
cursor: pointer;
|
|
6877
|
+
color: #fff;
|
|
6878
|
+
padding: 0.3rem;
|
|
6879
|
+
align-items: center;
|
|
6880
|
+
justify-content: center;
|
|
6881
|
+
border-radius: 50%;
|
|
6882
|
+
transition: background 0.2s;
|
|
6883
|
+
flex-shrink: 0;
|
|
6884
|
+
}
|
|
6885
|
+
|
|
6886
|
+
.header-back-button:hover {
|
|
6887
|
+
background: rgba(255, 255, 255, 0.2);
|
|
6888
|
+
}
|
|
6889
|
+
|
|
6890
|
+
.header-back-button svg {
|
|
6891
|
+
width: 1.25rem;
|
|
6892
|
+
height: 1.25rem;
|
|
6893
|
+
}
|
|
6894
|
+
|
|
6895
|
+
@media (max-width: 480px) {
|
|
6896
|
+
.header-back-button {
|
|
6897
|
+
display: flex;
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6900
|
+
|
|
6901
|
+
@media (max-width: 900px) and (orientation: landscape) {
|
|
6902
|
+
.header-back-button {
|
|
6903
|
+
display: flex;
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
|
|
6838
6907
|
.messages-area {
|
|
6839
6908
|
flex: 1;
|
|
6840
6909
|
overflow-y: auto;
|