@chrryai/chrry 1.6.83 → 1.6.85

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
@@ -3152,7 +3152,7 @@ var init_utils = __esm({
3152
3152
  };
3153
3153
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
3154
3154
  config = getSiteConfig(getClientHostname());
3155
- VERSION = config.version || "1.6.83";
3155
+ VERSION = config.version || "1.6.85";
3156
3156
  getSlugFromPathname = (path) => {
3157
3157
  return getAppAndStoreSlugs(path, {
3158
3158
  defaultAppSlug: config.slug,
@@ -23953,6 +23953,7 @@ function AuthProvider({
23953
23953
  }
23954
23954
  });
23955
23955
  const threadId = getThreadId(pathname);
23956
+ console.log(`\u{1F680} ~ threadId:`, threadId);
23956
23957
  const threadIdRef = (0, import_react20.useRef)(threadId);
23957
23958
  const [app, setAppInternal] = (0, import_react20.useState)(props.app || session2?.app || baseApp);
23958
23959
  (0, import_react20.useEffect)(() => {
@@ -24731,7 +24732,7 @@ function DataProvider({ children, ...rest }) {
24731
24732
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24732
24733
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24733
24734
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24734
- const VERSION4 = "1.6.83";
24735
+ const VERSION4 = "1.6.85";
24735
24736
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24736
24737
  const {
24737
24738
  API_URL: API_URL2,
@@ -26495,6 +26496,7 @@ function ChatProvider({
26495
26496
  claudeAgent,
26496
26497
  favouriteAgent,
26497
26498
  threadIdRef,
26499
+ threadId,
26498
26500
  migratedFromGuestRef,
26499
26501
  fetchSession,
26500
26502
  loadingApp,
@@ -26506,11 +26508,11 @@ function ChatProvider({
26506
26508
  setHasNotification,
26507
26509
  ...auth
26508
26510
  } = useAuth();
26509
- const threadId = threadIdRef.current;
26510
26511
  const [isChatFloating, setIsChatFloating] = (0, import_react29.useState)(false);
26511
26512
  const [input, setInput] = (0, import_react29.useState)("");
26512
26513
  const [messages, setMessages] = (0, import_react29.useState)(auth.threadData?.messages.messages || []);
26513
26514
  const isEmpty = !messages?.length;
26515
+ console.log(`\u{1F680} ~ isEmpty:`, isEmpty);
26514
26516
  const { isExtension: isExtension2, isMobile } = usePlatform();
26515
26517
  const [shouldFetchThreads, setShouldFetchThreads] = (0, import_react29.useState)(!threads);
26516
26518
  let userNameByUrl = void 0;
@@ -26921,16 +26923,25 @@ function ChatProvider({
26921
26923
  setIsLoading(!!threadId);
26922
26924
  }, [threadId]);
26923
26925
  const [status, setStatus] = (0, import_react29.useState)(null);
26926
+ const toFetch = threadId || threadIdRef.current;
26927
+ console.log(`\u{1F680} ~ threadId, liked, until:`, {
26928
+ shouldFetchThread,
26929
+ threadId,
26930
+ liked,
26931
+ toFetch,
26932
+ until
26933
+ });
26924
26934
  const {
26925
26935
  data: threadSWR,
26926
26936
  mutate,
26927
26937
  error
26928
26938
  } = (0, import_swr3.default)(
26929
- shouldFetchThread && token && threadId ? [threadId, liked, until] : null,
26939
+ shouldFetchThread && token && toFetch ? [toFetch, liked, until] : null,
26930
26940
  async () => {
26931
- if (!threadId) return;
26941
+ console.log(`\u{1F680} ~ toFetch:`, toFetch);
26942
+ if (!toFetch) return;
26932
26943
  const threadData2 = await actions.getThread({
26933
- id: threadId,
26944
+ id: toFetch,
26934
26945
  pageSize: until * pageSizes.threads,
26935
26946
  liked: !!liked,
26936
26947
  onError: (error2) => {
@@ -26938,6 +26949,7 @@ function ChatProvider({
26938
26949
  setStatus(error2);
26939
26950
  }
26940
26951
  });
26952
+ console.log(`\u{1F680} ~ threadData:`, threadData2);
26941
26953
  setIsLoading(false);
26942
26954
  return threadData2;
26943
26955
  },
@@ -27078,7 +27090,7 @@ function ChatProvider({
27078
27090
  isLoading && error && setIsLoading(false);
27079
27091
  }, [error, isLoading]);
27080
27092
  (0, import_react29.useEffect)(() => {
27081
- if (!threadId) {
27093
+ if (!toFetch) {
27082
27094
  status && setStatus(null);
27083
27095
  return;
27084
27096
  }
@@ -27135,7 +27147,7 @@ function ChatProvider({
27135
27147
  setShouldFetchThread,
27136
27148
  refetchThread: async () => {
27137
27149
  setShouldFetchThread(true);
27138
- shouldFetchThread && await mutate();
27150
+ await mutate();
27139
27151
  },
27140
27152
  setIsWebSearchEnabled,
27141
27153
  input,
@@ -37411,8 +37423,10 @@ function Chat({
37411
37423
  mood,
37412
37424
  updateMood,
37413
37425
  taskId,
37414
- fetchTasks
37426
+ fetchTasks,
37427
+ ...auth
37415
37428
  } = useAuth();
37429
+ const threadId = auth.threadId || auth.threadIdRef.current;
37416
37430
  const [isSelectingMood, setIsSelectingMood] = (0, import_react55.useState)(false);
37417
37431
  const isChrry = chrry?.id === app?.id;
37418
37432
  const {
@@ -37433,7 +37447,6 @@ function Chat({
37433
37447
  hitHourlyLimit,
37434
37448
  hourlyLimit,
37435
37449
  isEmpty: empty,
37436
- threadId,
37437
37450
  isAgentModalOpen,
37438
37451
  setIsAgentModalOpen,
37439
37452
  isDebateAgentModalOpen,
@@ -50518,7 +50531,16 @@ var init_Thread = __esm({
50518
50531
  }) => {
50519
50532
  const styles4 = useThreadStyles();
50520
50533
  const { t: t5 } = useAppContext();
50521
- const { user, guest, track, memoriesEnabled, setShowFocus, ...auth } = useAuth();
50534
+ const {
50535
+ user,
50536
+ guest,
50537
+ track,
50538
+ threadIdRef,
50539
+ memoriesEnabled,
50540
+ setShowFocus,
50541
+ ...auth
50542
+ } = useAuth();
50543
+ const threadId = auth.threadId || threadIdRef.current;
50522
50544
  const {
50523
50545
  isWebSearchEnabled,
50524
50546
  selectedAgent,
@@ -50564,7 +50586,7 @@ var init_Thread = __esm({
50564
50586
  isIncognito,
50565
50587
  goToCalendar
50566
50588
  } = useNavigationContext();
50567
- const { threadId, setShouldGetCredits } = useChat();
50589
+ const { setShouldGetCredits } = useChat();
50568
50590
  const setMessages = setMessagesInternal;
50569
50591
  const { appStatus, appFormWatcher, suggestSaveApp } = useApp();
50570
50592
  const { addHapticFeedback, isMobileDevice, isSmallDevice } = useTheme2();
@@ -51121,10 +51143,10 @@ function Home({
51121
51143
  className,
51122
51144
  slug
51123
51145
  }) {
51124
- const { language, threadId } = useAuth();
51146
+ const { language, threadId, threadIdRef } = useAuth();
51125
51147
  const { currentStore: store, app } = useApp();
51126
51148
  useAppMetadata2();
51127
- return /* @__PURE__ */ React.createElement(Div, { "data-url": language === defaultLocale ? "/" : `/${language}` }, /* @__PURE__ */ React.createElement(Thread_default, { isHome: true }));
51149
+ return /* @__PURE__ */ React.createElement(Div, { "data-url": language === defaultLocale ? "/" : `/${language}` }, /* @__PURE__ */ React.createElement(Thread_default, { isHome: !threadId && !threadIdRef.current }));
51128
51150
  }
51129
51151
  var init_Home = __esm({
51130
51152
  "Home.tsx"() {