@alan-ai/alan-sdk-web 1.8.85 → 1.8.86

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/alan_lib.js CHANGED
@@ -94594,10 +94594,13 @@ code.hljs {
94594
94594
  return copyBtn;
94595
94595
  return msg.type === "response" && isFinalMessage(msg) ? copyBtn : "";
94596
94596
  }
94597
- function changeMsgLikeStatus(msg) {
94597
+ function changeMsgLikeStatus(msg, options) {
94598
94598
  const reqId = msg.ctx?.reqId || msg.reqId;
94599
94599
  if (reqId) {
94600
94600
  window.tutorProject.call("sendFeedback", { reqId, status: msg.liked });
94601
+ if (options.onEvent) {
94602
+ options.onEvent({ name: "feedbackSent", status: msg.liked, reqId });
94603
+ }
94601
94604
  }
94602
94605
  }
94603
94606
  function resetStylesForLikeAndDislikeBtns(curMsgBubble, msg) {
@@ -95043,7 +95046,7 @@ code.hljs {
95043
95046
  // alan_btn/alan_btn.ts
95044
95047
  var import_sjcl = __toESM(require_sjcl());
95045
95048
  (function(ns) {
95046
- uiState.lib.version = "alan-version.1.8.85".replace("alan-version.", "");
95049
+ uiState.lib.version = "alan-version.1.8.86".replace("alan-version.", "");
95047
95050
  if (window.alanBtn) {
95048
95051
  console.warn("Alan: the Alan Button source code has already added (v." + uiState.lib.version + ")");
95049
95052
  }
@@ -96761,28 +96764,30 @@ code.hljs {
96761
96764
  } else {
96762
96765
  switchState(getDefaultBtnState());
96763
96766
  }
96764
- const { dialogId } = window.tutorProject.getSettings();
96765
- console.info(`Alan: connected to ${dialogId !== getSavedDialogId() ? "new" : ""} dialog:
96767
+ if (!isTutorMode()) {
96768
+ const { dialogId } = window.tutorProject.getSettings();
96769
+ console.info(`Alan: connected to ${dialogId !== getSavedDialogId() ? "new" : ""} dialog:
96766
96770
  ${dialogId}
96767
96771
  ${getSavedDialogId() || "-"} (prev. dialog)`);
96768
- curDialogId = dialogId;
96769
- sentMessages = restoreSentMessages();
96770
- const prevUserId = getPrevUserId();
96771
- if (getSavedDialogId() !== dialogId) {
96772
- saveDialogId(dialogId);
96773
- restoreMessagesInChat(true);
96774
- onNewDialogAutoReconnect();
96775
- } else {
96776
- if (!(0, import_lodash2.isEmpty)(prevUserId) && (0, import_lodash2.isEmpty)(uiState.userInfo.userId)) {
96777
- savePrevUserId(uiState.userInfo.userId);
96778
- connectToNewDialog();
96779
- return;
96772
+ curDialogId = dialogId;
96773
+ sentMessages = restoreSentMessages();
96774
+ const prevUserId = getPrevUserId();
96775
+ if (getSavedDialogId() !== dialogId) {
96776
+ saveDialogId(dialogId);
96777
+ restoreMessagesInChat(true);
96778
+ onNewDialogAutoReconnect();
96779
+ } else {
96780
+ if (!(0, import_lodash2.isEmpty)(prevUserId) && (0, import_lodash2.isEmpty)(uiState.userInfo.userId)) {
96781
+ savePrevUserId(uiState.userInfo.userId);
96782
+ connectToNewDialog();
96783
+ return;
96784
+ }
96785
+ saveDialogId(dialogId);
96786
+ restoreMessagesInChat(true);
96780
96787
  }
96781
- saveDialogId(dialogId);
96782
- restoreMessagesInChat(true);
96783
- }
96784
- console.info(`Alan: curDialogId:
96788
+ console.info(`Alan: curDialogId:
96785
96789
  ${curDialogId}`);
96790
+ }
96786
96791
  if (!isTutorMode()) {
96787
96792
  sendSyncPageState();
96788
96793
  }
@@ -97329,7 +97334,7 @@ ${curDialogId}`);
97329
97334
  if (dislikeBtnEl) {
97330
97335
  msg.liked = msg.liked !== -1 ? -1 : 0;
97331
97336
  }
97332
- changeMsgLikeStatus(msg);
97337
+ changeMsgLikeStatus(msg, options);
97333
97338
  resetStylesForLikeAndDislikeBtns(curMsgBubble, msg);
97334
97339
  saveMessageHistory();
97335
97340
  }