@a.izzuddin/ai-chat 0.2.21-beta.0 → 0.2.21-beta.2

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.mjs CHANGED
@@ -5371,7 +5371,7 @@ MarkdownIt.prototype.renderInline = function(src, env) {
5371
5371
  var lib_default = MarkdownIt;
5372
5372
 
5373
5373
  // src/components/ai-chat.ts
5374
- console.log("Chatbot Ver = 0.2.21-beta.0");
5374
+ console.log("Chatbot Ver = 0.2.21-beta.2");
5375
5375
  var md = new lib_default({
5376
5376
  html: false,
5377
5377
  // Disable HTML tags in source for security
@@ -5405,6 +5405,7 @@ var AIChat = class extends LitElement {
5405
5405
  this.language = "en";
5406
5406
  this.showRelatedFaqs = false;
5407
5407
  this.errorMessage = "Maaf, terdapat masalah semasa menghubungi pelayan. Sila cuba lagi.";
5408
+ this.lowConfidenceMessage = "Sila hubungi helpdesk untuk pengesahan lanjut.";
5408
5409
  this.messages = [];
5409
5410
  this.input = "";
5410
5411
  this.isLoading = false;
@@ -5946,6 +5947,16 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
5946
5947
  </div>
5947
5948
  <div class="message-content">
5948
5949
  <div class="message-text">${unsafeHTML(this.formatMessageContent(msg.content))}</div>
5950
+ ${msg.role === "assistant" && msg.confidence && !msg.confidence.is_confident ? html`
5951
+ <div class="low-confidence-warning">
5952
+ <svg class="warning-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
5953
+ <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
5954
+ <line x1="12" y1="9" x2="12" y2="13"></line>
5955
+ <line x1="12" y1="17" x2="12.01" y2="17"></line>
5956
+ </svg>
5957
+ <span>${this.lowConfidenceMessage}</span>
5958
+ </div>
5959
+ ` : ""}
5949
5960
  ${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? html`
5950
5961
  <div class="faq-section">
5951
5962
  <p class="faq-title">Related FAQs:</p>
@@ -6251,7 +6262,6 @@ AIChat.styles = css`
6251
6262
 
6252
6263
  .message-content {
6253
6264
  max-width: 100%;
6254
- padding: 0.625rem 0.875rem;
6255
6265
  font-size: 0.9375rem;
6256
6266
  }
6257
6267
 
@@ -6558,7 +6568,7 @@ AIChat.styles = css`
6558
6568
 
6559
6569
  .message-content {
6560
6570
  max-width: 36rem;
6561
- padding: 0.875rem 1.125rem;
6571
+ padding: 1.125rem;
6562
6572
  border-radius: 1.25rem;
6563
6573
  line-height: 1.6;
6564
6574
  overflow-wrap: break-word;
@@ -6589,13 +6599,24 @@ AIChat.styles = css`
6589
6599
  }
6590
6600
 
6591
6601
  .message-text {
6592
- white-space: pre-wrap;
6593
6602
  margin: 0;
6594
6603
  word-wrap: break-word;
6595
6604
  overflow-wrap: break-word;
6596
6605
  word-break: break-word;
6597
6606
  }
6598
6607
 
6608
+ .message-text p {
6609
+ margin: 0 0 0.75rem 0;
6610
+ }
6611
+
6612
+ .message-text p:last-child {
6613
+ margin-bottom: 0;
6614
+ }
6615
+
6616
+ .message-text p:first-child {
6617
+ margin-top: 0;
6618
+ }
6619
+
6599
6620
  .message-text ul,
6600
6621
  .message-text ol {
6601
6622
  margin: 0.5rem 0;
@@ -6624,6 +6645,63 @@ AIChat.styles = css`
6624
6645
  list-style-type: decimal;
6625
6646
  }
6626
6647
 
6648
+ .message-text h1,
6649
+ .message-text h2,
6650
+ .message-text h3,
6651
+ .message-text h4,
6652
+ .message-text h5,
6653
+ .message-text h6 {
6654
+ margin: 0.75rem 0 0.5rem 0;
6655
+ font-weight: 600;
6656
+ }
6657
+
6658
+ .message-text h1:first-child,
6659
+ .message-text h2:first-child,
6660
+ .message-text h3:first-child,
6661
+ .message-text h4:first-child,
6662
+ .message-text h5:first-child,
6663
+ .message-text h6:first-child {
6664
+ margin-top: 0;
6665
+ }
6666
+
6667
+ .message-text blockquote {
6668
+ margin: 0.5rem 0;
6669
+ padding-left: 1rem;
6670
+ border-left: 3px solid #d1d5db;
6671
+ }
6672
+
6673
+ :host([theme="dark"]) .message-text blockquote {
6674
+ border-left-color: #3f3f46;
6675
+ }
6676
+
6677
+ .message-text code {
6678
+ background: rgba(0, 0, 0, 0.05);
6679
+ padding: 0.125rem 0.25rem;
6680
+ border-radius: 0.25rem;
6681
+ font-size: 0.875em;
6682
+ }
6683
+
6684
+ :host([theme="dark"]) .message-text code {
6685
+ background: rgba(255, 255, 255, 0.1);
6686
+ }
6687
+
6688
+ .message-text pre {
6689
+ margin: 0.5rem 0;
6690
+ padding: 0.75rem;
6691
+ background: rgba(0, 0, 0, 0.05);
6692
+ border-radius: 0.5rem;
6693
+ overflow-x: auto;
6694
+ }
6695
+
6696
+ :host([theme="dark"]) .message-text pre {
6697
+ background: rgba(255, 255, 255, 0.05);
6698
+ }
6699
+
6700
+ .message-text pre code {
6701
+ background: transparent;
6702
+ padding: 0;
6703
+ }
6704
+
6627
6705
  .faq-section {
6628
6706
  margin-top: 0.75rem;
6629
6707
  padding-top: 0.75rem;
@@ -6694,6 +6772,32 @@ AIChat.styles = css`
6694
6772
  color: #9CA3AF;
6695
6773
  } */
6696
6774
 
6775
+ .low-confidence-warning {
6776
+ margin-top: 0.75rem;
6777
+ padding: 0.75rem 1rem;
6778
+ background: #FEF3C7;
6779
+ border-left: 4px solid #F59E0B;
6780
+ border-radius: 0.5rem;
6781
+ font-size: 0.875rem;
6782
+ color: #92400E;
6783
+ display: flex;
6784
+ align-items: flex-start;
6785
+ gap: 0.5rem;
6786
+ }
6787
+
6788
+ :host([theme="dark"]) .low-confidence-warning {
6789
+ background: #451A03;
6790
+ border-left-color: #F59E0B;
6791
+ color: #FDE68A;
6792
+ }
6793
+
6794
+ .warning-icon {
6795
+ width: 1.25rem;
6796
+ height: 1.25rem;
6797
+ flex-shrink: 0;
6798
+ margin-top: 0.125rem;
6799
+ }
6800
+
6697
6801
  .loading {
6698
6802
  display: flex;
6699
6803
  gap: 1rem;
@@ -6835,7 +6939,8 @@ AIChat.properties = {
6835
6939
  initialQuestionsUrl: { type: String, attribute: "initial-questions-url" },
6836
6940
  language: { type: String, attribute: "language" },
6837
6941
  showRelatedFaqs: { type: Boolean, attribute: "show-related-faqs" },
6838
- errorMessage: { type: String, attribute: "error-message" }
6942
+ errorMessage: { type: String, attribute: "error-message" },
6943
+ lowConfidenceMessage: { type: String, attribute: "low-confidence-message" }
6839
6944
  };
6840
6945
  __decorateClass([
6841
6946
  state()