@chrryai/chrry 1.6.31 → 1.6.44
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +118 -131
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -131
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1574,7 +1574,7 @@ declare const getApps: ({ API_URL, token, chrryUrl, appId, }: {
|
|
|
1574
1574
|
declare const getApp: ({ API_URL, token, appId, chrryUrl, }: {
|
|
1575
1575
|
API_URL?: string;
|
|
1576
1576
|
token: string;
|
|
1577
|
-
appId
|
|
1577
|
+
appId?: string;
|
|
1578
1578
|
chrryUrl?: string;
|
|
1579
1579
|
}) => Promise<appWithStore>;
|
|
1580
1580
|
declare const getTranslations: ({ API_URL, token, locale, }?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1574,7 +1574,7 @@ declare const getApps: ({ API_URL, token, chrryUrl, appId, }: {
|
|
|
1574
1574
|
declare const getApp: ({ API_URL, token, appId, chrryUrl, }: {
|
|
1575
1575
|
API_URL?: string;
|
|
1576
1576
|
token: string;
|
|
1577
|
-
appId
|
|
1577
|
+
appId?: string;
|
|
1578
1578
|
chrryUrl?: string;
|
|
1579
1579
|
}) => Promise<appWithStore>;
|
|
1580
1580
|
declare const getTranslations: ({ API_URL, token, locale, }?: {
|
package/dist/index.js
CHANGED
|
@@ -502,9 +502,6 @@ function detectSiteModeDomain(hostname2, mode) {
|
|
|
502
502
|
if (!host) {
|
|
503
503
|
return defaultMode;
|
|
504
504
|
}
|
|
505
|
-
const matchesDomain = (host2, domain) => {
|
|
506
|
-
return host2 === domain || host2.endsWith(`.${domain}`);
|
|
507
|
-
};
|
|
508
505
|
console.log(`\u{1F50D} Detecting mode for host: "${host}"`);
|
|
509
506
|
if (matchesDomain(host, "books.chrry.ai")) {
|
|
510
507
|
return "zarathustra";
|
|
@@ -576,7 +573,7 @@ function getSiteConfig(hostnameOrMode) {
|
|
|
576
573
|
hostname2 = hostnameOrMode;
|
|
577
574
|
}
|
|
578
575
|
}
|
|
579
|
-
if (hostname2
|
|
576
|
+
if (hostname2 && matchesDomain(hostname2, "e2e.chrry.ai")) {
|
|
580
577
|
return e2eVex;
|
|
581
578
|
}
|
|
582
579
|
const mode = detectSiteMode(hostname2);
|
|
@@ -612,7 +609,7 @@ function getSiteConfig(hostnameOrMode) {
|
|
|
612
609
|
}
|
|
613
610
|
return vex;
|
|
614
611
|
}
|
|
615
|
-
var import_meta, chrryDev, chrryAI, focus, atlas, istanbul, amsterdam, tokyo, newYork, popcorn, zarathustra, vex, e2eVex, whiteLabels;
|
|
612
|
+
var import_meta, chrryDev, chrryAI, focus, atlas, istanbul, amsterdam, tokyo, newYork, popcorn, zarathustra, vex, e2eVex, matchesDomain, whiteLabels;
|
|
616
613
|
var init_siteConfig = __esm({
|
|
617
614
|
"utils/siteConfig.ts"() {
|
|
618
615
|
"use strict";
|
|
@@ -782,7 +779,7 @@ var init_siteConfig = __esm({
|
|
|
782
779
|
isStoreApp: false,
|
|
783
780
|
mode: "focus",
|
|
784
781
|
slug: "focus",
|
|
785
|
-
version: "26.10.
|
|
782
|
+
version: "26.10.59",
|
|
786
783
|
storeSlug: "blossom",
|
|
787
784
|
name: "Focus",
|
|
788
785
|
domain: "focus.chrry.ai",
|
|
@@ -1325,6 +1322,9 @@ var init_siteConfig = __esm({
|
|
|
1325
1322
|
domain: "e2e.chrry.ai"
|
|
1326
1323
|
// store: "https://e2e.chrry.ai",
|
|
1327
1324
|
};
|
|
1325
|
+
matchesDomain = (host, domain) => {
|
|
1326
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
1327
|
+
};
|
|
1328
1328
|
whiteLabels = [
|
|
1329
1329
|
chrryDev,
|
|
1330
1330
|
chrryAI,
|
|
@@ -1393,9 +1393,6 @@ function getAppAndStoreSlugs(path, {
|
|
|
1393
1393
|
storeSlug: (storeSlug && !reservedRoutes.has(storeSlug) ? storeSlug : void 0) || defaultStoreSlug
|
|
1394
1394
|
};
|
|
1395
1395
|
}
|
|
1396
|
-
function getThreadId2(pathname) {
|
|
1397
|
-
return getThreadId(pathname);
|
|
1398
|
-
}
|
|
1399
1396
|
var baseProtectedRoutes, protectedRoutes, excludedSlugRoutes;
|
|
1400
1397
|
var init_url = __esm({
|
|
1401
1398
|
"utils/url.ts"() {
|
|
@@ -2306,14 +2303,20 @@ var init_lib = __esm({
|
|
|
2306
2303
|
chrryUrl
|
|
2307
2304
|
}) => {
|
|
2308
2305
|
const params = new URLSearchParams();
|
|
2309
|
-
chrryUrl
|
|
2310
|
-
|
|
2306
|
+
if (chrryUrl) params.append("chrryUrl", chrryUrl);
|
|
2307
|
+
if (appId) params.append("appId", appId);
|
|
2308
|
+
const url = `${API_URL2}/apps${params.toString() ? `?${params.toString()}` : ""}`;
|
|
2309
|
+
const response = await fetch(url, {
|
|
2311
2310
|
headers: {
|
|
2312
2311
|
Authorization: `Bearer ${token}`,
|
|
2313
|
-
"x-app-id": appId,
|
|
2314
2312
|
...chrryUrl ? { "x-chrry-url": chrryUrl } : {}
|
|
2315
2313
|
}
|
|
2316
2314
|
});
|
|
2315
|
+
if (!response.ok) {
|
|
2316
|
+
throw new Error(
|
|
2317
|
+
`Failed to fetch app: ${response.status} ${response.statusText}`
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2317
2320
|
const data = await response.json();
|
|
2318
2321
|
return data;
|
|
2319
2322
|
};
|
|
@@ -3108,7 +3111,7 @@ var init_utils = __esm({
|
|
|
3108
3111
|
};
|
|
3109
3112
|
isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
|
|
3110
3113
|
config = getSiteConfig(getClientHostname());
|
|
3111
|
-
VERSION = config.version || "1.6.
|
|
3114
|
+
VERSION = config.version || "1.6.44";
|
|
3112
3115
|
getSlugFromPathname = (path) => {
|
|
3113
3116
|
return getAppAndStoreSlugs(path, {
|
|
3114
3117
|
defaultAppSlug: config.slug,
|
|
@@ -6124,9 +6127,13 @@ function useNavigation() {
|
|
|
6124
6127
|
newSearchParams.set(key, String(value));
|
|
6125
6128
|
});
|
|
6126
6129
|
const newUrl = `${pathname}?${newSearchParams.toString()}`;
|
|
6127
|
-
nextRouter
|
|
6130
|
+
if (nextRouter) {
|
|
6131
|
+
nextRouter.push(newUrl);
|
|
6132
|
+
} else {
|
|
6133
|
+
clientRouter2.push(newUrl);
|
|
6134
|
+
}
|
|
6128
6135
|
},
|
|
6129
|
-
[nextRouter, pathname, searchParams]
|
|
6136
|
+
[nextRouter, clientRouter2, pathname, searchParams]
|
|
6130
6137
|
);
|
|
6131
6138
|
const removeParams = (0, import_react17.useCallback)(
|
|
6132
6139
|
(keys) => {
|
|
@@ -6134,9 +6141,13 @@ function useNavigation() {
|
|
|
6134
6141
|
const keysArray = Array.isArray(keys) ? keys : [keys];
|
|
6135
6142
|
keysArray.forEach((key) => newSearchParams.delete(key));
|
|
6136
6143
|
const newUrl = `${pathname}?${newSearchParams.toString()}`;
|
|
6137
|
-
nextRouter
|
|
6144
|
+
if (nextRouter) {
|
|
6145
|
+
nextRouter.push(newUrl);
|
|
6146
|
+
} else {
|
|
6147
|
+
clientRouter2.push(newUrl);
|
|
6148
|
+
}
|
|
6138
6149
|
},
|
|
6139
|
-
[nextRouter, pathname, searchParams]
|
|
6150
|
+
[nextRouter, clientRouter2, pathname, searchParams]
|
|
6140
6151
|
);
|
|
6141
6152
|
const setParams = (0, import_react17.useCallback)(
|
|
6142
6153
|
(params) => {
|
|
@@ -6145,9 +6156,13 @@ function useNavigation() {
|
|
|
6145
6156
|
newSearchParams.set(key, String(value));
|
|
6146
6157
|
});
|
|
6147
6158
|
const newUrl = `${pathname}?${newSearchParams.toString()}`;
|
|
6148
|
-
nextRouter
|
|
6159
|
+
if (nextRouter) {
|
|
6160
|
+
nextRouter.push(newUrl);
|
|
6161
|
+
} else {
|
|
6162
|
+
clientRouter2.push(newUrl);
|
|
6163
|
+
}
|
|
6149
6164
|
},
|
|
6150
|
-
[nextRouter, pathname]
|
|
6165
|
+
[nextRouter, clientRouter2, pathname]
|
|
6151
6166
|
);
|
|
6152
6167
|
return (0, import_react17.useMemo)(
|
|
6153
6168
|
() => ({
|
|
@@ -23584,7 +23599,7 @@ function AuthProvider({
|
|
|
23584
23599
|
};
|
|
23585
23600
|
const [threads, setThreads] = (0, import_react20.useState)(props.threads);
|
|
23586
23601
|
const isCI2 = process.env.NEXT_PUBLIC_CI === "true";
|
|
23587
|
-
const siteConfig = getSiteConfig();
|
|
23602
|
+
const siteConfig = getSiteConfig(CHRRY_URL);
|
|
23588
23603
|
const chrryUrl = CHRRY_URL;
|
|
23589
23604
|
const [deviceId, setDeviceId] = useCookieOrLocalStorage(
|
|
23590
23605
|
"deviceId",
|
|
@@ -23748,7 +23763,7 @@ function AuthProvider({
|
|
|
23748
23763
|
}
|
|
23749
23764
|
const sessionResult = result;
|
|
23750
23765
|
console.log("\u{1F4E6} Session API Response - Apps:", {
|
|
23751
|
-
app: sessionResult.app
|
|
23766
|
+
app: sessionResult.app?.name,
|
|
23752
23767
|
totalApps: sessionResult.app?.store?.apps?.length || 0,
|
|
23753
23768
|
apps: sessionResult.app?.store?.apps?.map((a) => ({
|
|
23754
23769
|
slug: a.slug,
|
|
@@ -23852,7 +23867,15 @@ function AuthProvider({
|
|
|
23852
23867
|
}
|
|
23853
23868
|
});
|
|
23854
23869
|
const [threadId, setThreadId] = (0, import_react20.useState)(getThreadId(pathname));
|
|
23855
|
-
|
|
23870
|
+
(0, import_react20.useEffect)(() => {
|
|
23871
|
+
const id = getThreadId(pathname);
|
|
23872
|
+
if (id) {
|
|
23873
|
+
setThreadId(id);
|
|
23874
|
+
} else {
|
|
23875
|
+
setThreadId(void 0);
|
|
23876
|
+
}
|
|
23877
|
+
}, [pathname]);
|
|
23878
|
+
const [app, setAppInternal] = (0, import_react20.useState)(props.app || session2?.app || baseApp);
|
|
23856
23879
|
(0, import_react20.useEffect)(() => {
|
|
23857
23880
|
const signInParam = searchParams.get("signIn");
|
|
23858
23881
|
const currentPart = signInParam;
|
|
@@ -23867,7 +23890,7 @@ function AuthProvider({
|
|
|
23867
23890
|
props: props2 = {}
|
|
23868
23891
|
}) => {
|
|
23869
23892
|
if (!user && !guest) return;
|
|
23870
|
-
if (user?.role === "admin") return;
|
|
23893
|
+
if (!isE2E && user?.role === "admin") return;
|
|
23871
23894
|
trackEvent({
|
|
23872
23895
|
name,
|
|
23873
23896
|
url,
|
|
@@ -24617,7 +24640,7 @@ function DataProvider({ children, ...rest }) {
|
|
|
24617
24640
|
const [instructions, setInstructions] = (0, import_react21.useState)([]);
|
|
24618
24641
|
const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
|
|
24619
24642
|
const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
|
|
24620
|
-
const VERSION4 = "1.6.
|
|
24643
|
+
const VERSION4 = "1.6.44";
|
|
24621
24644
|
const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
|
|
24622
24645
|
const {
|
|
24623
24646
|
API_URL: API_URL2,
|
|
@@ -26041,11 +26064,19 @@ var init_useWebSocket = __esm({
|
|
|
26041
26064
|
return;
|
|
26042
26065
|
}
|
|
26043
26066
|
this.isConnecting = true;
|
|
26067
|
+
const connectionTimeout = setTimeout(() => {
|
|
26068
|
+
if (this.isConnecting) {
|
|
26069
|
+
console.log("\u23F0 Connection timeout, resetting isConnecting flag");
|
|
26070
|
+
this.isConnecting = false;
|
|
26071
|
+
this.ws?.close();
|
|
26072
|
+
}
|
|
26073
|
+
}, 1e4);
|
|
26044
26074
|
if (this.ws && this.currentUrl !== targetUrl) {
|
|
26045
26075
|
console.log("\u{1F680} Closing existing WebSocket for reconnection");
|
|
26046
26076
|
await this.close();
|
|
26047
26077
|
}
|
|
26048
26078
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
26079
|
+
clearTimeout(connectionTimeout);
|
|
26049
26080
|
this.isConnecting = false;
|
|
26050
26081
|
return;
|
|
26051
26082
|
}
|
|
@@ -26055,6 +26086,7 @@ var init_useWebSocket = __esm({
|
|
|
26055
26086
|
this.ws = new WebSocket(targetUrl);
|
|
26056
26087
|
this.ws.onopen = () => {
|
|
26057
26088
|
console.log("\u2705 WebSocket opened successfully");
|
|
26089
|
+
clearTimeout(connectionTimeout);
|
|
26058
26090
|
this.isConnecting = false;
|
|
26059
26091
|
this.connectionState = "connected";
|
|
26060
26092
|
this.reconnectAttempts = 0;
|
|
@@ -26082,6 +26114,7 @@ var init_useWebSocket = __esm({
|
|
|
26082
26114
|
};
|
|
26083
26115
|
this.ws.onclose = (event) => {
|
|
26084
26116
|
console.log("\u{1F50C} WebSocket closed", event.code, event.reason);
|
|
26117
|
+
clearTimeout(connectionTimeout);
|
|
26085
26118
|
this.ws = null;
|
|
26086
26119
|
this.isConnecting = false;
|
|
26087
26120
|
this.connectionState = "disconnected";
|
|
@@ -26100,18 +26133,30 @@ var init_useWebSocket = __esm({
|
|
|
26100
26133
|
this.ws.onerror = this.handleError.bind(this);
|
|
26101
26134
|
} catch (error) {
|
|
26102
26135
|
console.error("Failed to create WebSocket:", error);
|
|
26136
|
+
clearTimeout(connectionTimeout);
|
|
26103
26137
|
this.isConnecting = false;
|
|
26104
26138
|
this.connectionState = "disconnected";
|
|
26105
26139
|
this.reconnect();
|
|
26106
26140
|
}
|
|
26107
26141
|
}
|
|
26108
26142
|
reconnect() {
|
|
26143
|
+
this.isConnecting = false;
|
|
26109
26144
|
this.handleReconnecting();
|
|
26110
26145
|
if (this.reconnectAttempts < this.maxReconnectAttempts) {
|
|
26111
|
-
|
|
26146
|
+
this.reconnectAttempts++;
|
|
26147
|
+
const delay = Math.min(
|
|
26148
|
+
this.reconnectInterval * this.reconnectAttempts,
|
|
26149
|
+
3e4
|
|
26150
|
+
);
|
|
26151
|
+
console.log(
|
|
26152
|
+
`\u{1F504} Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`
|
|
26153
|
+
);
|
|
26154
|
+
this.reconnectTimeout = setTimeout(() => {
|
|
26112
26155
|
this.connect();
|
|
26113
|
-
|
|
26114
|
-
|
|
26156
|
+
}, delay);
|
|
26157
|
+
} else {
|
|
26158
|
+
console.error("\u274C Max reconnection attempts reached");
|
|
26159
|
+
this.connectionLostCallbacks.forEach((cb) => cb());
|
|
26115
26160
|
}
|
|
26116
26161
|
}
|
|
26117
26162
|
pongTimeout = null;
|
|
@@ -26253,6 +26298,7 @@ var init_useWebSocket = __esm({
|
|
|
26253
26298
|
}) => {
|
|
26254
26299
|
const isOnline = useOnlineStatus2();
|
|
26255
26300
|
const wsManager = WebSocketManager.getInstance();
|
|
26301
|
+
console.log(`\u{1F680} ~ wsManager:`, wsManager);
|
|
26256
26302
|
const connectionStateRef = (0, import_react28.useRef)("disconnected");
|
|
26257
26303
|
const [connected, setConnected] = (0, import_react28.useState)(false);
|
|
26258
26304
|
(0, import_react28.useEffect)(() => {
|
|
@@ -26519,19 +26565,19 @@ function ChatProvider({
|
|
|
26519
26565
|
return;
|
|
26520
26566
|
}
|
|
26521
26567
|
}, [loading, storeApps, loadingApp]);
|
|
26568
|
+
console.log("threaddssdsdsd", threadId);
|
|
26522
26569
|
const setIsNewChat = (value, to = app?.slug ? getAppSlug2(app) : "/") => {
|
|
26523
26570
|
if (value) {
|
|
26524
26571
|
setCollaborationStep(0);
|
|
26525
26572
|
setThread(void 0);
|
|
26526
26573
|
setProfile(void 0);
|
|
26527
|
-
refetchThreads();
|
|
26528
|
-
setThreadId(void 0);
|
|
26529
26574
|
setMessages([]);
|
|
26530
|
-
router.push(to);
|
|
26531
26575
|
setStatus(null);
|
|
26532
26576
|
isIncognito && setWasIncognito(true);
|
|
26533
26577
|
setCollaborationStatus(null);
|
|
26534
26578
|
setIsChatFloating(false);
|
|
26579
|
+
router.push(to);
|
|
26580
|
+
refetchThreads();
|
|
26535
26581
|
}
|
|
26536
26582
|
setIsNewChatInternal(value);
|
|
26537
26583
|
};
|
|
@@ -26726,15 +26772,6 @@ function ChatProvider({
|
|
|
26726
26772
|
};
|
|
26727
26773
|
}
|
|
26728
26774
|
}, [user, guest, threadId, connected]);
|
|
26729
|
-
(0, import_react29.useEffect)(() => {
|
|
26730
|
-
const id = getThreadId2(pathname);
|
|
26731
|
-
if (id) {
|
|
26732
|
-
setThreadId(id);
|
|
26733
|
-
setShouldFetchThread(true);
|
|
26734
|
-
} else {
|
|
26735
|
-
setIsChatFloating(false);
|
|
26736
|
-
}
|
|
26737
|
-
}, [pathname]);
|
|
26738
26775
|
const [creditsLeft, setCreditsLeft] = (0, import_react29.useState)(void 0);
|
|
26739
26776
|
(0, import_react29.useEffect)(() => {
|
|
26740
26777
|
if (user?.creditsLeft || guest?.creditsLeft) {
|
|
@@ -26846,10 +26883,11 @@ function ChatProvider({
|
|
|
26846
26883
|
);
|
|
26847
26884
|
setIsWebSearchEnabledInternal(agent?.capabilities?.webSearch || false);
|
|
26848
26885
|
};
|
|
26849
|
-
const
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
|
|
26886
|
+
const defaultAgent = aiAgents.find((a) => app?.defaultModel && a.name === app?.defaultModel) || favouriteAgent;
|
|
26887
|
+
const [selectedAgent, setSelectedAgentInternal] = useLocalStorage2("selectedAgent", defaultAgent);
|
|
26888
|
+
(0, import_react29.useEffect)(() => {
|
|
26889
|
+
!selectedAgent && setSelectedAgent(defaultAgent);
|
|
26890
|
+
}, [defaultAgent, selectedAgent]);
|
|
26853
26891
|
const setIsWebSearchEnabled = (value) => {
|
|
26854
26892
|
value ? setSelectedAgent(perplexityAgent) : void 0;
|
|
26855
26893
|
setIsWebSearchEnabledInternal(value);
|
|
@@ -27006,6 +27044,8 @@ function ChatProvider({
|
|
|
27006
27044
|
isLoadingMore,
|
|
27007
27045
|
setIsLoadingMore,
|
|
27008
27046
|
isLoading,
|
|
27047
|
+
shouldFetchThread,
|
|
27048
|
+
setShouldFetchThread,
|
|
27009
27049
|
refetchThread: async () => {
|
|
27010
27050
|
setShouldFetchThread(true);
|
|
27011
27051
|
shouldFetchThread && await mutate();
|
|
@@ -27096,7 +27136,6 @@ var init_ChatProvider = __esm({
|
|
|
27096
27136
|
init_DataProvider();
|
|
27097
27137
|
init_utils();
|
|
27098
27138
|
init_hasThreadNotification();
|
|
27099
|
-
init_url();
|
|
27100
27139
|
init_platform();
|
|
27101
27140
|
init_AppProvider();
|
|
27102
27141
|
init_getHourlyLimit();
|
|
@@ -27137,7 +27176,8 @@ function NavigationProvider({ children }) {
|
|
|
27137
27176
|
isVisitor,
|
|
27138
27177
|
setIsVisitor,
|
|
27139
27178
|
refetchThreads,
|
|
27140
|
-
userNameByUrl
|
|
27179
|
+
userNameByUrl,
|
|
27180
|
+
setShouldFetchThread
|
|
27141
27181
|
} = useChat();
|
|
27142
27182
|
const goToCalendar = () => {
|
|
27143
27183
|
const url = threadId ? `/calendar?threadId=${threadId}` : "/calendar";
|
|
@@ -30198,6 +30238,7 @@ function Modal({
|
|
|
30198
30238
|
if (params) {
|
|
30199
30239
|
const urlParams = new URLSearchParams(params.split("?")[1] || "");
|
|
30200
30240
|
const paramToRemove = Array.from(urlParams.entries())[0]?.[0];
|
|
30241
|
+
console.log(`\u{1F680} ~ useEffect ~ paramToRemove:`, paramToRemove);
|
|
30201
30242
|
if (paramToRemove) {
|
|
30202
30243
|
removeParams([paramToRemove]);
|
|
30203
30244
|
}
|
|
@@ -37528,73 +37569,6 @@ function Chat({
|
|
|
37528
37569
|
}
|
|
37529
37570
|
});
|
|
37530
37571
|
};
|
|
37531
|
-
const getPossibleApp = async (text3) => {
|
|
37532
|
-
console.log(`\u{1F680} Analyzing text:`, text3);
|
|
37533
|
-
if (text3.length < 10) return null;
|
|
37534
|
-
try {
|
|
37535
|
-
if (window.ai?.languageModel) {
|
|
37536
|
-
try {
|
|
37537
|
-
console.log("\u{1F916} Using Chrome AI...");
|
|
37538
|
-
const session2 = await window.ai.languageModel.create({
|
|
37539
|
-
temperature: 0.3,
|
|
37540
|
-
topK: 1
|
|
37541
|
-
});
|
|
37542
|
-
const prompt = `Analyze this text and return ONLY the app name that matches best:
|
|
37543
|
-
"${text3}"
|
|
37544
|
-
|
|
37545
|
-
Apps:
|
|
37546
|
-
${apps.map((app2) => `- ${app2.name}: ${app2.description || ""}`).join("\n")}
|
|
37547
|
-
|
|
37548
|
-
Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
|
|
37549
|
-
const result = await session2.prompt(prompt);
|
|
37550
|
-
console.log(`\u{1F916} Chrome AI result:`, result);
|
|
37551
|
-
const slug2 = result.trim().toLowerCase();
|
|
37552
|
-
const matchedApp = apps.find((app2) => app2.name.toLowerCase() === slug2);
|
|
37553
|
-
if (matchedApp) {
|
|
37554
|
-
console.log(`\u2705 Chrome AI detected: ${matchedApp.name}`);
|
|
37555
|
-
return matchedApp;
|
|
37556
|
-
}
|
|
37557
|
-
} catch (aiError) {
|
|
37558
|
-
console.log("\u26A0\uFE0F Chrome AI failed, using fallback:", aiError);
|
|
37559
|
-
}
|
|
37560
|
-
}
|
|
37561
|
-
console.log("\u{1F50D} Using keyword detection...");
|
|
37562
|
-
const lowerText = text3.toLowerCase();
|
|
37563
|
-
const appPatterns = {
|
|
37564
|
-
atlas: t5("app_keywords_atlas").split(","),
|
|
37565
|
-
bloom: t5("app_keywords_bloom").split(","),
|
|
37566
|
-
peach: t5("app_keywords_peach").split(","),
|
|
37567
|
-
vault: t5("app_keywords_vault").split(",")
|
|
37568
|
-
};
|
|
37569
|
-
const scores = {};
|
|
37570
|
-
for (const [slug2, keywords] of Object.entries(appPatterns)) {
|
|
37571
|
-
let score = 0;
|
|
37572
|
-
for (const keyword of keywords) {
|
|
37573
|
-
if (lowerText.includes(keyword)) {
|
|
37574
|
-
score += keyword.split(" ").length;
|
|
37575
|
-
}
|
|
37576
|
-
}
|
|
37577
|
-
if (score > 0) {
|
|
37578
|
-
scores[slug2] = score;
|
|
37579
|
-
}
|
|
37580
|
-
}
|
|
37581
|
-
console.log(`\u{1F3AF} App scores:`, scores);
|
|
37582
|
-
const bestMatch = Object.entries(scores).sort(([, a], [, b]) => b - a)[0];
|
|
37583
|
-
if (bestMatch) {
|
|
37584
|
-
const [slug2, score] = bestMatch;
|
|
37585
|
-
const matchedApp = apps.find((app2) => app2.name.toLowerCase() === slug2);
|
|
37586
|
-
if (matchedApp) {
|
|
37587
|
-
console.log(`\u2705 Detected app: ${matchedApp.name} (score: ${score})`);
|
|
37588
|
-
return matchedApp;
|
|
37589
|
-
}
|
|
37590
|
-
}
|
|
37591
|
-
console.log(`\u274C No app detected`);
|
|
37592
|
-
return null;
|
|
37593
|
-
} catch (error) {
|
|
37594
|
-
console.error("Error detecting app:", error);
|
|
37595
|
-
return null;
|
|
37596
|
-
}
|
|
37597
|
-
};
|
|
37598
37572
|
const setInput = (value) => {
|
|
37599
37573
|
inputRef.current = value;
|
|
37600
37574
|
setInputInternal(value);
|
|
@@ -38639,7 +38613,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
|
|
|
38639
38613
|
const handleStopStreaming = async () => {
|
|
38640
38614
|
addHapticFeedback();
|
|
38641
38615
|
isPlayingSillyPopCluster.current = false;
|
|
38642
|
-
apiFetch(`${API_URL2}/ai`, {
|
|
38616
|
+
await apiFetch(`${API_URL2}/ai`, {
|
|
38643
38617
|
method: "POST",
|
|
38644
38618
|
headers: {
|
|
38645
38619
|
"Content-Type": "application/json",
|
|
@@ -49471,7 +49445,8 @@ function FocusButton2({
|
|
|
49471
49445
|
storeApps,
|
|
49472
49446
|
focus: focus2,
|
|
49473
49447
|
setShowFocus,
|
|
49474
|
-
showFocus
|
|
49448
|
+
showFocus,
|
|
49449
|
+
loadingApp
|
|
49475
49450
|
} = useAuth();
|
|
49476
49451
|
const { searchParams, addParams, push, removeParams } = useNavigation();
|
|
49477
49452
|
const hasHydrated = useHasHydrated();
|
|
@@ -49515,7 +49490,12 @@ function FocusButton2({
|
|
|
49515
49490
|
const [isDeletingTask, setIsDeletingTask] = (0, import_react85.useState)(false);
|
|
49516
49491
|
const isMovingItemRef = (0, import_react85.useRef)(false);
|
|
49517
49492
|
const { isDark, setTheme: setThemeInContext } = useTheme2();
|
|
49518
|
-
const {
|
|
49493
|
+
const {
|
|
49494
|
+
setPlaceHolderText,
|
|
49495
|
+
placeHolderText,
|
|
49496
|
+
setShouldFocus,
|
|
49497
|
+
setIsNewAppChat
|
|
49498
|
+
} = useChat();
|
|
49519
49499
|
const adjustIntervalRef = (0, import_react85.useRef)(null);
|
|
49520
49500
|
const secondsUpButtonRef = (0, import_react85.useRef)(null);
|
|
49521
49501
|
const secondsDownButtonRef = (0, import_react85.useRef)(null);
|
|
@@ -50123,21 +50103,30 @@ function FocusButton2({
|
|
|
50123
50103
|
/* @__PURE__ */ import_react85.default.createElement(icons_exports.AlarmClockCheck, { width: 16, height: 16 }),
|
|
50124
50104
|
t5("New task")
|
|
50125
50105
|
), focus2 && /* @__PURE__ */ import_react85.default.createElement(
|
|
50126
|
-
|
|
50106
|
+
Span,
|
|
50127
50107
|
{
|
|
50128
|
-
className: "
|
|
50108
|
+
className: `${loadingApp?.id === focus2?.id ? "glow" : ""}`,
|
|
50129
50109
|
style: {
|
|
50130
|
-
|
|
50131
|
-
...utilities.inverted.style,
|
|
50132
|
-
...utilities.small.style
|
|
50133
|
-
},
|
|
50134
|
-
onClick: () => {
|
|
50135
|
-
setShowFocus(false);
|
|
50136
|
-
app?.id === focus2?.id ? setShowFocus(false) : push(getAppSlug2(focus2));
|
|
50110
|
+
"--glow-color": COLORS[focus2.themeColor]
|
|
50137
50111
|
}
|
|
50138
50112
|
},
|
|
50139
|
-
/* @__PURE__ */ import_react85.default.createElement(
|
|
50140
|
-
|
|
50113
|
+
/* @__PURE__ */ import_react85.default.createElement(
|
|
50114
|
+
Anchor,
|
|
50115
|
+
{
|
|
50116
|
+
className: `button inverted`,
|
|
50117
|
+
style: {
|
|
50118
|
+
...utilities.button.style,
|
|
50119
|
+
...utilities.inverted.style,
|
|
50120
|
+
...utilities.small.style
|
|
50121
|
+
},
|
|
50122
|
+
onClick: () => {
|
|
50123
|
+
setShowFocus(false);
|
|
50124
|
+
app?.id === focus2?.id ? setShowFocus(false) : setIsNewAppChat(focus2);
|
|
50125
|
+
}
|
|
50126
|
+
},
|
|
50127
|
+
loadingApp?.id !== focus2?.id ? /* @__PURE__ */ import_react85.default.createElement(ImageComponent, { size: 20, app: focus2 }) : /* @__PURE__ */ import_react85.default.createElement(Loading, { size: 20 }),
|
|
50128
|
+
focus2.name
|
|
50129
|
+
)
|
|
50141
50130
|
))), tasks?.tasks?.length ? /* @__PURE__ */ import_react85.default.createElement(import_react85.default.Fragment, null, /* @__PURE__ */ import_react85.default.createElement(
|
|
50142
50131
|
DraggableList,
|
|
50143
50132
|
{
|
|
@@ -50360,6 +50349,7 @@ var init_FocusButton = __esm({
|
|
|
50360
50349
|
init_SwipeableTimeControl();
|
|
50361
50350
|
init_providers();
|
|
50362
50351
|
init_platform();
|
|
50352
|
+
init_ThemeContext();
|
|
50363
50353
|
init_Image();
|
|
50364
50354
|
init_A();
|
|
50365
50355
|
init_StylesContext();
|
|
@@ -82002,11 +81992,6 @@ var init_Hey = __esm({
|
|
|
82002
81992
|
const ssrPrefixes = ["/blog"];
|
|
82003
81993
|
const isSSRRoute = lastPathSegment && ssrRoutes.includes(lastPathSegment) || ssrPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
82004
81994
|
const pathWithoutLocale = pathname.replace(/^\/[a-z]{2}\//, "/").slice(1).split("?")[0];
|
|
82005
|
-
(0, import_react114.useEffect)(() => {
|
|
82006
|
-
if (pathnameLocal && isExtension2 && pathnameLocal !== "/") {
|
|
82007
|
-
router.push(pathnameLocal);
|
|
82008
|
-
}
|
|
82009
|
-
}, [pathnameLocal, isExtension2]);
|
|
82010
81995
|
const isChrry = app && app.slug === "chrry";
|
|
82011
81996
|
const isStorePage = storeApps?.find(
|
|
82012
81997
|
(app2) => app2.store?.slug === pathWithoutLocale
|
|
@@ -82292,6 +82277,7 @@ var init_swrCacheProvider = __esm({
|
|
|
82292
82277
|
function AppProviders({
|
|
82293
82278
|
children,
|
|
82294
82279
|
session: session2,
|
|
82280
|
+
app,
|
|
82295
82281
|
onSetLanguage,
|
|
82296
82282
|
apiKey,
|
|
82297
82283
|
signInContext,
|
|
@@ -82346,6 +82332,7 @@ function AppProviders({
|
|
|
82346
82332
|
locale: locale5,
|
|
82347
82333
|
error,
|
|
82348
82334
|
apiKey,
|
|
82335
|
+
app,
|
|
82349
82336
|
threads,
|
|
82350
82337
|
onSetLanguage,
|
|
82351
82338
|
signInContext,
|