@a.izzuddin/ai-chat 0.2.19 → 0.2.21-beta.1

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.
@@ -70,6 +70,11 @@
70
70
  "kind": "javascript-module",
71
71
  "path": "dist/index.js",
72
72
  "declarations": [
73
+ {
74
+ "kind": "variable",
75
+ "name": "pos",
76
+ "default": "start"
77
+ },
73
78
  {
74
79
  "kind": "variable",
75
80
  "name": "suggestedQuestions",
@@ -908,7 +913,7 @@
908
913
  }
909
914
  }
910
915
  ],
911
- "description": "Normalize suggested questions - converts string arrays to SuggestedQuestion objects"
916
+ "description": "Normalize suggested questions - handles multiple formats:\r\n- Objects with question_text (legacy format)\r\n- Objects with Id/QuestionType (new API format - question_text will be fetched)\r\n- String arrays (legacy format)"
912
917
  },
913
918
  {
914
919
  "kind": "method",
@@ -923,6 +928,26 @@
923
928
  }
924
929
  ]
925
930
  },
931
+ {
932
+ "kind": "method",
933
+ "name": "fetchQuestionTexts",
934
+ "privacy": "private",
935
+ "return": {
936
+ "type": {
937
+ "text": ""
938
+ }
939
+ },
940
+ "parameters": [
941
+ {
942
+ "name": "questions",
943
+ "type": {
944
+ "text": "Array<{Id: string, QuestionType: string}>"
945
+ },
946
+ "description": "Array of suggested questions with Id and QuestionType"
947
+ }
948
+ ],
949
+ "description": "Fetch question texts for suggested questions from the API"
950
+ },
926
951
  {
927
952
  "kind": "method",
928
953
  "name": "handleFAQClick",
package/dist/index.d.mts CHANGED
@@ -6,7 +6,13 @@ interface FAQ {
6
6
  No: string;
7
7
  Question: string;
8
8
  }
9
+ interface Confidence {
10
+ confidence_score: number;
11
+ is_confident: boolean;
12
+ }
9
13
  interface SuggestedQuestion {
14
+ Id?: string;
15
+ QuestionType?: string;
10
16
  id?: number;
11
17
  question_type?: string;
12
18
  question_text: string;
@@ -18,6 +24,7 @@ interface Message {
18
24
  content: string;
19
25
  faqs?: FAQ[];
20
26
  suggestedQuestions?: SuggestedQuestion[];
27
+ confidence?: Confidence;
21
28
  }
22
29
  /**
23
30
  * AI Chat Web Component
@@ -190,10 +197,19 @@ declare class AIChat extends LitElement {
190
197
  updated(changedProperties: PropertyValues): void;
191
198
  private scrollToBottom;
192
199
  /**
193
- * Normalize suggested questions - converts string arrays to SuggestedQuestion objects
200
+ * Normalize suggested questions - handles multiple formats:
201
+ * - Objects with question_text (legacy format)
202
+ * - Objects with Id/QuestionType (new API format - question_text will be fetched)
203
+ * - String arrays (legacy format)
194
204
  */
195
205
  private normalizeSuggestedQuestions;
196
206
  private handleInput;
207
+ /**
208
+ * Fetch question texts for suggested questions from the API
209
+ * @param questions Array of suggested questions with Id and QuestionType
210
+ * @returns Array of complete SuggestedQuestion objects with question_text
211
+ */
212
+ private fetchQuestionTexts;
197
213
  private handleFAQClick;
198
214
  private handleSuggestedQuestionClick;
199
215
  private handleSubmit;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,13 @@ interface FAQ {
6
6
  No: string;
7
7
  Question: string;
8
8
  }
9
+ interface Confidence {
10
+ confidence_score: number;
11
+ is_confident: boolean;
12
+ }
9
13
  interface SuggestedQuestion {
14
+ Id?: string;
15
+ QuestionType?: string;
10
16
  id?: number;
11
17
  question_type?: string;
12
18
  question_text: string;
@@ -18,6 +24,7 @@ interface Message {
18
24
  content: string;
19
25
  faqs?: FAQ[];
20
26
  suggestedQuestions?: SuggestedQuestion[];
27
+ confidence?: Confidence;
21
28
  }
22
29
  /**
23
30
  * AI Chat Web Component
@@ -190,10 +197,19 @@ declare class AIChat extends LitElement {
190
197
  updated(changedProperties: PropertyValues): void;
191
198
  private scrollToBottom;
192
199
  /**
193
- * Normalize suggested questions - converts string arrays to SuggestedQuestion objects
200
+ * Normalize suggested questions - handles multiple formats:
201
+ * - Objects with question_text (legacy format)
202
+ * - Objects with Id/QuestionType (new API format - question_text will be fetched)
203
+ * - String arrays (legacy format)
194
204
  */
195
205
  private normalizeSuggestedQuestions;
196
206
  private handleInput;
207
+ /**
208
+ * Fetch question texts for suggested questions from the API
209
+ * @param questions Array of suggested questions with Id and QuestionType
210
+ * @returns Array of complete SuggestedQuestion objects with question_text
211
+ */
212
+ private fetchQuestionTexts;
197
213
  private handleFAQClick;
198
214
  private handleSuggestedQuestionClick;
199
215
  private handleSubmit;