@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.
@@ -756,6 +756,16 @@
756
756
  "default": "'Maaf, terdapat masalah semasa menghubungi pelayan. Sila cuba lagi.'",
757
757
  "attribute": "error-message"
758
758
  },
759
+ {
760
+ "kind": "field",
761
+ "name": "lowConfidenceMessage",
762
+ "privacy": "public",
763
+ "type": {
764
+ "text": "string"
765
+ },
766
+ "default": "'Sila hubungi helpdesk untuk pengesahan lanjut.'",
767
+ "attribute": "low-confidence-message"
768
+ },
759
769
  {
760
770
  "kind": "field",
761
771
  "name": "messages",
@@ -1192,6 +1202,14 @@
1192
1202
  },
1193
1203
  "default": "'Maaf, terdapat masalah semasa menghubungi pelayan. Sila cuba lagi.'",
1194
1204
  "fieldName": "errorMessage"
1205
+ },
1206
+ {
1207
+ "name": "low-confidence-message",
1208
+ "type": {
1209
+ "text": "string"
1210
+ },
1211
+ "default": "'Sila hubungi helpdesk untuk pengesahan lanjut.'",
1212
+ "fieldName": "lowConfidenceMessage"
1195
1213
  }
1196
1214
  ],
1197
1215
  "superclass": {
package/dist/index.d.mts CHANGED
@@ -88,6 +88,7 @@ declare class AIChat extends LitElement {
88
88
  language: string;
89
89
  showRelatedFaqs: boolean;
90
90
  errorMessage: string;
91
+ lowConfidenceMessage: string;
91
92
  private messages;
92
93
  private input;
93
94
  private isLoading;
@@ -179,6 +180,10 @@ declare class AIChat extends LitElement {
179
180
  type: StringConstructor;
180
181
  attribute: string;
181
182
  };
183
+ lowConfidenceMessage: {
184
+ type: StringConstructor;
185
+ attribute: string;
186
+ };
182
187
  };
183
188
  constructor();
184
189
  private toggleWidget;
package/dist/index.d.ts CHANGED
@@ -88,6 +88,7 @@ declare class AIChat extends LitElement {
88
88
  language: string;
89
89
  showRelatedFaqs: boolean;
90
90
  errorMessage: string;
91
+ lowConfidenceMessage: string;
91
92
  private messages;
92
93
  private input;
93
94
  private isLoading;
@@ -179,6 +180,10 @@ declare class AIChat extends LitElement {
179
180
  type: StringConstructor;
180
181
  attribute: string;
181
182
  };
183
+ lowConfidenceMessage: {
184
+ type: StringConstructor;
185
+ attribute: string;
186
+ };
182
187
  };
183
188
  constructor();
184
189
  private toggleWidget;
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.21-beta.0");
5376
+ console.log("Chatbot Ver = 0.2.21-beta.2");
5377
5377
  var md = new lib_default({
5378
5378
  html: false,
5379
5379
  // Disable HTML tags in source for security
@@ -5407,6 +5407,7 @@ exports.AIChat = class AIChat extends lit.LitElement {
5407
5407
  this.language = "en";
5408
5408
  this.showRelatedFaqs = false;
5409
5409
  this.errorMessage = "Maaf, terdapat masalah semasa menghubungi pelayan. Sila cuba lagi.";
5410
+ this.lowConfidenceMessage = "Sila hubungi helpdesk untuk pengesahan lanjut.";
5410
5411
  this.messages = [];
5411
5412
  this.input = "";
5412
5413
  this.isLoading = false;
@@ -5948,6 +5949,16 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
5948
5949
  </div>
5949
5950
  <div class="message-content">
5950
5951
  <div class="message-text">${unsafeHtml_js.unsafeHTML(this.formatMessageContent(msg.content))}</div>
5952
+ ${msg.role === "assistant" && msg.confidence && !msg.confidence.is_confident ? lit.html`
5953
+ <div class="low-confidence-warning">
5954
+ <svg class="warning-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
5955
+ <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>
5956
+ <line x1="12" y1="9" x2="12" y2="13"></line>
5957
+ <line x1="12" y1="17" x2="12.01" y2="17"></line>
5958
+ </svg>
5959
+ <span>${this.lowConfidenceMessage}</span>
5960
+ </div>
5961
+ ` : ""}
5951
5962
  ${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? lit.html`
5952
5963
  <div class="faq-section">
5953
5964
  <p class="faq-title">Related FAQs:</p>
@@ -6253,7 +6264,6 @@ exports.AIChat.styles = lit.css`
6253
6264
 
6254
6265
  .message-content {
6255
6266
  max-width: 100%;
6256
- padding: 0.625rem 0.875rem;
6257
6267
  font-size: 0.9375rem;
6258
6268
  }
6259
6269
 
@@ -6560,7 +6570,7 @@ exports.AIChat.styles = lit.css`
6560
6570
 
6561
6571
  .message-content {
6562
6572
  max-width: 36rem;
6563
- padding: 0.875rem 1.125rem;
6573
+ padding: 1.125rem;
6564
6574
  border-radius: 1.25rem;
6565
6575
  line-height: 1.6;
6566
6576
  overflow-wrap: break-word;
@@ -6591,13 +6601,24 @@ exports.AIChat.styles = lit.css`
6591
6601
  }
6592
6602
 
6593
6603
  .message-text {
6594
- white-space: pre-wrap;
6595
6604
  margin: 0;
6596
6605
  word-wrap: break-word;
6597
6606
  overflow-wrap: break-word;
6598
6607
  word-break: break-word;
6599
6608
  }
6600
6609
 
6610
+ .message-text p {
6611
+ margin: 0 0 0.75rem 0;
6612
+ }
6613
+
6614
+ .message-text p:last-child {
6615
+ margin-bottom: 0;
6616
+ }
6617
+
6618
+ .message-text p:first-child {
6619
+ margin-top: 0;
6620
+ }
6621
+
6601
6622
  .message-text ul,
6602
6623
  .message-text ol {
6603
6624
  margin: 0.5rem 0;
@@ -6626,6 +6647,63 @@ exports.AIChat.styles = lit.css`
6626
6647
  list-style-type: decimal;
6627
6648
  }
6628
6649
 
6650
+ .message-text h1,
6651
+ .message-text h2,
6652
+ .message-text h3,
6653
+ .message-text h4,
6654
+ .message-text h5,
6655
+ .message-text h6 {
6656
+ margin: 0.75rem 0 0.5rem 0;
6657
+ font-weight: 600;
6658
+ }
6659
+
6660
+ .message-text h1:first-child,
6661
+ .message-text h2:first-child,
6662
+ .message-text h3:first-child,
6663
+ .message-text h4:first-child,
6664
+ .message-text h5:first-child,
6665
+ .message-text h6:first-child {
6666
+ margin-top: 0;
6667
+ }
6668
+
6669
+ .message-text blockquote {
6670
+ margin: 0.5rem 0;
6671
+ padding-left: 1rem;
6672
+ border-left: 3px solid #d1d5db;
6673
+ }
6674
+
6675
+ :host([theme="dark"]) .message-text blockquote {
6676
+ border-left-color: #3f3f46;
6677
+ }
6678
+
6679
+ .message-text code {
6680
+ background: rgba(0, 0, 0, 0.05);
6681
+ padding: 0.125rem 0.25rem;
6682
+ border-radius: 0.25rem;
6683
+ font-size: 0.875em;
6684
+ }
6685
+
6686
+ :host([theme="dark"]) .message-text code {
6687
+ background: rgba(255, 255, 255, 0.1);
6688
+ }
6689
+
6690
+ .message-text pre {
6691
+ margin: 0.5rem 0;
6692
+ padding: 0.75rem;
6693
+ background: rgba(0, 0, 0, 0.05);
6694
+ border-radius: 0.5rem;
6695
+ overflow-x: auto;
6696
+ }
6697
+
6698
+ :host([theme="dark"]) .message-text pre {
6699
+ background: rgba(255, 255, 255, 0.05);
6700
+ }
6701
+
6702
+ .message-text pre code {
6703
+ background: transparent;
6704
+ padding: 0;
6705
+ }
6706
+
6629
6707
  .faq-section {
6630
6708
  margin-top: 0.75rem;
6631
6709
  padding-top: 0.75rem;
@@ -6696,6 +6774,32 @@ exports.AIChat.styles = lit.css`
6696
6774
  color: #9CA3AF;
6697
6775
  } */
6698
6776
 
6777
+ .low-confidence-warning {
6778
+ margin-top: 0.75rem;
6779
+ padding: 0.75rem 1rem;
6780
+ background: #FEF3C7;
6781
+ border-left: 4px solid #F59E0B;
6782
+ border-radius: 0.5rem;
6783
+ font-size: 0.875rem;
6784
+ color: #92400E;
6785
+ display: flex;
6786
+ align-items: flex-start;
6787
+ gap: 0.5rem;
6788
+ }
6789
+
6790
+ :host([theme="dark"]) .low-confidence-warning {
6791
+ background: #451A03;
6792
+ border-left-color: #F59E0B;
6793
+ color: #FDE68A;
6794
+ }
6795
+
6796
+ .warning-icon {
6797
+ width: 1.25rem;
6798
+ height: 1.25rem;
6799
+ flex-shrink: 0;
6800
+ margin-top: 0.125rem;
6801
+ }
6802
+
6699
6803
  .loading {
6700
6804
  display: flex;
6701
6805
  gap: 1rem;
@@ -6837,7 +6941,8 @@ exports.AIChat.properties = {
6837
6941
  initialQuestionsUrl: { type: String, attribute: "initial-questions-url" },
6838
6942
  language: { type: String, attribute: "language" },
6839
6943
  showRelatedFaqs: { type: Boolean, attribute: "show-related-faqs" },
6840
- errorMessage: { type: String, attribute: "error-message" }
6944
+ errorMessage: { type: String, attribute: "error-message" },
6945
+ lowConfidenceMessage: { type: String, attribute: "low-confidence-message" }
6841
6946
  };
6842
6947
  __decorateClass([
6843
6948
  decorators_js.state()