@a.izzuddin/ai-chat 0.2.21-beta.4 → 0.2.21
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.js +99 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5935,58 +5935,60 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
|
|
|
5935
5935
|
<div class="messages-area" style="--user-message-bg: ${this.userMessageBg}; --bot-message-bg: ${this.botMessageBg}; --primary-color: ${this.primaryColor}; --primary-color-light: ${primaryColorLight}; --primary-color-hover: ${this.primaryColorHover}; ${this.backgroundImageUrl ? `--background-image-url: url('${this.backgroundImageUrl}');` : ""}">
|
|
5936
5936
|
<div class="messages-container">
|
|
5937
5937
|
${repeat(this.messages, (msg) => msg.id, (msg) => html`
|
|
5938
|
-
<div
|
|
5939
|
-
|
|
5938
|
+
<div>
|
|
5939
|
+
<div
|
|
5940
|
+
class=${classMap({
|
|
5940
5941
|
message: true,
|
|
5941
5942
|
user: msg.role === "user",
|
|
5942
5943
|
assistant: msg.role === "assistant"
|
|
5943
5944
|
})}
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
</svg>` : this.botAvatarUrl ? html`<img src="${this.botAvatarUrl}" alt="AI" class="avatar-image" />` : "AI"}
|
|
5949
|
-
</div>
|
|
5950
|
-
<div class="message-content">
|
|
5951
|
-
<div class="message-text">${unsafeHTML(this.formatMessageContent(msg.content))}</div>
|
|
5952
|
-
${msg.role === "assistant" && msg.confidence && !msg.confidence.is_confident ? html`
|
|
5953
|
-
<div class="contact-support-container">
|
|
5954
|
-
<a
|
|
5955
|
-
href="${this.contactSupportUrl}"
|
|
5956
|
-
target="_blank"
|
|
5957
|
-
rel="noopener noreferrer"
|
|
5958
|
-
class="contact-support-button"
|
|
5959
|
-
style="--primary-color: ${this.primaryColor}; --primary-color-hover: ${this.primaryColorHover};"
|
|
5960
|
-
>
|
|
5961
|
-
${this.contactSupportMessage}
|
|
5962
|
-
</a>
|
|
5963
|
-
</div>
|
|
5964
|
-
` : ""}
|
|
5965
|
-
${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? html`
|
|
5966
|
-
<div class="faq-section">
|
|
5967
|
-
<p class="faq-title">Related FAQs:</p>
|
|
5968
|
-
<ul class="faq-list">
|
|
5969
|
-
${msg.faqs.map((faq) => html`
|
|
5970
|
-
<li class="faq-item-static">
|
|
5971
|
-
${faq.Question}
|
|
5972
|
-
</li>
|
|
5973
|
-
`)}
|
|
5974
|
-
</ul>
|
|
5975
|
-
</div>
|
|
5976
|
-
` : ""}
|
|
5977
|
-
${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? html`
|
|
5978
|
-
<div class="faq-section">
|
|
5979
|
-
<p class="faq-title">Cadangan Soalan:</p>
|
|
5980
|
-
<ul class="faq-list">
|
|
5981
|
-
${msg.suggestedQuestions.map((question) => html`
|
|
5982
|
-
<li class="faq-item" @click=${() => this.handleFAQClick(question)}>
|
|
5983
|
-
${question.question_text}
|
|
5984
|
-
</li>
|
|
5985
|
-
`)}
|
|
5986
|
-
</ul>
|
|
5945
|
+
>
|
|
5946
|
+
${msg.role === "assistant" ? html`
|
|
5947
|
+
<div class="avatar">
|
|
5948
|
+
${this.botAvatarUrl ? html`<img src="${this.botAvatarUrl}" alt="AI" class="avatar-image" />` : "AI"}
|
|
5987
5949
|
</div>
|
|
5988
5950
|
` : ""}
|
|
5951
|
+
<div class="message-content">
|
|
5952
|
+
<div class="message-text">${unsafeHTML(this.formatMessageContent(msg.content))}</div>
|
|
5953
|
+
${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? html`
|
|
5954
|
+
<div class="faq-section">
|
|
5955
|
+
<p class="faq-title">Related FAQs:</p>
|
|
5956
|
+
<ul class="faq-list">
|
|
5957
|
+
${msg.faqs.map((faq) => html`
|
|
5958
|
+
<li class="faq-item-static">
|
|
5959
|
+
${faq.Question}
|
|
5960
|
+
</li>
|
|
5961
|
+
`)}
|
|
5962
|
+
</ul>
|
|
5963
|
+
</div>
|
|
5964
|
+
` : ""}
|
|
5965
|
+
${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? html`
|
|
5966
|
+
<div class="faq-section">
|
|
5967
|
+
<p class="faq-title">Cadangan Soalan:</p>
|
|
5968
|
+
<ul class="faq-list">
|
|
5969
|
+
${msg.suggestedQuestions.map((question) => html`
|
|
5970
|
+
<li class="faq-item" @click=${() => this.handleFAQClick(question)}>
|
|
5971
|
+
${question.question_text}
|
|
5972
|
+
</li>
|
|
5973
|
+
`)}
|
|
5974
|
+
</ul>
|
|
5975
|
+
</div>
|
|
5976
|
+
` : ""}
|
|
5977
|
+
</div>
|
|
5989
5978
|
</div>
|
|
5979
|
+
${msg.role === "assistant" && msg.confidence && !msg.confidence.is_confident ? html`
|
|
5980
|
+
<div class="contact-support-wrapper">
|
|
5981
|
+
<a
|
|
5982
|
+
href="${this.contactSupportUrl}"
|
|
5983
|
+
target="_blank"
|
|
5984
|
+
rel="noopener noreferrer"
|
|
5985
|
+
class="contact-support-button"
|
|
5986
|
+
style="--primary-color: ${this.primaryColor}; --primary-color-hover: ${this.primaryColorHover};"
|
|
5987
|
+
>
|
|
5988
|
+
${this.contactSupportMessage}
|
|
5989
|
+
</a>
|
|
5990
|
+
</div>
|
|
5991
|
+
` : ""}
|
|
5990
5992
|
</div>
|
|
5991
5993
|
`)}
|
|
5992
5994
|
|
|
@@ -6238,6 +6240,10 @@ AIChat.styles = css`
|
|
|
6238
6240
|
|
|
6239
6241
|
/* Mobile responsive styles for all modes */
|
|
6240
6242
|
@media (max-width: 768px) {
|
|
6243
|
+
.contact-support-wrapper {
|
|
6244
|
+
margin-left: 2.75rem;
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6241
6247
|
.header {
|
|
6242
6248
|
padding: 0.875rem 1rem;
|
|
6243
6249
|
}
|
|
@@ -6259,6 +6265,14 @@ AIChat.styles = css`
|
|
|
6259
6265
|
gap: 0.75rem;
|
|
6260
6266
|
}
|
|
6261
6267
|
|
|
6268
|
+
.message.user {
|
|
6269
|
+
margin-left: 3.5rem;
|
|
6270
|
+
}
|
|
6271
|
+
|
|
6272
|
+
.message.assistant {
|
|
6273
|
+
margin-right: 2.75rem;
|
|
6274
|
+
}
|
|
6275
|
+
|
|
6262
6276
|
.avatar {
|
|
6263
6277
|
width: 2rem;
|
|
6264
6278
|
height: 2rem;
|
|
@@ -6268,6 +6282,11 @@ AIChat.styles = css`
|
|
|
6268
6282
|
.message-content {
|
|
6269
6283
|
max-width: 100%;
|
|
6270
6284
|
font-size: 0.9375rem;
|
|
6285
|
+
padding: 0.875rem 1.25rem;
|
|
6286
|
+
}
|
|
6287
|
+
|
|
6288
|
+
.message.user .message-content {
|
|
6289
|
+
max-width: 85%;
|
|
6271
6290
|
}
|
|
6272
6291
|
|
|
6273
6292
|
.empty-state {
|
|
@@ -6317,6 +6336,10 @@ AIChat.styles = css`
|
|
|
6317
6336
|
|
|
6318
6337
|
/* Extra small screens */
|
|
6319
6338
|
@media (max-width: 480px) {
|
|
6339
|
+
.contact-support-wrapper {
|
|
6340
|
+
margin-left: 2.25rem;
|
|
6341
|
+
}
|
|
6342
|
+
|
|
6320
6343
|
.header {
|
|
6321
6344
|
padding: 0.75rem 0.875rem;
|
|
6322
6345
|
}
|
|
@@ -6338,6 +6361,14 @@ AIChat.styles = css`
|
|
|
6338
6361
|
gap: 0.5rem;
|
|
6339
6362
|
}
|
|
6340
6363
|
|
|
6364
|
+
.message.user {
|
|
6365
|
+
margin-left: 3rem;
|
|
6366
|
+
}
|
|
6367
|
+
|
|
6368
|
+
.message.assistant {
|
|
6369
|
+
margin-right: 2.25rem;
|
|
6370
|
+
}
|
|
6371
|
+
|
|
6341
6372
|
.avatar {
|
|
6342
6373
|
width: 1.75rem;
|
|
6343
6374
|
height: 1.75rem;
|
|
@@ -6345,11 +6376,15 @@ AIChat.styles = css`
|
|
|
6345
6376
|
}
|
|
6346
6377
|
|
|
6347
6378
|
.message-content {
|
|
6348
|
-
padding: 0.
|
|
6379
|
+
padding: 0.75rem 1rem;
|
|
6349
6380
|
font-size: 0.875rem;
|
|
6350
6381
|
border-radius: 0.75rem;
|
|
6351
6382
|
}
|
|
6352
6383
|
|
|
6384
|
+
.message.user .message-content {
|
|
6385
|
+
max-width: 80%;
|
|
6386
|
+
}
|
|
6387
|
+
|
|
6353
6388
|
.empty-state {
|
|
6354
6389
|
margin-top: 2rem;
|
|
6355
6390
|
}
|
|
@@ -6543,6 +6578,12 @@ AIChat.styles = css`
|
|
|
6543
6578
|
|
|
6544
6579
|
.message.user {
|
|
6545
6580
|
flex-direction: row-reverse;
|
|
6581
|
+
justify-content: flex-end;
|
|
6582
|
+
margin-left: 5rem;
|
|
6583
|
+
}
|
|
6584
|
+
|
|
6585
|
+
.message.assistant {
|
|
6586
|
+
margin-right: 3.5rem;
|
|
6546
6587
|
}
|
|
6547
6588
|
|
|
6548
6589
|
.avatar {
|
|
@@ -6573,7 +6614,7 @@ AIChat.styles = css`
|
|
|
6573
6614
|
|
|
6574
6615
|
.message-content {
|
|
6575
6616
|
max-width: 36rem;
|
|
6576
|
-
padding: 1.
|
|
6617
|
+
padding: 1rem 1.5rem;
|
|
6577
6618
|
border-radius: 1.25rem;
|
|
6578
6619
|
line-height: 1.6;
|
|
6579
6620
|
overflow-wrap: break-word;
|
|
@@ -6584,13 +6625,15 @@ AIChat.styles = css`
|
|
|
6584
6625
|
.message.user .message-content {
|
|
6585
6626
|
background: var(--user-message-bg, #D6E4FF);
|
|
6586
6627
|
color: #1a1a1a;
|
|
6587
|
-
border-radius: 1.25rem
|
|
6628
|
+
border-radius: 1.25rem 0.25rem 1.25rem 1.25rem;
|
|
6629
|
+
max-width: 26rem;
|
|
6630
|
+
margin-left: auto;
|
|
6588
6631
|
}
|
|
6589
6632
|
|
|
6590
6633
|
.message.assistant .message-content {
|
|
6591
6634
|
background: var(--bot-message-bg, #F5F5F5);
|
|
6592
6635
|
color: #1a1a1a;
|
|
6593
|
-
border-radius:
|
|
6636
|
+
border-radius: 0.25rem 1.25rem 1.25rem 1.25rem;
|
|
6594
6637
|
}
|
|
6595
6638
|
|
|
6596
6639
|
:host([theme="dark"]) .message.user .message-content {
|
|
@@ -6808,20 +6851,16 @@ AIChat.styles = css`
|
|
|
6808
6851
|
color: #FCD34D;
|
|
6809
6852
|
}
|
|
6810
6853
|
|
|
6811
|
-
.contact-support-
|
|
6812
|
-
position: sticky;
|
|
6813
|
-
bottom: 0.5rem;
|
|
6814
|
-
z-index: 10;
|
|
6815
|
-
margin-top: 0.75rem;
|
|
6816
|
-
padding-bottom: 0;
|
|
6854
|
+
.contact-support-wrapper {
|
|
6817
6855
|
display: flex;
|
|
6818
|
-
justify-content:
|
|
6819
|
-
|
|
6856
|
+
justify-content: flex-start;
|
|
6857
|
+
margin-top: 0.75rem;
|
|
6858
|
+
margin-left: 3.5rem;
|
|
6820
6859
|
}
|
|
6821
6860
|
|
|
6822
6861
|
.contact-support-button {
|
|
6823
6862
|
padding: 0.625rem 1.25rem;
|
|
6824
|
-
background:
|
|
6863
|
+
background: transparent;
|
|
6825
6864
|
color: var(--primary-color, #3681D3);
|
|
6826
6865
|
border: 1.5px solid var(--primary-color, #3681D3);
|
|
6827
6866
|
border-radius: 1.5rem;
|
|
@@ -6832,24 +6871,19 @@ AIChat.styles = css`
|
|
|
6832
6871
|
display: inline-block;
|
|
6833
6872
|
text-decoration: none;
|
|
6834
6873
|
white-space: nowrap;
|
|
6835
|
-
pointer-events: auto;
|
|
6836
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
6837
6874
|
}
|
|
6838
6875
|
|
|
6839
6876
|
.contact-support-button:hover {
|
|
6840
6877
|
background: var(--primary-color, #3681D3);
|
|
6841
6878
|
color: #fff;
|
|
6842
|
-
transform: translateY(-1px);
|
|
6843
|
-
box-shadow: 0 2px 8px rgba(54, 129, 211, 0.25);
|
|
6844
6879
|
}
|
|
6845
6880
|
|
|
6846
6881
|
.contact-support-button:active {
|
|
6847
|
-
transform:
|
|
6848
|
-
box-shadow: 0 1px 4px rgba(54, 129, 211, 0.2);
|
|
6882
|
+
transform: scale(0.98);
|
|
6849
6883
|
}
|
|
6850
6884
|
|
|
6851
6885
|
:host([theme="dark"]) .contact-support-button {
|
|
6852
|
-
background:
|
|
6886
|
+
background: transparent;
|
|
6853
6887
|
color: var(--primary-color-light, #5B7FE8);
|
|
6854
6888
|
border-color: var(--primary-color-light, #5B7FE8);
|
|
6855
6889
|
}
|