@iblai/web-utils 1.11.6 → 1.11.8

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.js CHANGED
@@ -10442,7 +10442,8 @@ function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redi
10442
10442
  console.log("[determineMentorToRedirectTo] starredMentors ", starredMentors);
10443
10443
  if (starredMentors && starredMentors.length > 0) {
10444
10444
  const starredMentor = starredMentors[0];
10445
- if (starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.unique_id) {
10445
+ // @ts-expect-error - mentor is not part of the starred mentor object
10446
+ if ((starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.unique_id) || (starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.mentor)) {
10446
10447
  return starredMentor;
10447
10448
  }
10448
10449
  }
@@ -14498,6 +14499,7 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14498
14499
  // `addUserMessage`) between the two `getChats` resolutions.
14499
14500
  const startNewChatInFlightRef = React.useRef(false);
14500
14501
  const startNewChat = React.useCallback(async () => {
14502
+ var _a, _b, _c;
14501
14503
  // Reset all chat state
14502
14504
  if (!showingSharedChat) {
14503
14505
  dispatch(chatActions.resetChats(undefined));
@@ -14530,6 +14532,10 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14530
14532
  requestBody,
14531
14533
  }).unwrap();
14532
14534
  dispatch(chatActions.updateSessionIds(response.session_id));
14535
+ // The backend is the source of truth for which tools/artifacts are
14536
+ // enabled by default; seed the UI toggles from the create-session response.
14537
+ dispatch(chatActions.setTools((_b = (_a = response.tools) === null || _a === void 0 ? void 0 : _a.map((t) => t.slug).filter(Boolean)) !== null && _b !== void 0 ? _b : []));
14538
+ dispatch(chatActions.setArtifactsEnabled((_c = response.enable_artifacts) !== null && _c !== void 0 ? _c : false));
14533
14539
  onStartNewChat === null || onStartNewChat === void 0 ? void 0 : onStartNewChat(response.session_id);
14534
14540
  }
14535
14541
  catch (error) {
@@ -14649,7 +14655,7 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14649
14655
  sendMessage,
14650
14656
  ]);
14651
14657
  async function changeTab(tab) {
14652
- var _a, _b, _c, _d;
14658
+ var _a, _b, _c, _d, _e, _f, _g;
14653
14659
  // while responding to a message, do not change the tab
14654
14660
  if (streaming) {
14655
14661
  errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler("Cannot change tab while streaming");
@@ -14678,14 +14684,18 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14678
14684
  requestBody,
14679
14685
  }).unwrap();
14680
14686
  dispatch(chatActions.updateSessionIds(response.session_id));
14687
+ // The backend is the source of truth for which tools/artifacts are
14688
+ // enabled by default; seed the UI toggles from the create-session response.
14689
+ dispatch(chatActions.setTools((_b = (_a = response.tools) === null || _a === void 0 ? void 0 : _a.map((t) => t.slug).filter(Boolean)) !== null && _b !== void 0 ? _b : []));
14690
+ dispatch(chatActions.setArtifactsEnabled((_c = response.enable_artifacts) !== null && _c !== void 0 ? _c : false));
14681
14691
  // if the tab we are going to activate has no session Id (this is the first time we are creating the session for this tag)
14682
14692
  // we need to send a proactive prompt if the advanced tabs properties has no tag.
14683
14693
  // (presence of tag indicates an ACTIONABLE UI)
14684
- if (!((_a = advancedTabsProperties[tab]) === null || _a === void 0 ? void 0 : _a.tag)) {
14685
- for (const prompt of (_c = (_b = advancedTabsProperties[tab]) === null || _b === void 0 ? void 0 : _b.prompts) !== null && _c !== void 0 ? _c : []) {
14694
+ if (!((_d = advancedTabsProperties[tab]) === null || _d === void 0 ? void 0 : _d.tag)) {
14695
+ for (const prompt of (_f = (_e = advancedTabsProperties[tab]) === null || _e === void 0 ? void 0 : _e.prompts) !== null && _f !== void 0 ? _f : []) {
14686
14696
  // @ts-expect-error - Type mismatch
14687
14697
  if (prompt.type === "human" && (prompt === null || prompt === void 0 ? void 0 : prompt.proactive)) {
14688
- sendMessage(tab, (_d = prompt.content) !== null && _d !== void 0 ? _d : "", { visible: false });
14698
+ sendMessage(tab, (_g = prompt.content) !== null && _g !== void 0 ? _g : "", { visible: false });
14689
14699
  }
14690
14700
  }
14691
14701
  }