mario-education 2.4.517-feedback → 2.4.519-feedback

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.
@@ -31,6 +31,7 @@ export interface IChat {
31
31
  text?: string;
32
32
  time: string;
33
33
  isUser: boolean;
34
+ isSystem?: boolean;
34
35
  options?: string[];
35
36
  }
36
37
  export interface IPrompt {
package/dist/index.js CHANGED
@@ -6163,57 +6163,34 @@ var useCSVImport = function useCSVImport() {
6163
6163
 
6164
6164
  var formData = new FormData();
6165
6165
  formData.append("file", file, file.name);
6166
- console.log("run");
6167
- console.log("📌 Type run:", type.toString());
6168
6166
 
6169
6167
  var _temp8 = function () {
6170
6168
  if (type == CSVType.AllUser) {
6171
- console.log("📌 Type 1:", type.toString());
6172
- return Promise.resolve(new Promise(function (resolve, reject) {
6173
- var reader = new FileReader();
6174
-
6175
- reader.onload = function () {
6176
- return resolve(reader.result);
6177
- };
6178
-
6179
- reader.onerror = reject;
6180
- reader.readAsText(file);
6181
- })).then(function (fileTextRaw) {
6182
- console.log("📌 fileTextRaw:", fileTextRaw);
6169
+ return Promise.resolve(file.text()).then(function (fileTextRaw) {
6183
6170
  var fileText = fileTextRaw.trim();
6184
- var headerIndex = 0;
6185
6171
  var rows = fileText.split("\n").map(function (row) {
6186
6172
  return row.trim();
6187
6173
  });
6188
- console.log("📌 rows:", rows);
6189
-
6190
- for (var _i = 0; _i < rows.length; _i++) {
6191
- var cols = rows[_i].split(",");
6192
-
6193
- if (cols.includes("FirstName")) {
6194
- headerIndex = _i;
6195
- return;
6196
- }
6197
- }
6174
+ var headerIndex = rows.findIndex(function (row) {
6175
+ return row.split(",").includes("FirstName");
6176
+ });
6198
6177
 
6199
6178
  if (headerIndex === 0) {
6200
6179
  throw new Error("Invalid CSV: Missing header row.");
6201
6180
  }
6202
6181
 
6203
6182
  fileText = rows.slice(headerIndex).join("\n");
6204
- console.log("📌 fileText:", fileText);
6205
6183
  var parsedData = Papa.parse(fileText, {
6206
6184
  header: true,
6207
6185
  skipEmptyLines: true
6208
6186
  });
6209
6187
  var header = parsedData.meta.fields;
6210
6188
  var dataRows = parsedData.data;
6211
- console.log("📌 dataRows:", dataRows);
6212
6189
  var chunkSize = 20;
6213
6190
  var chunks = [];
6214
6191
 
6215
- for (var _i2 = 0; _i2 < dataRows.length; _i2 += chunkSize) {
6216
- var chunkData = dataRows.slice(_i2, _i2 + chunkSize);
6192
+ for (var _i = 0; _i < dataRows.length; _i += chunkSize) {
6193
+ var chunkData = dataRows.slice(_i, _i + chunkSize);
6217
6194
  var csvChunk = Papa.unparse({
6218
6195
  fields: header,
6219
6196
  data: chunkData
@@ -6235,8 +6212,6 @@ var useCSVImport = function useCSVImport() {
6235
6212
  } else {
6236
6213
  var _temp14 = function () {
6237
6214
  if (isCheckDomainIBS) {
6238
- console.log("📌 Type if:", type.toString());
6239
-
6240
6215
  var _temp15 = function () {
6241
6216
  if (type == CSVType.ClassReflection) {
6242
6217
  return Promise.resolve(importClassReflectionCSV(formData)).then(function () {});
@@ -6245,7 +6220,6 @@ var useCSVImport = function useCSVImport() {
6245
6220
 
6246
6221
  if (_temp15 && _temp15.then) return _temp15.then(function () {});
6247
6222
  } else {
6248
- console.log("📌 Type else:", type.toString());
6249
6223
  return Promise.resolve(importCSV(formData, type.toString())).then(function () {});
6250
6224
  }
6251
6225
  }();
@@ -78714,6 +78688,7 @@ var useAIChat = function useAIChat() {
78714
78688
  text: r.message.replace(/\$\{\{/g, ""),
78715
78689
  time: "",
78716
78690
  isUser: ((_r$role = r.role) === null || _r$role === void 0 ? void 0 : _r$role.toString()) == "User",
78691
+ isSystem: false,
78717
78692
  options: (_r$message = r.message) === null || _r$message === void 0 ? void 0 : (_r$message$match = _r$message.match(regex)) === null || _r$message$match === void 0 ? void 0 : (_r$message$match$ = _r$message$match[1]) === null || _r$message$match$ === void 0 ? void 0 : (_r$message$match$$spl = _r$message$match$.split(" || ")) === null || _r$message$match$$spl === void 0 ? void 0 : (_r$message$match$$spl2 = _r$message$match$$spl[1]) === null || _r$message$match$$spl2 === void 0 ? void 0 : _r$message$match$$spl2.split("/")
78718
78693
  };
78719
78694
  })) || []);
@@ -78737,11 +78712,13 @@ var useAIChat = function useAIChat() {
78737
78712
  var responses = chats.concat([{
78738
78713
  isUser: true,
78739
78714
  message: option,
78740
- time: ""
78715
+ time: "",
78716
+ isSystem: false
78741
78717
  }, {
78742
78718
  time: "",
78743
78719
  isUser: false,
78744
- message: ""
78720
+ message: "",
78721
+ isSystem: false
78745
78722
  }]);
78746
78723
  setChats(responses);
78747
78724
  var startDate;
@@ -78952,21 +78929,31 @@ var useAIChat = function useAIChat() {
78952
78929
  isUser: false,
78953
78930
  message: messageText,
78954
78931
  time: "",
78955
- text: ""
78932
+ text: "",
78933
+ isSystem: false
78956
78934
  }], match ? [{
78957
78935
  isUser: false,
78958
78936
  message: match[1],
78959
78937
  time: "",
78960
78938
  text: "",
78961
- options: (_match$1$split$ = match[1].split(" || ")[1]) === null || _match$1$split$ === void 0 ? void 0 : _match$1$split$.split("/")
78939
+ options: (_match$1$split$ = match[1].split(" || ")[1]) === null || _match$1$split$ === void 0 ? void 0 : _match$1$split$.split("/"),
78940
+ isSystem: false
78962
78941
  }] : []).filter(function (r) {
78963
78942
  return r.message;
78964
78943
  });
78965
78944
  aiChats = updatedChats;
78966
78945
  return updatedChats;
78967
78946
  });
78947
+ var formattedSystemMessages = systemMessages.map(function (msg) {
78948
+ return {
78949
+ message: msg.text,
78950
+ time: "",
78951
+ isUser: false,
78952
+ isSystem: true
78953
+ };
78954
+ });
78968
78955
  saveHistoryPrompt(_extends({}, prompt, {
78969
- messages: aiChats,
78956
+ messages: aiChats.concat(formattedSystemMessages),
78970
78957
  output: "",
78971
78958
  promptId: prompt.id,
78972
78959
  grade: "",