research-agent-ui 0.1.77 → 0.1.78
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/README.md +19 -1
- package/dist/components/ChatConversation/MessageBubble/FollowUpSuggestions.stories.d.ts +13 -0
- package/dist/components/ChatConversation/MessageBubble/UserMessageHeader.stories.d.ts +19 -0
- package/dist/components/FileUpload/FilePreviewCard.stories.d.ts +15 -0
- package/dist/components/MessageComposer/PastedContentCard.stories.d.ts +10 -0
- package/dist/components/SearchResults/SearchProgressIndicator.stories.d.ts +15 -0
- package/dist/index.cjs +14 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +441 -424
- package/dist/lib/utils.d.ts +5 -0
- package/dist/stories/mocks.d.ts +16 -0
- package/package.json +11 -5
package/dist/index.mjs
CHANGED
|
@@ -31,11 +31,17 @@ import { Streamdown as xt } from "streamdown";
|
|
|
31
31
|
function J(...e) {
|
|
32
32
|
return v(_(e));
|
|
33
33
|
}
|
|
34
|
-
var St = (e
|
|
34
|
+
var St = (e) => {
|
|
35
|
+
let t = new Date(e);
|
|
36
|
+
return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString([], {
|
|
37
|
+
hour: "numeric",
|
|
38
|
+
minute: "2-digit"
|
|
39
|
+
});
|
|
40
|
+
}, Ct = (e, t) => {
|
|
35
41
|
e = new Date(e), t = new Date(t);
|
|
36
42
|
let n = Math.floor(Math.abs(t.getTime() - e.getTime()) / 1e3);
|
|
37
43
|
return n < 60 ? `${n} second${n === 1 ? "" : "s"}` : n < 3600 ? `${Math.floor(n / 60)} minute${Math.floor(n / 60) === 1 ? "" : "s"}` : n < 86400 ? `${Math.floor(n / 3600)} hour${Math.floor(n / 3600) === 1 ? "" : "s"}` : n < 31536e3 ? `${Math.floor(n / 86400)} day${Math.floor(n / 86400) === 1 ? "" : "s"}` : `${Math.floor(n / 31536e3)} year${Math.floor(n / 31536e3) === 1 ? "" : "s"}`;
|
|
38
|
-
},
|
|
44
|
+
}, wt = s(({ blur: e = 0, inactiveZone: t = .7, proximity: n = 0, spread: r = 20, variant: i = "default", glow: a = !1, className: o, movementDuration: s = 2, borderWidth: l = 1, disabled: d = !0 }) => {
|
|
39
45
|
let p = f(null), m = f({
|
|
40
46
|
x: 0,
|
|
41
47
|
y: 0
|
|
@@ -95,16 +101,16 @@ var St = (e, t) => {
|
|
|
95
101
|
children: /* @__PURE__ */ W("div", { className: J("glow", "rounded-[inherit]", "after:content-[\"\"] after:rounded-[inherit] after:absolute after:inset-[calc(-1*var(--glowingeffect-border-width))]", "after:[border:var(--glowingeffect-border-width)_solid_transparent]", "after:[background:var(--gradient)] after:[background-attachment:fixed]", "after:opacity-[var(--active)] after:transition-opacity after:duration-300", "after:[mask-clip:padding-box,border-box]", "after:[mask-composite:intersect]", "after:[mask-image:linear-gradient(#0000,#0000),conic-gradient(from_calc((var(--start)-var(--spread))*1deg),#00000000_0deg,#fff,#00000000_calc(var(--spread)*2deg))]") })
|
|
96
102
|
})] });
|
|
97
103
|
});
|
|
98
|
-
|
|
104
|
+
wt.displayName = "GlowingEffect";
|
|
99
105
|
//#endregion
|
|
100
106
|
//#region src/components/ArticleReader/ExtractPanelContext.tsx
|
|
101
|
-
var
|
|
102
|
-
let e = l(
|
|
107
|
+
var Tt = a(void 0), Et = () => {
|
|
108
|
+
let e = l(Tt);
|
|
103
109
|
if (!e) throw Error("useExtractPanel must be used within an ExtractPanelProvider");
|
|
104
110
|
return e;
|
|
105
|
-
},
|
|
111
|
+
}, Dt = ({ children: e }) => {
|
|
106
112
|
let [t, n] = p(!1), [r, i] = p(""), [a, o] = p(""), [s, c] = p(600);
|
|
107
|
-
return /* @__PURE__ */ W(
|
|
113
|
+
return /* @__PURE__ */ W(Tt.Provider, {
|
|
108
114
|
value: {
|
|
109
115
|
isOpen: t,
|
|
110
116
|
url: r,
|
|
@@ -143,7 +149,7 @@ var wt = a(void 0), Tt = () => {
|
|
|
143
149
|
};
|
|
144
150
|
//#endregion
|
|
145
151
|
//#region src/icons/IconSearchWeb.tsx
|
|
146
|
-
function
|
|
152
|
+
function Ot(e) {
|
|
147
153
|
return /* @__PURE__ */ G("svg", {
|
|
148
154
|
xmlns: "http://www.w3.org/2000/svg",
|
|
149
155
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -185,7 +191,7 @@ function Dt(e) {
|
|
|
185
191
|
}
|
|
186
192
|
//#endregion
|
|
187
193
|
//#region src/icons/IconSearchNews.tsx
|
|
188
|
-
function
|
|
194
|
+
function kt(e) {
|
|
189
195
|
return /* @__PURE__ */ G("svg", {
|
|
190
196
|
version: "1.1",
|
|
191
197
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -261,7 +267,7 @@ function Ot(e) {
|
|
|
261
267
|
}
|
|
262
268
|
//#endregion
|
|
263
269
|
//#region src/icons/IconSearchVideos.tsx
|
|
264
|
-
function
|
|
270
|
+
function At(e) {
|
|
265
271
|
return /* @__PURE__ */ G("svg", {
|
|
266
272
|
version: "1.1",
|
|
267
273
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -502,7 +508,7 @@ function kt(e) {
|
|
|
502
508
|
}
|
|
503
509
|
//#endregion
|
|
504
510
|
//#region src/icons/IconSearchImages.tsx
|
|
505
|
-
function
|
|
511
|
+
function jt(e) {
|
|
506
512
|
return /* @__PURE__ */ W("svg", {
|
|
507
513
|
width: "800px",
|
|
508
514
|
height: "800px",
|
|
@@ -567,7 +573,7 @@ function At(e) {
|
|
|
567
573
|
}
|
|
568
574
|
//#endregion
|
|
569
575
|
//#region src/icons/IconSearchAcademic.tsx
|
|
570
|
-
function
|
|
576
|
+
function Mt(e) {
|
|
571
577
|
return /* @__PURE__ */ G("svg", {
|
|
572
578
|
width: "800px",
|
|
573
579
|
height: "800px",
|
|
@@ -613,7 +619,7 @@ function jt(e) {
|
|
|
613
619
|
}
|
|
614
620
|
//#endregion
|
|
615
621
|
//#region src/icons/IconSearchFiles.tsx
|
|
616
|
-
function
|
|
622
|
+
function Nt(e) {
|
|
617
623
|
return /* @__PURE__ */ G("svg", {
|
|
618
624
|
height: "800px",
|
|
619
625
|
width: "800px",
|
|
@@ -666,7 +672,7 @@ function Mt(e) {
|
|
|
666
672
|
}
|
|
667
673
|
//#endregion
|
|
668
674
|
//#region src/icons/IconSearchTech.tsx
|
|
669
|
-
function
|
|
675
|
+
function Pt(e) {
|
|
670
676
|
return /* @__PURE__ */ G("svg", {
|
|
671
677
|
height: "800px",
|
|
672
678
|
width: "800px",
|
|
@@ -793,51 +799,51 @@ function Nt(e) {
|
|
|
793
799
|
}
|
|
794
800
|
//#endregion
|
|
795
801
|
//#region src/components/SearchConfig/categories.ts
|
|
796
|
-
var
|
|
802
|
+
var Ft = [
|
|
797
803
|
{
|
|
798
804
|
code: "general",
|
|
799
|
-
icon:
|
|
805
|
+
icon: Ot,
|
|
800
806
|
name: "Web"
|
|
801
807
|
},
|
|
802
808
|
{
|
|
803
809
|
code: "news",
|
|
804
|
-
icon:
|
|
810
|
+
icon: kt,
|
|
805
811
|
name: "News"
|
|
806
812
|
},
|
|
807
813
|
{
|
|
808
814
|
code: "videos",
|
|
809
|
-
icon:
|
|
815
|
+
icon: At,
|
|
810
816
|
name: "Videos"
|
|
811
817
|
},
|
|
812
818
|
{
|
|
813
819
|
code: "images",
|
|
814
|
-
icon:
|
|
820
|
+
icon: jt,
|
|
815
821
|
name: "Images"
|
|
816
822
|
},
|
|
817
823
|
{
|
|
818
824
|
code: "science",
|
|
819
|
-
icon:
|
|
825
|
+
icon: Mt,
|
|
820
826
|
name: "Academic"
|
|
821
827
|
},
|
|
822
828
|
{
|
|
823
829
|
code: "files",
|
|
824
|
-
icon:
|
|
830
|
+
icon: Nt,
|
|
825
831
|
name: "Files"
|
|
826
832
|
},
|
|
827
833
|
{
|
|
828
834
|
code: "it",
|
|
829
|
-
icon:
|
|
835
|
+
icon: Pt,
|
|
830
836
|
name: "Tech"
|
|
831
837
|
}
|
|
832
|
-
],
|
|
838
|
+
], It = Ft.filter((e) => [
|
|
833
839
|
"general",
|
|
834
840
|
"news",
|
|
835
841
|
"videos",
|
|
836
842
|
"images",
|
|
837
843
|
"science",
|
|
838
844
|
"files"
|
|
839
|
-
].includes(e.code)),
|
|
840
|
-
let [n, r] = p("general"), [i, a] = p(e), [o, s] = p(!1), [l, d] = p(!1), [m, h] = p(1), [g, _] = p(!0), [v, y] = p(!1), b = f(null), x = f(!1), S = f(!1), { openPanel: C, isOpen: w } =
|
|
845
|
+
].includes(e.code)), Lt = ({ sources: e, query: t }) => {
|
|
846
|
+
let [n, r] = p("general"), [i, a] = p(e), [o, s] = p(!1), [l, d] = p(!1), [m, h] = p(1), [g, _] = p(!0), [v, y] = p(!1), b = f(null), x = f(!1), S = f(!1), { openPanel: C, isOpen: w } = Et(), [T, E] = p({});
|
|
841
847
|
u(() => {
|
|
842
848
|
let e = () => {
|
|
843
849
|
y(window.innerWidth >= 1024);
|
|
@@ -996,7 +1002,7 @@ var Pt = [
|
|
|
996
1002
|
}, t);
|
|
997
1003
|
if (i && a) return /* @__PURE__ */ G("div", {
|
|
998
1004
|
className: "relative rounded-xl",
|
|
999
|
-
children: [/* @__PURE__ */ W(
|
|
1005
|
+
children: [/* @__PURE__ */ W(wt, {
|
|
1000
1006
|
spread: 40,
|
|
1001
1007
|
glow: !0,
|
|
1002
1008
|
disabled: !1,
|
|
@@ -1033,7 +1039,7 @@ var Pt = [
|
|
|
1033
1039
|
let o = T[e.metadata.url];
|
|
1034
1040
|
return /* @__PURE__ */ G("div", {
|
|
1035
1041
|
className: "relative rounded-xl group h-full",
|
|
1036
|
-
children: [/* @__PURE__ */ W(
|
|
1042
|
+
children: [/* @__PURE__ */ W(wt, {
|
|
1037
1043
|
spread: 40,
|
|
1038
1044
|
glow: !0,
|
|
1039
1045
|
disabled: !1,
|
|
@@ -1098,7 +1104,7 @@ var Pt = [
|
|
|
1098
1104
|
};
|
|
1099
1105
|
return /* @__PURE__ */ G(U, { children: [t && /* @__PURE__ */ W("div", {
|
|
1100
1106
|
className: "flex items-center gap-1 mb-3 overflow-x-auto pb-1",
|
|
1101
|
-
children:
|
|
1107
|
+
children: It.map((e) => /* @__PURE__ */ G("button", {
|
|
1102
1108
|
onClick: () => A(e.code),
|
|
1103
1109
|
disabled: o,
|
|
1104
1110
|
className: J("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all duration-200 whitespace-nowrap", n === e.code ? "bg-primary text-primary-foreground" : "bg-secondary/50 text-muted-foreground hover:bg-secondary hover:text-foreground"),
|
|
@@ -1128,7 +1134,7 @@ var Pt = [
|
|
|
1128
1134
|
children: "No results found"
|
|
1129
1135
|
})
|
|
1130
1136
|
})] });
|
|
1131
|
-
},
|
|
1137
|
+
}, Rt = {
|
|
1132
1138
|
extract: "Extract",
|
|
1133
1139
|
arxiv: "ArXiv",
|
|
1134
1140
|
"google scholar": "Scholar",
|
|
@@ -1137,10 +1143,10 @@ var Pt = [
|
|
|
1137
1143
|
youtube: "YouTube",
|
|
1138
1144
|
Web: "Web"
|
|
1139
1145
|
};
|
|
1140
|
-
function
|
|
1141
|
-
return e ?
|
|
1146
|
+
function zt(e) {
|
|
1147
|
+
return e ? Rt[e] ?? e : "Web";
|
|
1142
1148
|
}
|
|
1143
|
-
function
|
|
1149
|
+
function Bt({ queries: e, loading: t }) {
|
|
1144
1150
|
let n = e.filter((e) => e.status === "done").length, r = e.length, i = t && e.some((e) => e.status === "running");
|
|
1145
1151
|
return t ? /* @__PURE__ */ G("div", {
|
|
1146
1152
|
className: "rounded-xl border border-border bg-secondary/20 overflow-hidden text-sm",
|
|
@@ -1169,7 +1175,7 @@ function zt({ queries: e, loading: t }) {
|
|
|
1169
1175
|
className: "flex items-baseline gap-1.5 min-w-0 flex-1",
|
|
1170
1176
|
children: [/* @__PURE__ */ G("span", {
|
|
1171
1177
|
className: "text-xs text-muted-foreground whitespace-nowrap flex-shrink-0",
|
|
1172
|
-
children: [
|
|
1178
|
+
children: [zt(e.category), " ·"]
|
|
1173
1179
|
}), /* @__PURE__ */ W("span", {
|
|
1174
1180
|
className: "text-foreground/80 truncate",
|
|
1175
1181
|
children: e.query
|
|
@@ -1181,57 +1187,57 @@ function zt({ queries: e, loading: t }) {
|
|
|
1181
1187
|
}
|
|
1182
1188
|
//#endregion
|
|
1183
1189
|
//#region src/lib/kokoro.ts
|
|
1184
|
-
var
|
|
1190
|
+
var Vt = {
|
|
1185
1191
|
device: "webgpu",
|
|
1186
1192
|
dtype: "fp32"
|
|
1187
|
-
},
|
|
1193
|
+
}, Ht = {
|
|
1188
1194
|
device: "wasm",
|
|
1189
1195
|
dtype: "q8"
|
|
1190
|
-
},
|
|
1191
|
-
function
|
|
1196
|
+
}, Ut = "hexgrad/Kokoro-82M", Wt = null, Gt = null;
|
|
1197
|
+
function Kt() {
|
|
1192
1198
|
return typeof navigator < "u" && "gpu" in navigator;
|
|
1193
1199
|
}
|
|
1194
|
-
async function
|
|
1195
|
-
if (!
|
|
1200
|
+
async function qt() {
|
|
1201
|
+
if (!Kt()) return !1;
|
|
1196
1202
|
try {
|
|
1197
1203
|
return await navigator.gpu.requestAdapter() != null;
|
|
1198
1204
|
} catch {
|
|
1199
1205
|
return !1;
|
|
1200
1206
|
}
|
|
1201
1207
|
}
|
|
1202
|
-
async function
|
|
1208
|
+
async function Jt() {
|
|
1203
1209
|
let e = [];
|
|
1204
|
-
await
|
|
1210
|
+
await qt() && e.push(Vt), e.push(Ht);
|
|
1205
1211
|
let { KokoroTTS: t } = await import("kokoro-js"), n;
|
|
1206
1212
|
for (let r of e) try {
|
|
1207
|
-
let e = await t.from_pretrained(
|
|
1213
|
+
let e = await t.from_pretrained(Ut, {
|
|
1208
1214
|
device: r.device,
|
|
1209
1215
|
dtype: r.dtype
|
|
1210
1216
|
});
|
|
1211
|
-
return
|
|
1217
|
+
return Gt = r.device, e;
|
|
1212
1218
|
} catch (e) {
|
|
1213
1219
|
n = e, console.warn(`Kokoro model failed to load on "${r.device}" backend:`, e);
|
|
1214
1220
|
}
|
|
1215
1221
|
throw n instanceof Error ? n : /* @__PURE__ */ Error("Failed to load Kokoro model");
|
|
1216
1222
|
}
|
|
1217
|
-
async function Jt() {
|
|
1218
|
-
return Ut ||= qt().catch((e) => {
|
|
1219
|
-
throw Ut = null, e;
|
|
1220
|
-
}), Ut;
|
|
1221
|
-
}
|
|
1222
1223
|
async function Yt() {
|
|
1223
|
-
return Jt()
|
|
1224
|
+
return Wt ||= Jt().catch((e) => {
|
|
1225
|
+
throw Wt = null, e;
|
|
1226
|
+
}), Wt;
|
|
1224
1227
|
}
|
|
1225
1228
|
async function Xt() {
|
|
1226
|
-
|
|
1229
|
+
return Yt();
|
|
1230
|
+
}
|
|
1231
|
+
async function Zt() {
|
|
1232
|
+
let e = await Xt();
|
|
1227
1233
|
return Object.keys(e.voices);
|
|
1228
1234
|
}
|
|
1229
|
-
function
|
|
1230
|
-
return
|
|
1235
|
+
function Qt() {
|
|
1236
|
+
return Gt;
|
|
1231
1237
|
}
|
|
1232
1238
|
//#endregion
|
|
1233
1239
|
//#region src/hooks/voice/useTextToVoice.ts
|
|
1234
|
-
function
|
|
1240
|
+
function $t(e, t) {
|
|
1235
1241
|
let [n, r] = p("stopped"), i = f(null), a = f(null), o = f(null), s = f(t);
|
|
1236
1242
|
s.current = t;
|
|
1237
1243
|
let l = c(() => {
|
|
@@ -1259,7 +1265,7 @@ function Qt(e, t) {
|
|
|
1259
1265
|
o.current = t;
|
|
1260
1266
|
try {
|
|
1261
1267
|
if (localStorage.getItem("useTTSKokoro") !== "false") try {
|
|
1262
|
-
let t = await
|
|
1268
|
+
let t = await Xt(), n = localStorage.getItem("kokoroVoice") || "af_heart", a = (await t.generate(e.slice(0, 5e3), { voice: n })).toWav(), o = new Blob([a], { type: "audio/wav" }), s = URL.createObjectURL(o), c = new Audio(s);
|
|
1263
1269
|
i.current = c, c.onended = () => {
|
|
1264
1270
|
r("stopped"), URL.revokeObjectURL(s), i.current = null;
|
|
1265
1271
|
}, c.onerror = () => {
|
|
@@ -1302,7 +1308,7 @@ function Qt(e, t) {
|
|
|
1302
1308
|
}
|
|
1303
1309
|
//#endregion
|
|
1304
1310
|
//#region src/hooks/useChat/chatConfig.ts
|
|
1305
|
-
var
|
|
1311
|
+
var en = async (e, t, n) => {
|
|
1306
1312
|
let r = localStorage.getItem("chatModelKey"), i = localStorage.getItem("chatModelProviderId"), a = (await ut("/api/agent/providers"))?.providers || [];
|
|
1307
1313
|
if (!a || a.length === 0) {
|
|
1308
1314
|
t(!0);
|
|
@@ -1323,47 +1329,47 @@ var $t = async (e, t, n) => {
|
|
|
1323
1329
|
key: r,
|
|
1324
1330
|
providerId: i
|
|
1325
1331
|
}), t(!0);
|
|
1326
|
-
},
|
|
1327
|
-
function
|
|
1328
|
-
if (!
|
|
1332
|
+
}, tn = "qwksearch_guest_chats", nn = typeof window < "u";
|
|
1333
|
+
function rn() {
|
|
1334
|
+
if (!nn) return [];
|
|
1329
1335
|
try {
|
|
1330
|
-
let e = localStorage.getItem(
|
|
1336
|
+
let e = localStorage.getItem(tn);
|
|
1331
1337
|
return e ? JSON.parse(e).sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()) : [];
|
|
1332
1338
|
} catch (e) {
|
|
1333
1339
|
return console.error("Failed to get guest chats:", e), [];
|
|
1334
1340
|
}
|
|
1335
1341
|
}
|
|
1336
|
-
function rn(e) {
|
|
1337
|
-
return tn && nn().find((t) => t.id === e) || null;
|
|
1338
|
-
}
|
|
1339
1342
|
function an(e) {
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
+
return nn && rn().find((t) => t.id === e) || null;
|
|
1344
|
+
}
|
|
1345
|
+
function on(e) {
|
|
1346
|
+
if (nn) try {
|
|
1347
|
+
let t = rn(), n = t.findIndex((t) => t.id === e.id);
|
|
1348
|
+
n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(tn, JSON.stringify(t));
|
|
1343
1349
|
} catch (e) {
|
|
1344
1350
|
console.error("Failed to save guest chat:", e);
|
|
1345
1351
|
}
|
|
1346
1352
|
}
|
|
1347
|
-
function
|
|
1348
|
-
if (
|
|
1349
|
-
let t =
|
|
1350
|
-
localStorage.setItem(
|
|
1353
|
+
function sn(e) {
|
|
1354
|
+
if (nn) try {
|
|
1355
|
+
let t = rn().filter((t) => t.id !== e);
|
|
1356
|
+
localStorage.setItem(tn, JSON.stringify(t));
|
|
1351
1357
|
} catch (e) {
|
|
1352
1358
|
console.error("Failed to delete guest chat:", e);
|
|
1353
1359
|
}
|
|
1354
1360
|
}
|
|
1355
|
-
function
|
|
1356
|
-
if (
|
|
1357
|
-
localStorage.removeItem(
|
|
1361
|
+
function cn() {
|
|
1362
|
+
if (nn) try {
|
|
1363
|
+
localStorage.removeItem(tn);
|
|
1358
1364
|
} catch (e) {
|
|
1359
1365
|
console.error("Failed to clear guest chats:", e);
|
|
1360
1366
|
}
|
|
1361
1367
|
}
|
|
1362
1368
|
//#endregion
|
|
1363
1369
|
//#region src/hooks/useChat/chatMessages.ts
|
|
1364
|
-
var
|
|
1370
|
+
var ln = async (e, t, n, r, i, a, o, s, c) => {
|
|
1365
1371
|
if (!t) {
|
|
1366
|
-
let t =
|
|
1372
|
+
let t = an(e);
|
|
1367
1373
|
if (t) {
|
|
1368
1374
|
n(t.messages);
|
|
1369
1375
|
let e = t.messages.filter((e) => e.role === "user" || e.role === "assistant"), o = e.map((e) => [e.role, e.content]);
|
|
@@ -1427,7 +1433,7 @@ var cn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
1427
1433
|
} catch (e) {
|
|
1428
1434
|
console.error("[chatMessages] Failed to load chat:", e), o(!0), r(!0);
|
|
1429
1435
|
}
|
|
1430
|
-
},
|
|
1436
|
+
}, un = (e) => {
|
|
1431
1437
|
let t = [];
|
|
1432
1438
|
return e.forEach((n, r) => {
|
|
1433
1439
|
if (n.role === "user") {
|
|
@@ -1459,7 +1465,7 @@ var cn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
1459
1465
|
});
|
|
1460
1466
|
}
|
|
1461
1467
|
}), t;
|
|
1462
|
-
},
|
|
1468
|
+
}, dn = async (e) => {
|
|
1463
1469
|
let t = localStorage.getItem("chatModelKey"), n = localStorage.getItem("chatModelProviderId"), r = parseInt(localStorage.getItem("maxFollowupQuestions") || "4"), i = e.filter((e) => e.role === "user" || e.role === "assistant");
|
|
1464
1470
|
try {
|
|
1465
1471
|
let e = await ut("agent/suggestions", {
|
|
@@ -1477,15 +1483,15 @@ var cn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
1477
1483
|
} catch {
|
|
1478
1484
|
return [];
|
|
1479
1485
|
}
|
|
1480
|
-
},
|
|
1481
|
-
async function
|
|
1482
|
-
let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, focusMode: u, category: d, optimizationMode: f, chatHistory: p, chatModelProvider: m, isAuthenticated: h, messagesRef: g, abortControllerRef: _, setLoading: v, setMessageAppeared: y, setMessages: b, setChatHistory: x, setChatModelProvider: S } = n, C = typeof window < "u" && localStorage.getItem(
|
|
1486
|
+
}, fn = 3, pn = "Analyze the uploaded file(s) and summarize the key points.", mn = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""), hn = "sourceExtractionEnabled", gn = "thinkingTimeLimit";
|
|
1487
|
+
async function _n(e, n) {
|
|
1488
|
+
let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, focusMode: u, category: d, optimizationMode: f, chatHistory: p, chatModelProvider: m, isAuthenticated: h, messagesRef: g, abortControllerRef: _, setLoading: v, setMessageAppeared: y, setMessages: b, setChatHistory: x, setChatModelProvider: S } = n, C = typeof window < "u" && localStorage.getItem(hn) === "true", w = typeof window < "u" && Number(localStorage.getItem(gn) ?? "0") || 0;
|
|
1483
1489
|
if (s) return;
|
|
1484
1490
|
let T = r?.trim() ?? "", E = Array.isArray(l) && l.length > 0;
|
|
1485
1491
|
if (!T && !E) return;
|
|
1486
|
-
let D = T ? r :
|
|
1492
|
+
let D = T ? r : pn, O = new AbortController();
|
|
1487
1493
|
_.current = O, v(!0), y(!1), c.length <= 1 && window.history.replaceState(null, "", `/c/${o}`);
|
|
1488
|
-
let k = "", A = !1, j = !1, M = [], N = Date.now(), P = w > 0, F = "", I = "", L = i ??
|
|
1494
|
+
let k = "", A = !1, j = !1, M = [], N = Date.now(), P = w > 0, F = "", I = "", L = i ?? mn();
|
|
1489
1495
|
b((e) => [...e, {
|
|
1490
1496
|
content: D,
|
|
1491
1497
|
messageId: L,
|
|
@@ -1544,7 +1550,7 @@ async function gn(e, n) {
|
|
|
1544
1550
|
role: "source",
|
|
1545
1551
|
sources: M,
|
|
1546
1552
|
createdAt: /* @__PURE__ */ new Date()
|
|
1547
|
-
}]), M.length > 0 && (y(!0), M.slice(0,
|
|
1553
|
+
}]), M.length > 0 && (y(!0), M.slice(0, fn).forEach((e) => {
|
|
1548
1554
|
let t = e?.metadata?.url;
|
|
1549
1555
|
t && t !== "File" && ut(`doc/article?url=${encodeURIComponent(t)}`).catch(() => {});
|
|
1550
1556
|
}))), e.type === "message" && (k += e.data, P ? (F += e.data, I ||= e.messageId, A = !0) : A ? b((t) => t.map((t) => t.messageId === e.messageId && t.role === "assistant" ? {
|
|
@@ -1572,7 +1578,7 @@ async function gn(e, n) {
|
|
|
1572
1578
|
let e = g.current[g.current.length - 1];
|
|
1573
1579
|
if (t.getAutoMediaSearch() && (document.getElementById(`search-images-${e.messageId}`)?.click(), document.getElementById(`search-videos-${e.messageId}`)?.click()), !j) {
|
|
1574
1580
|
j = !0;
|
|
1575
|
-
let e = await
|
|
1581
|
+
let e = await dn(g.current), t = mn();
|
|
1576
1582
|
if (b((n) => [...n, {
|
|
1577
1583
|
role: "suggestion",
|
|
1578
1584
|
suggestions: e,
|
|
@@ -1650,11 +1656,11 @@ async function gn(e, n) {
|
|
|
1650
1656
|
}
|
|
1651
1657
|
//#endregion
|
|
1652
1658
|
//#region src/hooks/useChat/useChatState.ts
|
|
1653
|
-
function
|
|
1659
|
+
function vn(e) {
|
|
1654
1660
|
let [t, n] = p(e), [r, i] = p(!1), [a, o] = p(!1), [s, c] = p(!1), [l, u] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p(!1), [b, x] = p(!1), [S, C] = p([]), [w, T] = p([]), [E, D] = p([]), [O, k] = p([]), [A, j] = p("webSearch"), [M, N] = p("general"), [P, F] = p("speed"), [I, L] = p({
|
|
1655
1661
|
key: "",
|
|
1656
1662
|
providerId: ""
|
|
1657
|
-
}), R = f([]), z = d(() => w.filter((e) => e.role === "user" || e.role === "assistant"), [w]), B = d(() =>
|
|
1663
|
+
}), R = f([]), z = d(() => w.filter((e) => e.role === "user" || e.role === "assistant"), [w]), B = d(() => un(w), [w]);
|
|
1658
1664
|
return {
|
|
1659
1665
|
state: {
|
|
1660
1666
|
chatId: t,
|
|
@@ -1701,7 +1707,7 @@ function _n(e) {
|
|
|
1701
1707
|
}
|
|
1702
1708
|
//#endregion
|
|
1703
1709
|
//#region src/hooks/useChat/ChatContext.tsx
|
|
1704
|
-
var
|
|
1710
|
+
var yn = a({
|
|
1705
1711
|
chatHistory: [],
|
|
1706
1712
|
chatId: "",
|
|
1707
1713
|
fileIds: [],
|
|
@@ -1735,19 +1741,19 @@ var vn = a({
|
|
|
1735
1741
|
incognito: !1,
|
|
1736
1742
|
setIncognito: () => {}
|
|
1737
1743
|
});
|
|
1738
|
-
function
|
|
1739
|
-
return l(
|
|
1744
|
+
function bn() {
|
|
1745
|
+
return l(yn);
|
|
1740
1746
|
}
|
|
1741
1747
|
//#endregion
|
|
1742
1748
|
//#region src/hooks/useSession.tsx
|
|
1743
|
-
var
|
|
1749
|
+
var xn = a({
|
|
1744
1750
|
user: null,
|
|
1745
1751
|
isLoading: !0,
|
|
1746
1752
|
isAuthenticated: !1,
|
|
1747
1753
|
signIn: () => {},
|
|
1748
1754
|
signOut: async () => {}
|
|
1749
1755
|
});
|
|
1750
|
-
function
|
|
1756
|
+
function Sn({ children: e, authClient: t, enableGoogleOneTap: n = !0 }) {
|
|
1751
1757
|
let [r, i] = p(null), [a, o] = p(!0);
|
|
1752
1758
|
return u(() => {
|
|
1753
1759
|
(async () => {
|
|
@@ -1769,7 +1775,7 @@ function xn({ children: e, authClient: t, enableGoogleOneTap: n = !0 }) {
|
|
|
1769
1775
|
a,
|
|
1770
1776
|
r,
|
|
1771
1777
|
n
|
|
1772
|
-
]), /* @__PURE__ */ W(
|
|
1778
|
+
]), /* @__PURE__ */ W(xn.Provider, {
|
|
1773
1779
|
value: {
|
|
1774
1780
|
user: r,
|
|
1775
1781
|
isLoading: a,
|
|
@@ -1793,23 +1799,23 @@ function xn({ children: e, authClient: t, enableGoogleOneTap: n = !0 }) {
|
|
|
1793
1799
|
children: e
|
|
1794
1800
|
});
|
|
1795
1801
|
}
|
|
1796
|
-
function
|
|
1797
|
-
let e = l(
|
|
1802
|
+
function Cn() {
|
|
1803
|
+
let e = l(xn);
|
|
1798
1804
|
if (!e) throw Error("useSession must be used within SessionProvider");
|
|
1799
1805
|
return e;
|
|
1800
1806
|
}
|
|
1801
1807
|
//#endregion
|
|
1802
1808
|
//#region src/hooks/useChat/ChatProvider.tsx
|
|
1803
|
-
function
|
|
1804
|
-
let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } =
|
|
1809
|
+
function wn({ children: e }) {
|
|
1810
|
+
let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } = Cn(), { state: s, setters: l, messagesRef: d, chatTurns: _, sections: v } = vn(t.chatId), y = f(null), [b, x] = p(!1);
|
|
1805
1811
|
u(() => {
|
|
1806
|
-
|
|
1812
|
+
en(l.setChatModelProvider, l.setIsConfigReady, l.setHasError);
|
|
1807
1813
|
}, []), u(() => {
|
|
1808
1814
|
t.chatId && t.chatId !== s.chatId && (l.setChatId(t.chatId), l.setMessages([]), l.setChatHistory([]), l.setFiles([]), l.setFileIds([]), l.setIsMessagesLoaded(!1), l.setNotFound(!1), l.setNewChatCreated(!1));
|
|
1809
1815
|
}, [t.chatId, s.chatId]), u(() => {
|
|
1810
1816
|
if (s.chatId && !s.newChatCreated && !s.isMessagesLoaded && s.messages.length === 0) {
|
|
1811
1817
|
if (o) return;
|
|
1812
|
-
|
|
1818
|
+
ln(s.chatId, a, l.setMessages, l.setIsMessagesLoaded, l.setChatHistory, l.setFocusMode, l.setNotFound, l.setFiles, l.setFileIds);
|
|
1813
1819
|
} else s.chatId || (l.setNewChatCreated(!0), l.setIsMessagesLoaded(!0), l.setChatId(crypto.randomUUID()));
|
|
1814
1820
|
}, [
|
|
1815
1821
|
s.chatId,
|
|
@@ -1823,7 +1829,7 @@ function Cn({ children: e }) {
|
|
|
1823
1829
|
let e = s.messages.filter((e) => e.role === "user" || e.role === "assistant");
|
|
1824
1830
|
if (e.length > 0) {
|
|
1825
1831
|
let t = e[0].content.slice(0, 50);
|
|
1826
|
-
|
|
1832
|
+
on({
|
|
1827
1833
|
id: s.chatId,
|
|
1828
1834
|
title: t,
|
|
1829
1835
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1851,7 +1857,7 @@ function Cn({ children: e }) {
|
|
|
1851
1857
|
i
|
|
1852
1858
|
]);
|
|
1853
1859
|
let S = c(async (e, t, n = !1) => {
|
|
1854
|
-
s.chatId && await
|
|
1860
|
+
s.chatId && await _n({
|
|
1855
1861
|
message: e,
|
|
1856
1862
|
messageId: t,
|
|
1857
1863
|
rewrite: n
|
|
@@ -1930,14 +1936,14 @@ function Cn({ children: e }) {
|
|
|
1930
1936
|
newChat: T,
|
|
1931
1937
|
setIncognito: x
|
|
1932
1938
|
};
|
|
1933
|
-
return /* @__PURE__ */ W(
|
|
1939
|
+
return /* @__PURE__ */ W(yn.Provider, {
|
|
1934
1940
|
value: E,
|
|
1935
1941
|
children: e
|
|
1936
1942
|
});
|
|
1937
1943
|
}
|
|
1938
1944
|
//#endregion
|
|
1939
1945
|
//#region src/ui/tooltip.tsx
|
|
1940
|
-
function
|
|
1946
|
+
function Tn({ delayDuration: e = 0, ...t }) {
|
|
1941
1947
|
return /* @__PURE__ */ W(dt.Provider, {
|
|
1942
1948
|
"data-slot": "tooltip-provider",
|
|
1943
1949
|
delayDuration: e,
|
|
@@ -1945,7 +1951,7 @@ function wn({ delayDuration: e = 0, ...t }) {
|
|
|
1945
1951
|
});
|
|
1946
1952
|
}
|
|
1947
1953
|
function Y({ ...e }) {
|
|
1948
|
-
return /* @__PURE__ */ W(
|
|
1954
|
+
return /* @__PURE__ */ W(Tn, { children: /* @__PURE__ */ W(dt.Root, {
|
|
1949
1955
|
"data-slot": "tooltip",
|
|
1950
1956
|
...e
|
|
1951
1957
|
}) });
|
|
@@ -1967,8 +1973,8 @@ function Z({ className: e, sideOffset: t = 0, children: n, ...r }) {
|
|
|
1967
1973
|
}
|
|
1968
1974
|
//#endregion
|
|
1969
1975
|
//#region src/components/SearchResults/WebCitationBadge.tsx
|
|
1970
|
-
var
|
|
1971
|
-
let { openPanel: r } =
|
|
1976
|
+
var En = ({ href: e, children: t, sources: n }) => {
|
|
1977
|
+
let { openPanel: r } = Et(), i = d(() => !n || !e ? null : n.find((t) => t.metadata?.url === e) ?? null, [n, e]), a = d(() => {
|
|
1972
1978
|
try {
|
|
1973
1979
|
return new URL(e).hostname.replace("www.", "");
|
|
1974
1980
|
} catch {
|
|
@@ -2008,7 +2014,7 @@ var Tn = ({ href: e, children: t, sources: n }) => {
|
|
|
2008
2014
|
})]
|
|
2009
2015
|
})
|
|
2010
2016
|
})] });
|
|
2011
|
-
},
|
|
2017
|
+
}, Dn = ({ content: e, thinkingEnded: t }) => {
|
|
2012
2018
|
let [n, r] = p(!0);
|
|
2013
2019
|
return u(() => {
|
|
2014
2020
|
r(!t);
|
|
@@ -2035,10 +2041,10 @@ var Tn = ({ href: e, children: t, sources: n }) => {
|
|
|
2035
2041
|
children: e
|
|
2036
2042
|
})]
|
|
2037
2043
|
});
|
|
2038
|
-
},
|
|
2044
|
+
}, On = ({ children: e, thinkingEnded: t }) => /* @__PURE__ */ W(Dn, {
|
|
2039
2045
|
content: e,
|
|
2040
2046
|
thinkingEnded: t
|
|
2041
|
-
}),
|
|
2047
|
+
}), kn = ({ section: e, isExpanded: t, setIsExpanded: n, isEditing: r, setIsEditing: i, editText: a, setEditText: o, handleEditSubmit: s, copiedUserMsg: c, handleCopyUserMsg: l }) => {
|
|
2042
2048
|
let u = f(null);
|
|
2043
2049
|
return /* @__PURE__ */ G("div", {
|
|
2044
2050
|
className: "w-full pt-8 break-words",
|
|
@@ -2059,35 +2065,46 @@ var Tn = ({ href: e, children: t, sources: n }) => {
|
|
|
2059
2065
|
}),
|
|
2060
2066
|
/* @__PURE__ */ G("div", {
|
|
2061
2067
|
className: "flex items-center gap-0.5 mt-1 ml-10",
|
|
2062
|
-
children: [
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2068
|
+
children: [
|
|
2069
|
+
(() => {
|
|
2070
|
+
let t = St(e.userMessage.createdAt);
|
|
2071
|
+
return t ? /* @__PURE__ */ W("time", {
|
|
2072
|
+
dateTime: new Date(e.userMessage.createdAt).toISOString(),
|
|
2073
|
+
className: "mr-1.5 text-xs text-muted-foreground tabular-nums select-none",
|
|
2074
|
+
children: t
|
|
2075
|
+
}) : null;
|
|
2076
|
+
})(),
|
|
2077
|
+
/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2078
|
+
asChild: !0,
|
|
2079
|
+
children: /* @__PURE__ */ W("button", {
|
|
2080
|
+
onClick: l,
|
|
2081
|
+
className: "p-1.5 text-muted-foreground rounded-lg hover:bg-secondary transition-all duration-200 hover:text-foreground",
|
|
2082
|
+
children: /* @__PURE__ */ W("span", {
|
|
2083
|
+
className: J("flex items-center transition-all duration-300", c ? "scale-110" : "scale-100"),
|
|
2084
|
+
children: c ? /* @__PURE__ */ W(k, {
|
|
2085
|
+
size: 14,
|
|
2086
|
+
className: "text-green-500"
|
|
2087
|
+
}) : /* @__PURE__ */ W(I, { size: 14 })
|
|
2088
|
+
})
|
|
2073
2089
|
})
|
|
2074
|
-
})
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2090
|
+
}), /* @__PURE__ */ W(Z, {
|
|
2091
|
+
side: "bottom",
|
|
2092
|
+
children: c ? "Copied!" : "Copy prompt"
|
|
2093
|
+
})] }),
|
|
2094
|
+
/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2095
|
+
asChild: !0,
|
|
2096
|
+
children: /* @__PURE__ */ W("button", {
|
|
2097
|
+
onClick: () => {
|
|
2098
|
+
o(e.userMessage.content), i(!0), setTimeout(() => u.current?.focus(), 50);
|
|
2099
|
+
},
|
|
2100
|
+
className: "p-1.5 text-muted-foreground rounded-lg hover:bg-secondary transition-all duration-200 hover:text-foreground",
|
|
2101
|
+
children: /* @__PURE__ */ W(ge, { size: 14 })
|
|
2102
|
+
})
|
|
2103
|
+
}), /* @__PURE__ */ W(Z, {
|
|
2104
|
+
side: "bottom",
|
|
2105
|
+
children: "Edit & resubmit"
|
|
2106
|
+
})] })
|
|
2107
|
+
]
|
|
2091
2108
|
}),
|
|
2092
2109
|
r && /* @__PURE__ */ G("div", {
|
|
2093
2110
|
className: "mt-3 ml-10 flex flex-col gap-2",
|
|
@@ -2119,19 +2136,19 @@ var Tn = ({ href: e, children: t, sources: n }) => {
|
|
|
2119
2136
|
};
|
|
2120
2137
|
//#endregion
|
|
2121
2138
|
//#region src/ui/dropdown-menu.tsx
|
|
2122
|
-
function
|
|
2139
|
+
function An({ ...e }) {
|
|
2123
2140
|
return /* @__PURE__ */ W(q.Root, {
|
|
2124
2141
|
"data-slot": "dropdown-menu",
|
|
2125
2142
|
...e
|
|
2126
2143
|
});
|
|
2127
2144
|
}
|
|
2128
|
-
function
|
|
2145
|
+
function jn({ ...e }) {
|
|
2129
2146
|
return /* @__PURE__ */ W(q.Trigger, {
|
|
2130
2147
|
"data-slot": "dropdown-menu-trigger",
|
|
2131
2148
|
...e
|
|
2132
2149
|
});
|
|
2133
2150
|
}
|
|
2134
|
-
function
|
|
2151
|
+
function Mn({ className: e, sideOffset: t = 4, ...n }) {
|
|
2135
2152
|
return /* @__PURE__ */ W(q.Portal, { children: /* @__PURE__ */ W(q.Content, {
|
|
2136
2153
|
"data-slot": "dropdown-menu-content",
|
|
2137
2154
|
sideOffset: t,
|
|
@@ -2148,7 +2165,7 @@ function Q({ className: e, inset: t, variant: n = "default", ...r }) {
|
|
|
2148
2165
|
...r
|
|
2149
2166
|
});
|
|
2150
2167
|
}
|
|
2151
|
-
function
|
|
2168
|
+
function Nn({ className: e, children: t, checked: n, ...r }) {
|
|
2152
2169
|
return /* @__PURE__ */ G(q.CheckboxItem, {
|
|
2153
2170
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
2154
2171
|
className: J("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-2xl py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e),
|
|
@@ -2160,7 +2177,7 @@ function Mn({ className: e, children: t, checked: n, ...r }) {
|
|
|
2160
2177
|
}), t]
|
|
2161
2178
|
});
|
|
2162
2179
|
}
|
|
2163
|
-
function
|
|
2180
|
+
function Pn({ className: e, inset: t, ...n }) {
|
|
2164
2181
|
return /* @__PURE__ */ W(q.Label, {
|
|
2165
2182
|
"data-slot": "dropdown-menu-label",
|
|
2166
2183
|
"data-inset": t,
|
|
@@ -2168,20 +2185,20 @@ function Nn({ className: e, inset: t, ...n }) {
|
|
|
2168
2185
|
...n
|
|
2169
2186
|
});
|
|
2170
2187
|
}
|
|
2171
|
-
function
|
|
2188
|
+
function Fn({ className: e, ...t }) {
|
|
2172
2189
|
return /* @__PURE__ */ W(q.Separator, {
|
|
2173
2190
|
"data-slot": "dropdown-menu-separator",
|
|
2174
2191
|
className: J("bg-border -mx-1 my-1 h-px", e),
|
|
2175
2192
|
...t
|
|
2176
2193
|
});
|
|
2177
2194
|
}
|
|
2178
|
-
function
|
|
2195
|
+
function In({ ...e }) {
|
|
2179
2196
|
return /* @__PURE__ */ W(q.Sub, {
|
|
2180
2197
|
"data-slot": "dropdown-menu-sub",
|
|
2181
2198
|
...e
|
|
2182
2199
|
});
|
|
2183
2200
|
}
|
|
2184
|
-
function
|
|
2201
|
+
function Ln({ className: e, inset: t, children: n, ...r }) {
|
|
2185
2202
|
return /* @__PURE__ */ G(q.SubTrigger, {
|
|
2186
2203
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
2187
2204
|
"data-inset": t,
|
|
@@ -2190,7 +2207,7 @@ function In({ className: e, inset: t, children: n, ...r }) {
|
|
|
2190
2207
|
children: [n, /* @__PURE__ */ W(N, { className: "ml-auto size-4" })]
|
|
2191
2208
|
});
|
|
2192
2209
|
}
|
|
2193
|
-
function
|
|
2210
|
+
function Rn({ className: e, ...t }) {
|
|
2194
2211
|
return /* @__PURE__ */ W(q.SubContent, {
|
|
2195
2212
|
"data-slot": "dropdown-menu-sub-content",
|
|
2196
2213
|
className: J("bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-2xl border p-1 shadow-lg", e),
|
|
@@ -2199,7 +2216,7 @@ function Ln({ className: e, ...t }) {
|
|
|
2199
2216
|
}
|
|
2200
2217
|
//#endregion
|
|
2201
2218
|
//#region src/components/MessageActions/CopyMessageButton.tsx
|
|
2202
|
-
var
|
|
2219
|
+
var zn = ({ section: e, initialMessage: t }) => {
|
|
2203
2220
|
let [n, r] = p(!1);
|
|
2204
2221
|
return /* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2205
2222
|
asChild: !0,
|
|
@@ -2218,19 +2235,19 @@ var Rn = ({ section: e, initialMessage: t }) => {
|
|
|
2218
2235
|
};
|
|
2219
2236
|
//#endregion
|
|
2220
2237
|
//#region src/ui/popover.tsx
|
|
2221
|
-
function
|
|
2238
|
+
function Bn({ ...e }) {
|
|
2222
2239
|
return /* @__PURE__ */ W(ft.Root, {
|
|
2223
2240
|
"data-slot": "popover",
|
|
2224
2241
|
...e
|
|
2225
2242
|
});
|
|
2226
2243
|
}
|
|
2227
|
-
function
|
|
2244
|
+
function Vn({ ...e }) {
|
|
2228
2245
|
return /* @__PURE__ */ W(ft.Trigger, {
|
|
2229
2246
|
"data-slot": "popover-trigger",
|
|
2230
2247
|
...e
|
|
2231
2248
|
});
|
|
2232
2249
|
}
|
|
2233
|
-
function
|
|
2250
|
+
function Hn({ className: e, align: t = "center", sideOffset: n = 4, container: r, ...i }) {
|
|
2234
2251
|
return /* @__PURE__ */ W(ft.Portal, {
|
|
2235
2252
|
container: r,
|
|
2236
2253
|
children: /* @__PURE__ */ W(ft.Content, {
|
|
@@ -2278,8 +2295,8 @@ var $ = {
|
|
|
2278
2295
|
...e,
|
|
2279
2296
|
children: /* @__PURE__ */ W("path", { d: "M10.3857 2.50977C14.3486 2.71054 17.5 5.98724 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 9.72386 2.72386 9.5 3 9.5C3.27614 9.5 3.5 9.72386 3.5 10C3.5 13.5899 6.41015 16.5 10 16.5C13.5899 16.5 16.5 13.5899 16.5 10C16.5 6.5225 13.7691 3.68312 10.335 3.50879L10 3.5L9.89941 3.49023C9.67145 3.44371 9.5 3.24171 9.5 3C9.5 2.72386 9.72386 2.5 10 2.5L10.3857 2.50977ZM10 5.5C10.2761 5.5 10.5 5.72386 10.5 6V9.69043L13.2236 11.0527C13.4706 11.1762 13.5708 11.4766 13.4473 11.7236C13.3392 11.9397 13.0957 12.0435 12.8711 11.9834L12.7764 11.9473L9.77637 10.4473C9.60698 10.3626 9.5 10.1894 9.5 10V6C9.5 5.72386 9.72386 5.5 10 5.5ZM3.66211 6.94141C4.0273 6.94159 4.32303 7.23735 4.32324 7.60254C4.32324 7.96791 4.02743 8.26446 3.66211 8.26465C3.29663 8.26465 3 7.96802 3 7.60254C3.00021 7.23723 3.29676 6.94141 3.66211 6.94141ZM4.95605 4.29395C5.32146 4.29404 5.61719 4.59063 5.61719 4.95605C5.6171 5.3214 5.3214 5.61709 4.95605 5.61719C4.59063 5.61719 4.29403 5.32146 4.29395 4.95605C4.29395 4.59057 4.59057 4.29395 4.95605 4.29395ZM7.60254 3C7.96802 3 8.26465 3.29663 8.26465 3.66211C8.26446 4.02743 7.96791 4.32324 7.60254 4.32324C7.23736 4.32302 6.94159 4.0273 6.94141 3.66211C6.94141 3.29676 7.23724 3.00022 7.60254 3Z" })
|
|
2280
2297
|
})
|
|
2281
|
-
},
|
|
2282
|
-
let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } =
|
|
2298
|
+
}, Un = ({ messageId: e }) => {
|
|
2299
|
+
let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } = bn(), [i, a] = p([]), [o, s] = p(!0), [c, l] = p(""), [f, m] = p(!1);
|
|
2283
2300
|
u(() => {
|
|
2284
2301
|
f && (async () => {
|
|
2285
2302
|
try {
|
|
@@ -2313,12 +2330,12 @@ var $ = {
|
|
|
2313
2330
|
key: i
|
|
2314
2331
|
}), localStorage.setItem("chatModelProviderId", n), localStorage.setItem("chatModelKey", i), m(!1), t(e);
|
|
2315
2332
|
};
|
|
2316
|
-
return /* @__PURE__ */ G(
|
|
2333
|
+
return /* @__PURE__ */ G(Bn, {
|
|
2317
2334
|
open: f,
|
|
2318
2335
|
onOpenChange: m,
|
|
2319
2336
|
children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2320
2337
|
asChild: !0,
|
|
2321
|
-
children: /* @__PURE__ */ W(
|
|
2338
|
+
children: /* @__PURE__ */ W(Vn, {
|
|
2322
2339
|
asChild: !0,
|
|
2323
2340
|
children: /* @__PURE__ */ W("button", {
|
|
2324
2341
|
className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
|
|
@@ -2328,7 +2345,7 @@ var $ = {
|
|
|
2328
2345
|
}), /* @__PURE__ */ G(Z, {
|
|
2329
2346
|
side: "bottom",
|
|
2330
2347
|
children: ["Rewrite with ", g]
|
|
2331
|
-
})] }), /* @__PURE__ */ W(
|
|
2348
|
+
})] }), /* @__PURE__ */ W(Hn, {
|
|
2332
2349
|
className: "w-[280px] p-0",
|
|
2333
2350
|
align: "start",
|
|
2334
2351
|
side: "top",
|
|
@@ -2396,10 +2413,10 @@ var $ = {
|
|
|
2396
2413
|
})
|
|
2397
2414
|
})]
|
|
2398
2415
|
});
|
|
2399
|
-
},
|
|
2400
|
-
function
|
|
2416
|
+
}, Wn = /* @__PURE__ */ new Map();
|
|
2417
|
+
function Gn(e) {
|
|
2401
2418
|
if (typeof window > "u") return Promise.reject(/* @__PURE__ */ Error("CDN scripts require a browser environment"));
|
|
2402
|
-
let t =
|
|
2419
|
+
let t = Wn.get(e);
|
|
2403
2420
|
if (t) return t;
|
|
2404
2421
|
let n = new Promise((t, n) => {
|
|
2405
2422
|
let r = document.querySelector(`script[data-cdn-loader="${e}"]`);
|
|
@@ -2411,34 +2428,34 @@ function Wn(e) {
|
|
|
2411
2428
|
i.src = e, i.async = !0, i.dataset.cdnLoader = e, i.onload = () => {
|
|
2412
2429
|
i.dataset.loaded = "true", t();
|
|
2413
2430
|
}, i.onerror = () => {
|
|
2414
|
-
|
|
2431
|
+
Wn.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
|
|
2415
2432
|
}, document.head.appendChild(i);
|
|
2416
2433
|
});
|
|
2417
|
-
return
|
|
2434
|
+
return Wn.set(e, n), n;
|
|
2418
2435
|
}
|
|
2419
|
-
var
|
|
2420
|
-
async function
|
|
2421
|
-
await
|
|
2436
|
+
var Kn = "https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js", qn = "https://cdn.jsdelivr.net/npm/docx@9.5.1/build/index.umd.min.js";
|
|
2437
|
+
async function Jn() {
|
|
2438
|
+
await Gn(Kn);
|
|
2422
2439
|
let e = window.jspdf?.jsPDF;
|
|
2423
2440
|
if (!e) throw Error("jsPDF global not found after CDN load");
|
|
2424
2441
|
return e;
|
|
2425
2442
|
}
|
|
2426
|
-
async function
|
|
2427
|
-
await
|
|
2443
|
+
async function Yn() {
|
|
2444
|
+
await Gn(qn);
|
|
2428
2445
|
let e = window.docx;
|
|
2429
2446
|
if (!e) throw Error("docx global not found after CDN load");
|
|
2430
2447
|
return e;
|
|
2431
2448
|
}
|
|
2432
2449
|
//#endregion
|
|
2433
2450
|
//#region src/lib/export.ts
|
|
2434
|
-
async function
|
|
2435
|
-
|
|
2451
|
+
async function Xn(e, t) {
|
|
2452
|
+
er(`# ${e}\n\n${new mt({
|
|
2436
2453
|
headingStyle: "atx",
|
|
2437
2454
|
codeBlockStyle: "fenced"
|
|
2438
2455
|
}).turndown(t)}`, `${e}.md`, "text/markdown");
|
|
2439
2456
|
}
|
|
2440
|
-
async function
|
|
2441
|
-
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await
|
|
2457
|
+
async function Zn(e, t) {
|
|
2458
|
+
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await Yn(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
|
|
2442
2459
|
c.push(new r({
|
|
2443
2460
|
text: e,
|
|
2444
2461
|
heading: a.HEADING_1,
|
|
@@ -2512,14 +2529,14 @@ async function Xn(e, t) {
|
|
|
2512
2529
|
}] }), d = await o.toBlob(u), f = URL.createObjectURL(d), p = document.createElement("a");
|
|
2513
2530
|
p.href = f, p.download = `${e}.docx`, p.click(), URL.revokeObjectURL(f);
|
|
2514
2531
|
}
|
|
2515
|
-
async function
|
|
2532
|
+
async function Qn(e, t) {
|
|
2516
2533
|
let n = document.createElement("div");
|
|
2517
2534
|
n.style.position = "absolute", n.style.left = "-9999px", n.style.width = "210mm", n.style.padding = "20mm", n.style.backgroundColor = "white", n.style.fontFamily = "Arial, sans-serif", n.style.fontSize = "12pt", n.style.lineHeight = "1.6", n.innerHTML = `
|
|
2518
2535
|
<h1 style="font-size: 24pt; margin-bottom: 20px;">${e}</h1>
|
|
2519
2536
|
${t}
|
|
2520
2537
|
`, document.body.appendChild(n);
|
|
2521
2538
|
try {
|
|
2522
|
-
let t = await
|
|
2539
|
+
let t = await Jn(), r = await pt(n, {
|
|
2523
2540
|
scale: 2,
|
|
2524
2541
|
useCORS: !0,
|
|
2525
2542
|
logging: !1
|
|
@@ -2534,7 +2551,7 @@ async function Zn(e, t) {
|
|
|
2534
2551
|
document.body.removeChild(n);
|
|
2535
2552
|
}
|
|
2536
2553
|
}
|
|
2537
|
-
async function
|
|
2554
|
+
async function $n(e, t) {
|
|
2538
2555
|
try {
|
|
2539
2556
|
let n = `${e}\n\n${new mt().turndown(t)}`;
|
|
2540
2557
|
await navigator.clipboard.writeText(n), window.open("https://docs.google.com/document/create", "_blank"), alert("Content copied to clipboard! Paste it into the new Google Doc.");
|
|
@@ -2542,19 +2559,19 @@ async function Qn(e, t) {
|
|
|
2542
2559
|
console.error("Failed to export to Google Docs:", e), alert("Failed to copy content to clipboard. Please try again.");
|
|
2543
2560
|
}
|
|
2544
2561
|
}
|
|
2545
|
-
function
|
|
2562
|
+
function er(e, t, n) {
|
|
2546
2563
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2547
2564
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
2548
2565
|
}
|
|
2549
2566
|
//#endregion
|
|
2550
2567
|
//#region src/components/ChatConversation/MessageBubble/AssistantMessageActions.tsx
|
|
2551
|
-
var
|
|
2568
|
+
var tr = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }) => e.assistantMessage ? /* @__PURE__ */ W("div", {
|
|
2552
2569
|
className: "flex flex-row items-center justify-end w-full text-foreground py-4 -mx-2",
|
|
2553
2570
|
children: /* @__PURE__ */ G("div", {
|
|
2554
2571
|
className: "flex flex-row items-center space-x-1",
|
|
2555
2572
|
children: [
|
|
2556
|
-
/* @__PURE__ */ W(
|
|
2557
|
-
/* @__PURE__ */ W(
|
|
2573
|
+
/* @__PURE__ */ W(Un, { messageId: e.assistantMessage.messageId }),
|
|
2574
|
+
/* @__PURE__ */ W(zn, {
|
|
2558
2575
|
initialMessage: e.assistantMessage.content,
|
|
2559
2576
|
section: e
|
|
2560
2577
|
}),
|
|
@@ -2571,9 +2588,9 @@ var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2571
2588
|
side: "bottom",
|
|
2572
2589
|
children: t === "started" ? "Stop" : "Read aloud"
|
|
2573
2590
|
})] }),
|
|
2574
|
-
/* @__PURE__ */ G(
|
|
2591
|
+
/* @__PURE__ */ G(An, { children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2575
2592
|
asChild: !0,
|
|
2576
|
-
children: /* @__PURE__ */ W(
|
|
2593
|
+
children: /* @__PURE__ */ W(jn, {
|
|
2577
2594
|
asChild: !0,
|
|
2578
2595
|
children: /* @__PURE__ */ W("button", {
|
|
2579
2596
|
className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
|
|
@@ -2583,31 +2600,31 @@ var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2583
2600
|
}), /* @__PURE__ */ W(Z, {
|
|
2584
2601
|
side: "bottom",
|
|
2585
2602
|
children: "Export"
|
|
2586
|
-
})] }), /* @__PURE__ */ G(
|
|
2603
|
+
})] }), /* @__PURE__ */ G(Mn, {
|
|
2587
2604
|
align: "end",
|
|
2588
2605
|
side: "top",
|
|
2589
2606
|
children: [
|
|
2590
2607
|
/* @__PURE__ */ G(Q, {
|
|
2591
|
-
onClick: () =>
|
|
2608
|
+
onClick: () => Xn(e.userMessage.content, e.assistantMessage.content),
|
|
2592
2609
|
children: [/* @__PURE__ */ W(oe, { size: 16 }), "Markdown"]
|
|
2593
2610
|
}),
|
|
2594
2611
|
/* @__PURE__ */ G(Q, {
|
|
2595
|
-
onClick: () =>
|
|
2612
|
+
onClick: () => Qn(e.userMessage.content, e.assistantMessage.content),
|
|
2596
2613
|
children: [/* @__PURE__ */ W(se, { size: 16 }), "PDF"]
|
|
2597
2614
|
}),
|
|
2598
2615
|
/* @__PURE__ */ G(Q, {
|
|
2599
|
-
onClick: () =>
|
|
2616
|
+
onClick: () => Zn(e.userMessage.content, e.assistantMessage.content),
|
|
2600
2617
|
children: [/* @__PURE__ */ W(ie, { size: 16 }), "DOCX"]
|
|
2601
2618
|
}),
|
|
2602
2619
|
/* @__PURE__ */ G(Q, {
|
|
2603
|
-
onClick: () =>
|
|
2620
|
+
onClick: () => $n(e.userMessage.content, e.assistantMessage.content),
|
|
2604
2621
|
children: [/* @__PURE__ */ W(ae, { size: 16 }), "Google Docs"]
|
|
2605
2622
|
})
|
|
2606
2623
|
]
|
|
2607
2624
|
})] }),
|
|
2608
|
-
/* @__PURE__ */ G(
|
|
2625
|
+
/* @__PURE__ */ G(An, { children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2609
2626
|
asChild: !0,
|
|
2610
|
-
children: /* @__PURE__ */ W(
|
|
2627
|
+
children: /* @__PURE__ */ W(jn, {
|
|
2611
2628
|
asChild: !0,
|
|
2612
2629
|
children: /* @__PURE__ */ W("button", {
|
|
2613
2630
|
className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
|
|
@@ -2617,7 +2634,7 @@ var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2617
2634
|
}), /* @__PURE__ */ W(Z, {
|
|
2618
2635
|
side: "bottom",
|
|
2619
2636
|
children: "Open in LLM"
|
|
2620
|
-
})] }), /* @__PURE__ */ G(
|
|
2637
|
+
})] }), /* @__PURE__ */ G(Mn, {
|
|
2621
2638
|
align: "end",
|
|
2622
2639
|
side: "top",
|
|
2623
2640
|
children: [
|
|
@@ -2645,7 +2662,7 @@ var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2645
2662
|
})] })
|
|
2646
2663
|
]
|
|
2647
2664
|
})
|
|
2648
|
-
}) : null,
|
|
2665
|
+
}) : null, nr = gt("inline-flex items-center justify-center rounded-2xl border px-3 py-1.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
|
|
2649
2666
|
variants: { variant: {
|
|
2650
2667
|
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
2651
2668
|
secondary: "border-transparent bg-gray-100 text-gray-700 [a&]:hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:[a&]:hover:bg-gray-700",
|
|
@@ -2657,16 +2674,16 @@ var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2657
2674
|
} },
|
|
2658
2675
|
defaultVariants: { variant: "default" }
|
|
2659
2676
|
});
|
|
2660
|
-
function
|
|
2677
|
+
function rr({ className: e, variant: t, asChild: n = !1, ...r }) {
|
|
2661
2678
|
return /* @__PURE__ */ W(n ? ht : "span", {
|
|
2662
2679
|
"data-slot": "badge",
|
|
2663
|
-
className: J(
|
|
2680
|
+
className: J(nr({ variant: t }), e),
|
|
2664
2681
|
...r
|
|
2665
2682
|
});
|
|
2666
2683
|
}
|
|
2667
2684
|
//#endregion
|
|
2668
2685
|
//#region src/components/ChatConversation/MessageBubble/FollowUpSuggestions.tsx
|
|
2669
|
-
var
|
|
2686
|
+
var ir = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
2670
2687
|
let i = f([]);
|
|
2671
2688
|
return u(() => {
|
|
2672
2689
|
e.suggestions && e.suggestions.length > 0 && (i.current = e.suggestions.slice(0, 5));
|
|
@@ -2688,7 +2705,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2688
2705
|
children: /* @__PURE__ */ G("div", {
|
|
2689
2706
|
className: "flex items-center gap-3",
|
|
2690
2707
|
children: [
|
|
2691
|
-
/* @__PURE__ */ W(
|
|
2708
|
+
/* @__PURE__ */ W(rr, {
|
|
2692
2709
|
variant: "secondary",
|
|
2693
2710
|
className: "flex-shrink-0 h-6 w-6 p-0 flex items-center justify-center rounded-full text-sm font-semibold",
|
|
2694
2711
|
children: t + 1
|
|
@@ -2706,12 +2723,12 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2706
2723
|
}, t))
|
|
2707
2724
|
})
|
|
2708
2725
|
});
|
|
2709
|
-
},
|
|
2710
|
-
let { loading: r, sendMessage: i } =
|
|
2726
|
+
}, ar = ({ section: e, dividerRef: t, isLast: n }) => {
|
|
2727
|
+
let { loading: r, sendMessage: i } = bn(), [a, o] = p(!0), [s, c] = p(!1), [l, u] = p(!1), [d, f] = p(e.userMessage.content), m = () => {
|
|
2711
2728
|
navigator.clipboard.writeText(e.userMessage.content), c(!0), setTimeout(() => c(!1), 1500);
|
|
2712
2729
|
}, h = () => {
|
|
2713
2730
|
d.trim() && (i(d.trim()), u(!1));
|
|
2714
|
-
}, g = e.parsedAssistantMessage || "", _ = e.speechMessage || "", v = e.thinkingEnded, { speechStatus: b, start: x, stop: S } =
|
|
2731
|
+
}, g = e.parsedAssistantMessage || "", _ = e.speechMessage || "", v = e.thinkingEnded, { speechStatus: b, start: x, stop: S } = $t(_, { enableInterrupt: !0 }), C = (t) => {
|
|
2715
2732
|
if (!e.assistantMessage) return;
|
|
2716
2733
|
let n = `${e.userMessage.content}\n\n${e.assistantMessage.content}`;
|
|
2717
2734
|
navigator.clipboard.writeText(n);
|
|
@@ -2725,11 +2742,11 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2725
2742
|
r && window.open(`${r}${encodeURIComponent(n)}`, "_blank");
|
|
2726
2743
|
}, w = { overrides: {
|
|
2727
2744
|
think: {
|
|
2728
|
-
component:
|
|
2745
|
+
component: On,
|
|
2729
2746
|
props: { thinkingEnded: v }
|
|
2730
2747
|
},
|
|
2731
2748
|
citation: {
|
|
2732
|
-
component:
|
|
2749
|
+
component: En,
|
|
2733
2750
|
props: { sources: e.sourceMessage?.sources || [] }
|
|
2734
2751
|
},
|
|
2735
2752
|
table: { component: ({ children: e, ...t }) => /* @__PURE__ */ W("div", {
|
|
@@ -2743,7 +2760,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2743
2760
|
} };
|
|
2744
2761
|
return /* @__PURE__ */ G("div", {
|
|
2745
2762
|
className: "space-y-3",
|
|
2746
|
-
children: [/* @__PURE__ */ W(
|
|
2763
|
+
children: [/* @__PURE__ */ W(kn, {
|
|
2747
2764
|
section: e,
|
|
2748
2765
|
isExpanded: a,
|
|
2749
2766
|
setIsExpanded: o,
|
|
@@ -2760,13 +2777,13 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2760
2777
|
ref: t,
|
|
2761
2778
|
className: "flex flex-col space-y-6 w-full",
|
|
2762
2779
|
children: [
|
|
2763
|
-
e.searchingMessage && e.searchingMessage.queries.length > 0 && /* @__PURE__ */ W(
|
|
2780
|
+
e.searchingMessage && e.searchingMessage.queries.length > 0 && /* @__PURE__ */ W(Bt, {
|
|
2764
2781
|
queries: e.searchingMessage.queries,
|
|
2765
2782
|
loading: r && n
|
|
2766
2783
|
}),
|
|
2767
2784
|
e.sourceMessage && e.sourceMessage.sources.length > 0 && /* @__PURE__ */ W("div", {
|
|
2768
2785
|
className: "flex flex-col space-y-2",
|
|
2769
|
-
children: /* @__PURE__ */ W(
|
|
2786
|
+
children: /* @__PURE__ */ W(Lt, {
|
|
2770
2787
|
sources: e.sourceMessage.sources,
|
|
2771
2788
|
query: e.userMessage.content
|
|
2772
2789
|
})
|
|
@@ -2779,14 +2796,14 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2779
2796
|
options: w,
|
|
2780
2797
|
children: g
|
|
2781
2798
|
}),
|
|
2782
|
-
r && n ? null : /* @__PURE__ */ W(
|
|
2799
|
+
r && n ? null : /* @__PURE__ */ W(tr, {
|
|
2783
2800
|
section: e,
|
|
2784
2801
|
speechStatus: b,
|
|
2785
2802
|
start: x,
|
|
2786
2803
|
stop: S,
|
|
2787
2804
|
handleOpenInLLM: C
|
|
2788
2805
|
}),
|
|
2789
|
-
/* @__PURE__ */ W(
|
|
2806
|
+
/* @__PURE__ */ W(ir, {
|
|
2790
2807
|
section: e,
|
|
2791
2808
|
isLast: n,
|
|
2792
2809
|
loading: r,
|
|
@@ -2798,7 +2815,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2798
2815
|
})
|
|
2799
2816
|
})]
|
|
2800
2817
|
});
|
|
2801
|
-
},
|
|
2818
|
+
}, or = (e) => {
|
|
2802
2819
|
if (e === 0) return "0 Bytes";
|
|
2803
2820
|
let t = 1024, n = [
|
|
2804
2821
|
"Bytes",
|
|
@@ -2807,7 +2824,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2807
2824
|
"GB"
|
|
2808
2825
|
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
2809
2826
|
return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
|
|
2810
|
-
},
|
|
2827
|
+
}, sr = ({ file: e, onRemove: t }) => /* @__PURE__ */ G("div", {
|
|
2811
2828
|
className: "relative group flex-shrink-0 w-24 h-24 rounded-xl overflow-hidden border border-bg-300 bg-bg-200 animate-fade-in transition-all hover:border-text-400",
|
|
2812
2829
|
children: [
|
|
2813
2830
|
e.type.startsWith("image/") && e.preview ? /* @__PURE__ */ G("div", {
|
|
@@ -2822,7 +2839,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2822
2839
|
/* @__PURE__ */ W("span", {
|
|
2823
2840
|
className: "absolute bottom-1 left-1 px-1.5 py-0.5 rounded-md bg-black/60 text-white text-[10px] font-medium leading-none backdrop-blur-sm pointer-events-none",
|
|
2824
2841
|
title: e.file.name,
|
|
2825
|
-
children:
|
|
2842
|
+
children: or(e.file.size)
|
|
2826
2843
|
})
|
|
2827
2844
|
]
|
|
2828
2845
|
}) : /* @__PURE__ */ G("div", {
|
|
@@ -2844,7 +2861,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2844
2861
|
children: e.file.name
|
|
2845
2862
|
}), /* @__PURE__ */ W("p", {
|
|
2846
2863
|
className: "text-[10px] text-text-500",
|
|
2847
|
-
children:
|
|
2864
|
+
children: or(e.file.size)
|
|
2848
2865
|
})]
|
|
2849
2866
|
})]
|
|
2850
2867
|
}),
|
|
@@ -2862,7 +2879,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2862
2879
|
children: /* @__PURE__ */ W($.X, { className: "w-5 h-5 text-red-300" })
|
|
2863
2880
|
})
|
|
2864
2881
|
]
|
|
2865
|
-
}),
|
|
2882
|
+
}), cr = ({ content: e, onRemove: t }) => /* @__PURE__ */ G("div", {
|
|
2866
2883
|
className: "relative group flex-shrink-0 w-28 h-28 rounded-2xl overflow-hidden border border-[#E5E5E5] dark:border-[#30302E] bg-white dark:bg-[#20201F] animate-fade-in p-3 flex flex-col justify-between shadow-[0_1px_2px_rgba(0,0,0,0.05)]",
|
|
2867
2884
|
children: [
|
|
2868
2885
|
/* @__PURE__ */ W("div", {
|
|
@@ -2891,7 +2908,7 @@ var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2891
2908
|
});
|
|
2892
2909
|
//#endregion
|
|
2893
2910
|
//#region src/hooks/voice/useSpeechToTranscript.ts
|
|
2894
|
-
function
|
|
2911
|
+
function lr(e, t) {
|
|
2895
2912
|
let [n, r] = p(!1), i = f(null), a = f(null), o = f(null), s = f([]), c = f(!1), l = f(!1), d = typeof window < "u" ? window.SpeechRecognition || window.webkitSpeechRecognition : null, m = () => {
|
|
2896
2913
|
let e = a.current;
|
|
2897
2914
|
e && e.state !== "inactive" ? e.stop() : (o.current?.getTracks().forEach((e) => e.stop()), o.current = null, a.current = null, r(!1), t());
|
|
@@ -2980,28 +2997,28 @@ function cr(e, t) {
|
|
|
2980
2997
|
}
|
|
2981
2998
|
//#endregion
|
|
2982
2999
|
//#region src/components/FileUpload/useFileHandling.ts
|
|
2983
|
-
var
|
|
3000
|
+
var ur = [
|
|
2984
3001
|
"pdf",
|
|
2985
3002
|
"docx",
|
|
2986
3003
|
"txt",
|
|
2987
3004
|
"md",
|
|
2988
3005
|
"html",
|
|
2989
3006
|
"htm"
|
|
2990
|
-
],
|
|
3007
|
+
], dr = 10, fr = 50 * 1024 * 1024, pr = (e, t) => {
|
|
2991
3008
|
if (e && typeof e == "object") {
|
|
2992
3009
|
let t = e.message ?? e.error ?? e.data?.message;
|
|
2993
3010
|
if (typeof t == "string" && t.length > 0) return t;
|
|
2994
3011
|
}
|
|
2995
3012
|
return typeof e == "string" && e.length > 0 ? e : t;
|
|
2996
3013
|
};
|
|
2997
|
-
function
|
|
3014
|
+
function mr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
|
|
2998
3015
|
let [a, o] = p([]), [s, l] = p([]), [u, d] = p(!1), [f, m] = p(!1), h = c(async (e) => {
|
|
2999
3016
|
let a = Array.from(e);
|
|
3000
|
-
a.length >
|
|
3001
|
-
let s = a.filter((e) => e.size >
|
|
3002
|
-
if (s.length > 0 && (K.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <=
|
|
3017
|
+
a.length > dr && (K.error(`You can attach up to ${dr} files at a time.`), a = a.slice(0, dr));
|
|
3018
|
+
let s = a.filter((e) => e.size > fr);
|
|
3019
|
+
if (s.length > 0 && (K.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <= fr)), a.length === 0) return;
|
|
3003
3020
|
let c = a.map((e) => {
|
|
3004
|
-
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r =
|
|
3021
|
+
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r = ur.includes(n);
|
|
3005
3022
|
return {
|
|
3006
3023
|
id: Math.random().toString(36).substr(2, 9),
|
|
3007
3024
|
file: e,
|
|
@@ -3011,7 +3028,7 @@ function pr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3011
3028
|
_ext: n
|
|
3012
3029
|
};
|
|
3013
3030
|
});
|
|
3014
|
-
o((e) => [...e, ...c]), c.filter((e) => !
|
|
3031
|
+
o((e) => [...e, ...c]), c.filter((e) => !ur.includes(e._ext)).forEach((e) => {
|
|
3015
3032
|
setTimeout(() => {
|
|
3016
3033
|
o((t) => t.map((t) => t.id === e.id ? {
|
|
3017
3034
|
...t,
|
|
@@ -3019,16 +3036,16 @@ function pr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3019
3036
|
} : t));
|
|
3020
3037
|
}, 600 + Math.random() * 600);
|
|
3021
3038
|
});
|
|
3022
|
-
let l = c.filter((e) =>
|
|
3039
|
+
let l = c.filter((e) => ur.includes(e._ext));
|
|
3023
3040
|
if (l.length !== 0) try {
|
|
3024
3041
|
let { data: e, error: a } = await at({ body: { files: l.map((e) => e.file) } });
|
|
3025
|
-
if (a || !e?.files) throw Error(
|
|
3042
|
+
if (a || !e?.files) throw Error(pr(a ?? e, "Upload failed."));
|
|
3026
3043
|
o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
3027
3044
|
...e,
|
|
3028
3045
|
uploadStatus: "complete"
|
|
3029
3046
|
} : e)), r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]);
|
|
3030
3047
|
} catch (e) {
|
|
3031
|
-
K.error(
|
|
3048
|
+
K.error(pr(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
3032
3049
|
...e,
|
|
3033
3050
|
uploadStatus: "error"
|
|
3034
3051
|
} : e));
|
|
@@ -3058,10 +3075,10 @@ function pr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3058
3075
|
headers: { "Content-Type": "application/json" },
|
|
3059
3076
|
body: JSON.stringify({ url: a })
|
|
3060
3077
|
})).json();
|
|
3061
|
-
if (!e?.files || e.files.length === 0) throw Error(
|
|
3078
|
+
if (!e?.files || e.files.length === 0) throw Error(pr(e, `Could not extract content from ${a}`));
|
|
3062
3079
|
return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]), K.success(`Added "${e.files[0].fileName}" as context.`), !0;
|
|
3063
3080
|
} catch (e) {
|
|
3064
|
-
return K.error(
|
|
3081
|
+
return K.error(pr(e, "Failed to extract URL.")), !1;
|
|
3065
3082
|
} finally {
|
|
3066
3083
|
m(!1);
|
|
3067
3084
|
}
|
|
@@ -3108,24 +3125,24 @@ function pr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3108
3125
|
}
|
|
3109
3126
|
//#endregion
|
|
3110
3127
|
//#region src/components/FileUpload/GoogleDrivePicker.tsx
|
|
3111
|
-
var
|
|
3128
|
+
var hr = () => window.gapi, gr = () => window.google, _r = () => {
|
|
3112
3129
|
let e = f(!1), n = f(!1);
|
|
3113
3130
|
return u(() => {
|
|
3114
|
-
|
|
3131
|
+
hr() ? n.current = !0 : (() => {
|
|
3115
3132
|
let e = document.createElement("script");
|
|
3116
3133
|
e.src = "https://apis.google.com/js/api.js", e.onload = () => {
|
|
3117
|
-
|
|
3134
|
+
hr()?.load("client:picker", () => {
|
|
3118
3135
|
n.current = !0;
|
|
3119
3136
|
});
|
|
3120
3137
|
}, document.body.appendChild(e);
|
|
3121
|
-
})(),
|
|
3138
|
+
})(), gr()?.picker ? e.current = !0 : (() => {
|
|
3122
3139
|
let t = document.createElement("script");
|
|
3123
3140
|
t.src = "https://www.google.com/jsapi", t.onload = () => {
|
|
3124
3141
|
e.current = !0;
|
|
3125
3142
|
}, document.body.appendChild(t);
|
|
3126
3143
|
})();
|
|
3127
3144
|
}, []), { openPicker: async (e, r, i) => {
|
|
3128
|
-
let a =
|
|
3145
|
+
let a = gr();
|
|
3129
3146
|
if (!n.current || !a?.picker) {
|
|
3130
3147
|
i?.("Google Picker API not loaded yet. Please try again.");
|
|
3131
3148
|
return;
|
|
@@ -3142,8 +3159,8 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3142
3159
|
i?.(e.message || "Failed to open Google Picker");
|
|
3143
3160
|
}
|
|
3144
3161
|
} };
|
|
3145
|
-
},
|
|
3146
|
-
let { chatModelProvider: e, setChatModelProvider: t } =
|
|
3162
|
+
}, vr = () => {
|
|
3163
|
+
let { chatModelProvider: e, setChatModelProvider: t } = bn(), [n, r] = p([]), [i, a] = p(!0), o = h();
|
|
3147
3164
|
u(() => {
|
|
3148
3165
|
(async () => {
|
|
3149
3166
|
try {
|
|
@@ -3183,7 +3200,7 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3183
3200
|
key: n
|
|
3184
3201
|
}), localStorage.setItem("chatModelProviderId", e), localStorage.setItem("chatModelKey", n);
|
|
3185
3202
|
};
|
|
3186
|
-
return /* @__PURE__ */ G(
|
|
3203
|
+
return /* @__PURE__ */ G(In, { children: [/* @__PURE__ */ G(Ln, {
|
|
3187
3204
|
className: "gap-2",
|
|
3188
3205
|
children: [
|
|
3189
3206
|
/* @__PURE__ */ W(ee, { className: "w-4 h-4 flex-shrink-0 text-sky-500" }),
|
|
@@ -3193,7 +3210,7 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3193
3210
|
children: s
|
|
3194
3211
|
})
|
|
3195
3212
|
]
|
|
3196
|
-
}), /* @__PURE__ */ G(
|
|
3213
|
+
}), /* @__PURE__ */ G(Rn, {
|
|
3197
3214
|
className: "w-52 max-h-[400px] overflow-y-auto",
|
|
3198
3215
|
children: [
|
|
3199
3216
|
i ? /* @__PURE__ */ W("div", {
|
|
@@ -3203,7 +3220,7 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3203
3220
|
className: "px-3 py-2 text-xs text-muted-foreground",
|
|
3204
3221
|
children: "No models configured"
|
|
3205
3222
|
}) : n.map((t, r) => /* @__PURE__ */ G("div", { children: [
|
|
3206
|
-
/* @__PURE__ */ W(
|
|
3223
|
+
/* @__PURE__ */ W(Pn, {
|
|
3207
3224
|
className: "text-[10px] uppercase tracking-wider text-muted-foreground font-medium",
|
|
3208
3225
|
children: t.name
|
|
3209
3226
|
}),
|
|
@@ -3230,9 +3247,9 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3230
3247
|
})
|
|
3231
3248
|
]
|
|
3232
3249
|
}, n.key)),
|
|
3233
|
-
r < n.length - 1 && /* @__PURE__ */ W(
|
|
3250
|
+
r < n.length - 1 && /* @__PURE__ */ W(Fn, {})
|
|
3234
3251
|
] }, t.id)),
|
|
3235
|
-
/* @__PURE__ */ W(
|
|
3252
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3236
3253
|
/* @__PURE__ */ G(Q, {
|
|
3237
3254
|
onSelect: () => o.push("/settings?section=models"),
|
|
3238
3255
|
className: "gap-2",
|
|
@@ -3240,7 +3257,7 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3240
3257
|
})
|
|
3241
3258
|
]
|
|
3242
3259
|
})] });
|
|
3243
|
-
},
|
|
3260
|
+
}, yr = [
|
|
3244
3261
|
{
|
|
3245
3262
|
label: "5s",
|
|
3246
3263
|
value: 5
|
|
@@ -3265,22 +3282,22 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3265
3282
|
label: "Unlimited",
|
|
3266
3283
|
value: 0
|
|
3267
3284
|
}
|
|
3268
|
-
],
|
|
3285
|
+
], br = [
|
|
3269
3286
|
"pdf",
|
|
3270
3287
|
"docx",
|
|
3271
3288
|
"txt",
|
|
3272
3289
|
"md",
|
|
3273
3290
|
"html",
|
|
3274
3291
|
"htm"
|
|
3275
|
-
],
|
|
3276
|
-
let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } =
|
|
3292
|
+
], xr = /* @__PURE__ */ "markdown.js.jsx.ts.tsx.py.rb.go.rs.java.c.cpp.h.hpp.cs.swift.kt.sh.bash.zsh.json.yaml.yml.toml.ini.cfg.conf.xml.csv.tsv.log.env.sql.graphql.vue.svelte.astro.css.scss.less.sass.tex.bib.rst.adoc.org".split("."), Sr = ({ onFileSelect: e, disabled: t = !1 }) => {
|
|
3293
|
+
let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } = bn(), { isAuthenticated: d } = Cn(), f = i ? i.split(",").filter(Boolean) : ["general"], m = Ft.find((e) => e.code === f[0]) || Ft[0], g = (e) => {
|
|
3277
3294
|
let t = i ? i.split(",").filter(Boolean) : ["general"], n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
3278
3295
|
a(n.length > 0 ? n.join(",") : "general");
|
|
3279
3296
|
}, [_, v] = p(!1), [y, b] = p(!1), [x, S] = p(!1), [C, w] = p(!1), [E, D] = p(() => {
|
|
3280
3297
|
if (typeof window > "u") return 5;
|
|
3281
3298
|
let e = Number(localStorage.getItem("thinkingTimeLimit") ?? "5");
|
|
3282
3299
|
return Number.isFinite(e) ? e : 5;
|
|
3283
|
-
}), O = r.useRef(null), { openPicker: k } =
|
|
3300
|
+
}), O = r.useRef(null), { openPicker: k } = _r();
|
|
3284
3301
|
u(() => {
|
|
3285
3302
|
A();
|
|
3286
3303
|
}, []);
|
|
@@ -3324,8 +3341,8 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3324
3341
|
let n = [];
|
|
3325
3342
|
for await (let r of e.values()) if (r.kind === "file") {
|
|
3326
3343
|
let e = await r.getFile(), i = e.name.split(".").pop()?.toLowerCase() ?? "";
|
|
3327
|
-
if (
|
|
3328
|
-
else if (
|
|
3344
|
+
if (br.includes(i)) n.push(e);
|
|
3345
|
+
else if (xr.includes(i)) try {
|
|
3329
3346
|
let r = await e.text(), i = t ? `${t}/${e.name}` : e.name;
|
|
3330
3347
|
n.push(new File([r], `${i.replace(/[/\\]/g, "_")}.txt`, { type: "text/plain" }));
|
|
3331
3348
|
} catch {}
|
|
@@ -3393,11 +3410,11 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3393
3410
|
} catch (e) {
|
|
3394
3411
|
alert(e.message || "Failed to open Google Drive picker");
|
|
3395
3412
|
}
|
|
3396
|
-
}, R =
|
|
3413
|
+
}, R = yr.find((e) => e.value === E)?.label ?? "Unlimited";
|
|
3397
3414
|
return /* @__PURE__ */ G(U, { children: [
|
|
3398
3415
|
/* @__PURE__ */ G("div", {
|
|
3399
3416
|
className: "relative flex shrink min-w-8 !shrink-0 group",
|
|
3400
|
-
children: [/* @__PURE__ */ G(
|
|
3417
|
+
children: [/* @__PURE__ */ G(An, { children: [/* @__PURE__ */ W(jn, {
|
|
3401
3418
|
asChild: !0,
|
|
3402
3419
|
children: /* @__PURE__ */ W("button", {
|
|
3403
3420
|
disabled: t,
|
|
@@ -3406,27 +3423,27 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3406
3423
|
"aria-label": "Search options",
|
|
3407
3424
|
children: /* @__PURE__ */ W(Ce, { className: "w-5 h-5" })
|
|
3408
3425
|
})
|
|
3409
|
-
}), /* @__PURE__ */ G(
|
|
3426
|
+
}), /* @__PURE__ */ G(Mn, {
|
|
3410
3427
|
align: "start",
|
|
3411
3428
|
side: "top",
|
|
3412
3429
|
sideOffset: 8,
|
|
3413
3430
|
className: "w-44",
|
|
3414
3431
|
children: [
|
|
3415
|
-
/* @__PURE__ */ G(
|
|
3432
|
+
/* @__PURE__ */ G(In, { children: [/* @__PURE__ */ G(Ln, {
|
|
3416
3433
|
className: "gap-2",
|
|
3417
3434
|
children: [m && /* @__PURE__ */ W(m.icon, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Category" })]
|
|
3418
|
-
}), /* @__PURE__ */ G(
|
|
3435
|
+
}), /* @__PURE__ */ G(Rn, {
|
|
3419
3436
|
className: "w-44",
|
|
3420
3437
|
children: [
|
|
3421
|
-
/* @__PURE__ */ G(
|
|
3438
|
+
/* @__PURE__ */ G(Nn, {
|
|
3422
3439
|
checked: f.length === 0,
|
|
3423
3440
|
onCheckedChange: () => a("general"),
|
|
3424
3441
|
onSelect: (e) => e.preventDefault(),
|
|
3425
3442
|
className: "gap-2",
|
|
3426
3443
|
children: [/* @__PURE__ */ W("div", { className: "w-3.5 h-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "None" })]
|
|
3427
3444
|
}),
|
|
3428
|
-
/* @__PURE__ */ W(
|
|
3429
|
-
|
|
3445
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3446
|
+
Ft.map((e) => /* @__PURE__ */ G(Nn, {
|
|
3430
3447
|
checked: f.includes(e.code),
|
|
3431
3448
|
onCheckedChange: () => g(e.code),
|
|
3432
3449
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -3435,7 +3452,7 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3435
3452
|
}, e.code))
|
|
3436
3453
|
]
|
|
3437
3454
|
})] }),
|
|
3438
|
-
/* @__PURE__ */ G(
|
|
3455
|
+
/* @__PURE__ */ G(In, { children: [/* @__PURE__ */ G(Ln, {
|
|
3439
3456
|
className: "gap-2",
|
|
3440
3457
|
children: [
|
|
3441
3458
|
/* @__PURE__ */ W(L, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }),
|
|
@@ -3445,9 +3462,9 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3445
3462
|
children: R
|
|
3446
3463
|
})
|
|
3447
3464
|
]
|
|
3448
|
-
}), /* @__PURE__ */ W(
|
|
3465
|
+
}), /* @__PURE__ */ W(Rn, {
|
|
3449
3466
|
className: "w-36",
|
|
3450
|
-
children:
|
|
3467
|
+
children: yr.map((e) => /* @__PURE__ */ G(Q, {
|
|
3451
3468
|
onSelect: () => j(e.value),
|
|
3452
3469
|
className: J("justify-between", E === e.value && "bg-secondary"),
|
|
3453
3470
|
children: [/* @__PURE__ */ W("span", { children: e.label }), E === e.value && /* @__PURE__ */ W("svg", {
|
|
@@ -3464,13 +3481,13 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3464
3481
|
})]
|
|
3465
3482
|
}, e.value))
|
|
3466
3483
|
})] }),
|
|
3467
|
-
/* @__PURE__ */ W(
|
|
3468
|
-
/* @__PURE__ */ W(
|
|
3469
|
-
/* @__PURE__ */ W(
|
|
3470
|
-
/* @__PURE__ */ G(
|
|
3484
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3485
|
+
/* @__PURE__ */ W(vr, {}),
|
|
3486
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3487
|
+
/* @__PURE__ */ G(In, { children: [/* @__PURE__ */ G(Ln, {
|
|
3471
3488
|
className: "gap-2",
|
|
3472
3489
|
children: [/* @__PURE__ */ W(je, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Upload" })]
|
|
3473
|
-
}), /* @__PURE__ */ G(
|
|
3490
|
+
}), /* @__PURE__ */ G(Rn, {
|
|
3474
3491
|
className: "w-44",
|
|
3475
3492
|
children: [
|
|
3476
3493
|
/* @__PURE__ */ G(Q, {
|
|
@@ -3484,8 +3501,8 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3484
3501
|
className: "gap-2",
|
|
3485
3502
|
children: [C ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(ce, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: C ? "Scanning…" : "Local Folder" })]
|
|
3486
3503
|
}),
|
|
3487
|
-
/* @__PURE__ */ W(
|
|
3488
|
-
/* @__PURE__ */ W(
|
|
3504
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3505
|
+
/* @__PURE__ */ W(Pn, {
|
|
3489
3506
|
className: "text-xs font-normal text-muted-foreground",
|
|
3490
3507
|
children: "Cloud"
|
|
3491
3508
|
}),
|
|
@@ -3502,19 +3519,19 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3502
3519
|
})
|
|
3503
3520
|
]
|
|
3504
3521
|
})] }),
|
|
3505
|
-
/* @__PURE__ */ W(
|
|
3506
|
-
/* @__PURE__ */ G(
|
|
3522
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3523
|
+
/* @__PURE__ */ G(Nn, {
|
|
3507
3524
|
checked: o,
|
|
3508
3525
|
onCheckedChange: s,
|
|
3509
3526
|
onSelect: (e) => e.preventDefault(),
|
|
3510
3527
|
className: "gap-2",
|
|
3511
3528
|
children: [/* @__PURE__ */ W(ne, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Private" })]
|
|
3512
3529
|
}),
|
|
3513
|
-
/* @__PURE__ */ W(
|
|
3514
|
-
c.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
3530
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3531
|
+
c.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(In, { children: [/* @__PURE__ */ G(Ln, {
|
|
3515
3532
|
className: "gap-2",
|
|
3516
3533
|
children: [/* @__PURE__ */ W(Se, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Share" })]
|
|
3517
|
-
}), /* @__PURE__ */ G(
|
|
3534
|
+
}), /* @__PURE__ */ G(Rn, {
|
|
3518
3535
|
className: "w-48",
|
|
3519
3536
|
children: [
|
|
3520
3537
|
/* @__PURE__ */ G(Q, {
|
|
@@ -3560,37 +3577,37 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3560
3577
|
className: "gap-2",
|
|
3561
3578
|
children: [/* @__PURE__ */ W(T, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Save to QwkDocs" })]
|
|
3562
3579
|
}),
|
|
3563
|
-
/* @__PURE__ */ W(
|
|
3580
|
+
/* @__PURE__ */ W(Fn, {}),
|
|
3564
3581
|
/* @__PURE__ */ G(Q, {
|
|
3565
3582
|
onSelect: () => {
|
|
3566
|
-
|
|
3583
|
+
Xn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3567
3584
|
},
|
|
3568
3585
|
className: "gap-2",
|
|
3569
3586
|
children: [/* @__PURE__ */ W(oe, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as Markdown" })]
|
|
3570
3587
|
}),
|
|
3571
3588
|
/* @__PURE__ */ G(Q, {
|
|
3572
3589
|
onSelect: () => {
|
|
3573
|
-
|
|
3590
|
+
Qn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3574
3591
|
},
|
|
3575
3592
|
className: "gap-2",
|
|
3576
3593
|
children: [/* @__PURE__ */ W(se, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as PDF" })]
|
|
3577
3594
|
}),
|
|
3578
3595
|
/* @__PURE__ */ G(Q, {
|
|
3579
3596
|
onSelect: () => {
|
|
3580
|
-
|
|
3597
|
+
Zn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3581
3598
|
},
|
|
3582
3599
|
className: "gap-2",
|
|
3583
3600
|
children: [/* @__PURE__ */ W(ie, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as DOCX" })]
|
|
3584
3601
|
}),
|
|
3585
3602
|
/* @__PURE__ */ G(Q, {
|
|
3586
3603
|
onSelect: () => {
|
|
3587
|
-
|
|
3604
|
+
$n(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3588
3605
|
},
|
|
3589
3606
|
className: "gap-2",
|
|
3590
3607
|
children: [/* @__PURE__ */ W(ae, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export to Google Docs" })]
|
|
3591
3608
|
})
|
|
3592
3609
|
]
|
|
3593
|
-
})] }), /* @__PURE__ */ W(
|
|
3610
|
+
})] }), /* @__PURE__ */ W(Fn, {})] }),
|
|
3594
3611
|
/* @__PURE__ */ G(Q, {
|
|
3595
3612
|
onSelect: () => n.push("/library"),
|
|
3596
3613
|
className: "gap-2",
|
|
@@ -3637,7 +3654,7 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3637
3654
|
className: "hidden"
|
|
3638
3655
|
})
|
|
3639
3656
|
] });
|
|
3640
|
-
},
|
|
3657
|
+
}, Cr = o(({ active: e = !1, processing: t = !1, barWidth: n = 3, barHeight: r = 4, barGap: i = 1, barRadius: a = 1.5, barColor: o, fadeEdges: s = !0, fadeWidth: l = 24, height: d = 64, sensitivity: p = 1, smoothingTimeConstant: m = .8, fftSize: h = 256, historySize: g = 60, updateRate: _ = 30, mode: v = "static", onError: y, onStreamReady: b, onStreamEnd: x, className: S, ...C }, w) => {
|
|
3641
3658
|
let T = f(null), E = f(null), D = f(null), O = f(null), k = f(null), A = f(0), j = f([]), M = f(0), N = f(0), P = c(() => {
|
|
3642
3659
|
A.current &&= (cancelAnimationFrame(A.current), 0), k.current &&= (k.current.disconnect(), null), O.current &&= (O.current.getTracks().forEach((e) => e.stop()), null), E.current &&= (E.current.close().catch(() => {}), null), D.current = null, j.current = [], x?.();
|
|
3643
3660
|
}, [x]), F = c((e, t, o, s, c) => {
|
|
@@ -3786,23 +3803,23 @@ var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
|
3786
3803
|
})
|
|
3787
3804
|
});
|
|
3788
3805
|
});
|
|
3789
|
-
|
|
3806
|
+
Cr.displayName = "LiveWaveform";
|
|
3790
3807
|
//#endregion
|
|
3791
3808
|
//#region src/components/MessageComposer/ChatInputBox.tsx
|
|
3792
|
-
var
|
|
3809
|
+
var wr = [
|
|
3793
3810
|
"What are you curious to research?",
|
|
3794
3811
|
"Search the latest news...",
|
|
3795
3812
|
"Analyze a video, doc, or URL...",
|
|
3796
3813
|
"Find academic research on...",
|
|
3797
3814
|
"Compare products to buy..."
|
|
3798
|
-
],
|
|
3815
|
+
], Tr = {
|
|
3799
3816
|
initial: {},
|
|
3800
3817
|
animate: { transition: { staggerChildren: .025 } },
|
|
3801
3818
|
exit: { transition: {
|
|
3802
3819
|
staggerChildren: .015,
|
|
3803
3820
|
staggerDirection: -1
|
|
3804
3821
|
} }
|
|
3805
|
-
},
|
|
3822
|
+
}, Er = {
|
|
3806
3823
|
initial: {
|
|
3807
3824
|
opacity: 0,
|
|
3808
3825
|
filter: "blur(12px)",
|
|
@@ -3836,8 +3853,8 @@ var Cr = [
|
|
|
3836
3853
|
}
|
|
3837
3854
|
}
|
|
3838
3855
|
}
|
|
3839
|
-
},
|
|
3840
|
-
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } =
|
|
3856
|
+
}, Dr = ({ onNewChat: e }) => {
|
|
3857
|
+
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } = bn(), [d, m] = p(""), h = f(null), g = f(null), { files: _, setFiles: v, pastedContent: y, setPastedContent: b, isDragging: x, handleFiles: S, onDragOver: C, onDragLeave: w, onDrop: T, handlePaste: E, resetAttachments: D } = mr({
|
|
3841
3858
|
setMessage: m,
|
|
3842
3859
|
contextFiles: i,
|
|
3843
3860
|
contextFileIds: a,
|
|
@@ -3845,7 +3862,7 @@ var Cr = [
|
|
|
3845
3862
|
setContextFileIds: s
|
|
3846
3863
|
}), O = () => {
|
|
3847
3864
|
m(""), D(), h.current && (h.current.style.height = "auto");
|
|
3848
|
-
}, { isListening: k, toggleSpeech: A, isSpeechSupported: j } =
|
|
3865
|
+
}, { isListening: k, toggleSpeech: A, isSpeechSupported: j } = lr((e) => m(e), () => {
|
|
3849
3866
|
m((e) => (e.trim() && setTimeout(() => {
|
|
3850
3867
|
n(e), O();
|
|
3851
3868
|
}, 0), e));
|
|
@@ -3912,7 +3929,7 @@ var Cr = [
|
|
|
3912
3929
|
if (I || d) return;
|
|
3913
3930
|
let e = setInterval(() => {
|
|
3914
3931
|
F(!1), setTimeout(() => {
|
|
3915
|
-
N((e) => (e + 1) %
|
|
3932
|
+
N((e) => (e + 1) % wr.length), F(!0);
|
|
3916
3933
|
}, 400);
|
|
3917
3934
|
}, 3e3);
|
|
3918
3935
|
return () => clearInterval(e);
|
|
@@ -3975,17 +3992,17 @@ var Cr = [
|
|
|
3975
3992
|
children: [
|
|
3976
3993
|
(_.length > 0 || y.length > 0) && /* @__PURE__ */ G("div", {
|
|
3977
3994
|
className: "flex gap-3 overflow-x-auto custom-scrollbar px-3 pt-3 pb-1",
|
|
3978
|
-
children: [y.map((e) => /* @__PURE__ */ W(
|
|
3995
|
+
children: [y.map((e) => /* @__PURE__ */ W(cr, {
|
|
3979
3996
|
content: e,
|
|
3980
3997
|
onRemove: (e) => b((t) => t.filter((t) => t.id !== e))
|
|
3981
|
-
}, e.id)), _.map((e) => /* @__PURE__ */ W(
|
|
3998
|
+
}, e.id)), _.map((e) => /* @__PURE__ */ W(sr, {
|
|
3982
3999
|
file: e,
|
|
3983
4000
|
onRemove: (e) => v((t) => t.filter((t) => t.id !== e))
|
|
3984
4001
|
}, e.id))]
|
|
3985
4002
|
}),
|
|
3986
4003
|
k && /* @__PURE__ */ W("div", {
|
|
3987
4004
|
className: "px-3 pt-2",
|
|
3988
|
-
children: /* @__PURE__ */ W(
|
|
4005
|
+
children: /* @__PURE__ */ W(Cr, {
|
|
3989
4006
|
active: k,
|
|
3990
4007
|
mode: "static",
|
|
3991
4008
|
height: 48,
|
|
@@ -4000,7 +4017,7 @@ var Cr = [
|
|
|
4000
4017
|
/* @__PURE__ */ G("div", {
|
|
4001
4018
|
className: "flex items-center gap-2 p-3",
|
|
4002
4019
|
children: [
|
|
4003
|
-
/* @__PURE__ */ W(
|
|
4020
|
+
/* @__PURE__ */ W(Sr, {
|
|
4004
4021
|
onFileSelect: S,
|
|
4005
4022
|
disabled: t
|
|
4006
4023
|
}),
|
|
@@ -4031,12 +4048,12 @@ var Cr = [
|
|
|
4031
4048
|
overflow: "hidden",
|
|
4032
4049
|
textOverflow: "ellipsis"
|
|
4033
4050
|
},
|
|
4034
|
-
variants:
|
|
4051
|
+
variants: Tr,
|
|
4035
4052
|
initial: "initial",
|
|
4036
4053
|
animate: "animate",
|
|
4037
4054
|
exit: "exit",
|
|
4038
|
-
children:
|
|
4039
|
-
variants:
|
|
4055
|
+
children: wr[M].split("").map((e, t) => /* @__PURE__ */ W(lt.span, {
|
|
4056
|
+
variants: Er,
|
|
4040
4057
|
style: { display: "inline-block" },
|
|
4041
4058
|
children: e === " " ? "\xA0" : e
|
|
4042
4059
|
}, t))
|
|
@@ -4194,35 +4211,35 @@ var Cr = [
|
|
|
4194
4211
|
};
|
|
4195
4212
|
//#endregion
|
|
4196
4213
|
//#region src/ui/dialog.tsx
|
|
4197
|
-
function
|
|
4214
|
+
function Or({ ...e }) {
|
|
4198
4215
|
return /* @__PURE__ */ W(vt.Root, {
|
|
4199
4216
|
"data-slot": "dialog",
|
|
4200
4217
|
...e
|
|
4201
4218
|
});
|
|
4202
4219
|
}
|
|
4203
|
-
function
|
|
4220
|
+
function kr({ ...e }) {
|
|
4204
4221
|
return /* @__PURE__ */ W(vt.Trigger, {
|
|
4205
4222
|
"data-slot": "dialog-trigger",
|
|
4206
4223
|
...e
|
|
4207
4224
|
});
|
|
4208
4225
|
}
|
|
4209
|
-
function
|
|
4226
|
+
function Ar({ ...e }) {
|
|
4210
4227
|
return /* @__PURE__ */ W(vt.Portal, {
|
|
4211
4228
|
"data-slot": "dialog-portal",
|
|
4212
4229
|
...e
|
|
4213
4230
|
});
|
|
4214
4231
|
}
|
|
4215
|
-
function
|
|
4232
|
+
function jr({ className: e, ...t }) {
|
|
4216
4233
|
return /* @__PURE__ */ W(vt.Overlay, {
|
|
4217
4234
|
"data-slot": "dialog-overlay",
|
|
4218
4235
|
className: J("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs", e),
|
|
4219
4236
|
...t
|
|
4220
4237
|
});
|
|
4221
4238
|
}
|
|
4222
|
-
function
|
|
4223
|
-
return /* @__PURE__ */ G(
|
|
4239
|
+
function Mr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
|
|
4240
|
+
return /* @__PURE__ */ G(Ar, {
|
|
4224
4241
|
"data-slot": "dialog-portal",
|
|
4225
|
-
children: [/* @__PURE__ */ W(
|
|
4242
|
+
children: [/* @__PURE__ */ W(jr, {}), /* @__PURE__ */ G(vt.Content, {
|
|
4226
4243
|
"data-slot": "dialog-content",
|
|
4227
4244
|
"aria-describedby": r["aria-describedby"] ?? void 0,
|
|
4228
4245
|
className: J("z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200", e),
|
|
@@ -4237,14 +4254,14 @@ function jr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
|
|
|
4237
4254
|
})]
|
|
4238
4255
|
});
|
|
4239
4256
|
}
|
|
4240
|
-
function
|
|
4257
|
+
function Nr({ className: e, ...t }) {
|
|
4241
4258
|
return /* @__PURE__ */ W(vt.Title, {
|
|
4242
4259
|
"data-slot": "dialog-title",
|
|
4243
4260
|
className: J("text-lg leading-none font-semibold", e),
|
|
4244
4261
|
...t
|
|
4245
4262
|
});
|
|
4246
4263
|
}
|
|
4247
|
-
function
|
|
4264
|
+
function Pr({ className: e, ...t }) {
|
|
4248
4265
|
return /* @__PURE__ */ W(vt.Description, {
|
|
4249
4266
|
"data-slot": "dialog-description",
|
|
4250
4267
|
className: J("text-muted-foreground text-sm", e),
|
|
@@ -4253,7 +4270,7 @@ function Nr({ className: e, ...t }) {
|
|
|
4253
4270
|
}
|
|
4254
4271
|
//#endregion
|
|
4255
4272
|
//#region src/ui/visually-hidden.tsx
|
|
4256
|
-
var
|
|
4273
|
+
var Fr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ W("span", {
|
|
4257
4274
|
ref: n,
|
|
4258
4275
|
className: J("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", e),
|
|
4259
4276
|
style: {
|
|
@@ -4262,17 +4279,17 @@ var Pr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ W("span", {
|
|
|
4262
4279
|
},
|
|
4263
4280
|
...t
|
|
4264
4281
|
}));
|
|
4265
|
-
|
|
4282
|
+
Fr.displayName = "VisuallyHidden";
|
|
4266
4283
|
//#endregion
|
|
4267
4284
|
//#region src/components/ArticleReader/ArticlePanelHeader.tsx
|
|
4268
|
-
var
|
|
4285
|
+
var Ir = ({ onClose: e }) => /* @__PURE__ */ W("div", {
|
|
4269
4286
|
className: "flex items-center justify-between bg-secondary px-4 py-3 border-b border-border",
|
|
4270
4287
|
children: /* @__PURE__ */ W("button", {
|
|
4271
4288
|
onClick: e,
|
|
4272
4289
|
className: "rounded-md p-1 hover:bg-accent transition-colors",
|
|
4273
4290
|
children: /* @__PURE__ */ W(Pe, { className: "h-5 w-5" })
|
|
4274
4291
|
})
|
|
4275
|
-
}),
|
|
4292
|
+
}), Lr = gt("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
4276
4293
|
variants: {
|
|
4277
4294
|
variant: {
|
|
4278
4295
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -4294,10 +4311,10 @@ var Fr = ({ onClose: e }) => /* @__PURE__ */ W("div", {
|
|
|
4294
4311
|
size: "default"
|
|
4295
4312
|
}
|
|
4296
4313
|
});
|
|
4297
|
-
function
|
|
4314
|
+
function Rr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
4298
4315
|
return /* @__PURE__ */ W(r ? ht : "button", {
|
|
4299
4316
|
"data-slot": "button",
|
|
4300
|
-
className: J(
|
|
4317
|
+
className: J(Lr({
|
|
4301
4318
|
variant: t,
|
|
4302
4319
|
size: n,
|
|
4303
4320
|
className: e
|
|
@@ -4307,10 +4324,10 @@ function Lr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
|
4307
4324
|
}
|
|
4308
4325
|
//#endregion
|
|
4309
4326
|
//#region src/components/ArticleReader/ArticleActionButtons.tsx
|
|
4310
|
-
var
|
|
4327
|
+
var zr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80 hover:text-foreground text-muted-foreground"), Br = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavorited: r, isHighlightMode: i, articleUrl: a, onAskClick: o, onSuggestClick: s, onCopyClick: c, onFavoriteClick: l, onHighlightToggle: u, onClose: d }) => /* @__PURE__ */ G("div", {
|
|
4311
4328
|
className: "flex flex-nowrap items-center gap-1 rounded-2xl border border-muted bg-gradient-to-b from-background to-muted/30 p-1 shadow-sm",
|
|
4312
4329
|
children: [
|
|
4313
|
-
/* @__PURE__ */ G(
|
|
4330
|
+
/* @__PURE__ */ G(Rr, {
|
|
4314
4331
|
onClick: o,
|
|
4315
4332
|
disabled: e,
|
|
4316
4333
|
variant: "ghost",
|
|
@@ -4321,7 +4338,7 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4321
4338
|
children: e ? "..." : "Ask"
|
|
4322
4339
|
})]
|
|
4323
4340
|
}),
|
|
4324
|
-
/* @__PURE__ */ G(
|
|
4341
|
+
/* @__PURE__ */ G(Rr, {
|
|
4325
4342
|
onClick: s,
|
|
4326
4343
|
disabled: t,
|
|
4327
4344
|
variant: "ghost",
|
|
@@ -4332,15 +4349,15 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4332
4349
|
children: "Suggest"
|
|
4333
4350
|
})]
|
|
4334
4351
|
}),
|
|
4335
|
-
/* @__PURE__ */ W(
|
|
4352
|
+
/* @__PURE__ */ W(Rr, {
|
|
4336
4353
|
onClick: c,
|
|
4337
4354
|
variant: "ghost",
|
|
4338
4355
|
size: "icon",
|
|
4339
|
-
className:
|
|
4356
|
+
className: zr,
|
|
4340
4357
|
title: "Copy article",
|
|
4341
4358
|
children: /* @__PURE__ */ W(F, { className: "size-4" })
|
|
4342
4359
|
}),
|
|
4343
|
-
/* @__PURE__ */ W(
|
|
4360
|
+
/* @__PURE__ */ W(Rr, {
|
|
4344
4361
|
onClick: u,
|
|
4345
4362
|
variant: "ghost",
|
|
4346
4363
|
size: "icon",
|
|
@@ -4348,7 +4365,7 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4348
4365
|
title: i ? "Disable highlighting" : "Enable highlighting",
|
|
4349
4366
|
children: /* @__PURE__ */ W(le, { className: "size-4" })
|
|
4350
4367
|
}),
|
|
4351
|
-
/* @__PURE__ */ W(
|
|
4368
|
+
/* @__PURE__ */ W(Rr, {
|
|
4352
4369
|
onClick: l,
|
|
4353
4370
|
disabled: n,
|
|
4354
4371
|
variant: "ghost",
|
|
@@ -4357,11 +4374,11 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4357
4374
|
title: r ? "Remove from favorites" : "Add to favorites",
|
|
4358
4375
|
children: /* @__PURE__ */ W(Ee, { className: J("size-4", r && "fill-yellow-400") })
|
|
4359
4376
|
}),
|
|
4360
|
-
a && /* @__PURE__ */ W(
|
|
4377
|
+
a && /* @__PURE__ */ W(Rr, {
|
|
4361
4378
|
asChild: !0,
|
|
4362
4379
|
variant: "ghost",
|
|
4363
4380
|
size: "icon",
|
|
4364
|
-
className:
|
|
4381
|
+
className: zr,
|
|
4365
4382
|
title: "Open in new tab",
|
|
4366
4383
|
children: /* @__PURE__ */ W("a", {
|
|
4367
4384
|
href: a,
|
|
@@ -4370,16 +4387,16 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4370
4387
|
children: /* @__PURE__ */ W(V, { className: "size-4" })
|
|
4371
4388
|
})
|
|
4372
4389
|
}),
|
|
4373
|
-
/* @__PURE__ */ W(
|
|
4390
|
+
/* @__PURE__ */ W(Rr, {
|
|
4374
4391
|
onClick: d,
|
|
4375
4392
|
variant: "ghost",
|
|
4376
4393
|
size: "icon",
|
|
4377
|
-
className: J(
|
|
4394
|
+
className: J(zr, "ml-auto"),
|
|
4378
4395
|
title: "Close",
|
|
4379
4396
|
children: /* @__PURE__ */ W(Pe, { className: "size-4" })
|
|
4380
4397
|
})
|
|
4381
4398
|
]
|
|
4382
|
-
}),
|
|
4399
|
+
}), Vr = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ W("div", {
|
|
4383
4400
|
className: "relative",
|
|
4384
4401
|
children: /* @__PURE__ */ W("input", {
|
|
4385
4402
|
value: e,
|
|
@@ -4389,7 +4406,7 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4389
4406
|
placeholder: "Ask AI any question...",
|
|
4390
4407
|
className: "w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
4391
4408
|
})
|
|
4392
|
-
}),
|
|
4409
|
+
}), Hr = ({ questions: e, isLoading: n, error: i, onQuestionClick: a }) => {
|
|
4393
4410
|
let o = r.useMemo(() => {
|
|
4394
4411
|
let t = [];
|
|
4395
4412
|
return e.forEach((e) => {
|
|
@@ -4426,7 +4443,7 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4426
4443
|
children: i
|
|
4427
4444
|
})
|
|
4428
4445
|
] });
|
|
4429
|
-
},
|
|
4446
|
+
}, Ur = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ G(U, { children: [
|
|
4430
4447
|
t && /* @__PURE__ */ W("div", {
|
|
4431
4448
|
className: "flex justify-center",
|
|
4432
4449
|
children: /* @__PURE__ */ W("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" })
|
|
@@ -4440,7 +4457,7 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4440
4457
|
className: "bg-red-500 text-white p-2 rounded-md text-sm",
|
|
4441
4458
|
children: n
|
|
4442
4459
|
})
|
|
4443
|
-
] }),
|
|
4460
|
+
] }), Wr = ({ html: e, isHighlightMode: t = !1 }) => {
|
|
4444
4461
|
let [n, r] = p("");
|
|
4445
4462
|
return u(() => {
|
|
4446
4463
|
r(yt.sanitize(e || "", {
|
|
@@ -4451,7 +4468,7 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4451
4468
|
className: `prose prose-neutral dark:prose-invert max-w-none ${t ? "select-text" : ""}`,
|
|
4452
4469
|
dangerouslySetInnerHTML: { __html: n }
|
|
4453
4470
|
});
|
|
4454
|
-
},
|
|
4471
|
+
}, Gr = ({ article: e, isHighlightMode: t }) => /* @__PURE__ */ W("div", {
|
|
4455
4472
|
className: "border-t border-border pt-6",
|
|
4456
4473
|
children: /* @__PURE__ */ G("div", { children: [
|
|
4457
4474
|
/* @__PURE__ */ W("div", { className: "flex items-start justify-between mb-2" }),
|
|
@@ -4472,23 +4489,23 @@ var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4472
4489
|
}),
|
|
4473
4490
|
/* @__PURE__ */ W("div", {
|
|
4474
4491
|
id: "article-content",
|
|
4475
|
-
children: /* @__PURE__ */ W(
|
|
4492
|
+
children: /* @__PURE__ */ W(Wr, {
|
|
4476
4493
|
html: e.html || "",
|
|
4477
4494
|
isHighlightMode: t
|
|
4478
4495
|
})
|
|
4479
4496
|
})
|
|
4480
4497
|
] })
|
|
4481
|
-
}),
|
|
4482
|
-
function
|
|
4498
|
+
}), Kr = /(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g, qr = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
|
|
4499
|
+
function Jr(e) {
|
|
4483
4500
|
return e.includes("](") || e.includes(")[") ? !1 : /\.(com|org|net|io|dev|co|uk|de|fr|it|es|jp|cn|in|br|au|ca|us|gov|edu|mil|int|xyz|info|app|tech|online|site|website|store|shop|blog|news|tv|me|cc|ws|name|mobi|asia|tel|travel|jobs|pro|museum|coop|aero|arpa|biz|cat|jobs|post|tel|xxx|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)(?:\/|$)/i.test(e);
|
|
4484
4501
|
}
|
|
4485
|
-
function
|
|
4502
|
+
function Yr(e) {
|
|
4486
4503
|
return /^https?:\/\//i.test(e) ? e : `https://${e}`;
|
|
4487
4504
|
}
|
|
4488
|
-
function
|
|
4505
|
+
function Xr(e) {
|
|
4489
4506
|
if (!e || typeof e != "string") return e;
|
|
4490
4507
|
let t = e, n = [], r;
|
|
4491
|
-
for (
|
|
4508
|
+
for (qr.lastIndex = 0; (r = qr.exec(t)) !== null;) {
|
|
4492
4509
|
let e = r[0], i = r.index, a = t.substring(0, i), o = t.substring(i + e.length);
|
|
4493
4510
|
!a.endsWith("](") && !o.startsWith(")") && n.push({
|
|
4494
4511
|
email: e,
|
|
@@ -4500,9 +4517,9 @@ function Yr(e) {
|
|
|
4500
4517
|
t = t.substring(0, i) + `[${r}](mailto:${r})` + t.substring(i + r.length);
|
|
4501
4518
|
}
|
|
4502
4519
|
let i = [], a;
|
|
4503
|
-
for (
|
|
4520
|
+
for (Kr.lastIndex = 0; (a = Kr.exec(t)) !== null;) {
|
|
4504
4521
|
let e = a[0], n = a.index;
|
|
4505
|
-
if (
|
|
4522
|
+
if (qr.test(e)) continue;
|
|
4506
4523
|
let r = t.substring(0, n), o = t.substring(n + e.length);
|
|
4507
4524
|
if (r.endsWith("](") || o.startsWith(")") || (r.match(/```/g) || []).length % 2 != 0) continue;
|
|
4508
4525
|
let s = r.lastIndexOf("`");
|
|
@@ -4510,23 +4527,23 @@ function Yr(e) {
|
|
|
4510
4527
|
let e = t.substring(s + 1).indexOf("`");
|
|
4511
4528
|
if (e !== -1 && e > n - s - 1) continue;
|
|
4512
4529
|
}
|
|
4513
|
-
|
|
4530
|
+
Jr(e) && i.push({
|
|
4514
4531
|
url: e,
|
|
4515
4532
|
index: n
|
|
4516
4533
|
});
|
|
4517
4534
|
}
|
|
4518
4535
|
for (let e = i.length - 1; e >= 0; e--) {
|
|
4519
|
-
let { url: n, index: r } = i[e], a =
|
|
4536
|
+
let { url: n, index: r } = i[e], a = Yr(n);
|
|
4520
4537
|
t = t.substring(0, r) + `[${n}](${a})` + t.substring(r + n.length);
|
|
4521
4538
|
}
|
|
4522
4539
|
return t;
|
|
4523
4540
|
}
|
|
4524
4541
|
//#endregion
|
|
4525
4542
|
//#region src/components/ArticleReader/unified-markdown.tsx
|
|
4526
|
-
function
|
|
4543
|
+
function Zr(e) {
|
|
4527
4544
|
return !e || e.startsWith("http://") || e.startsWith("https://") || e.includes("://") ? !1 : e.startsWith("/") || e.startsWith("#");
|
|
4528
4545
|
}
|
|
4529
|
-
function
|
|
4546
|
+
function Qr(e, t) {
|
|
4530
4547
|
if (t.startsWith("#")) {
|
|
4531
4548
|
e.preventDefault();
|
|
4532
4549
|
let n = t.substring(1), r = document.getElementById(n);
|
|
@@ -4536,7 +4553,7 @@ function Zr(e, t) {
|
|
|
4536
4553
|
});
|
|
4537
4554
|
}
|
|
4538
4555
|
}
|
|
4539
|
-
function
|
|
4556
|
+
function $r({ code: e }) {
|
|
4540
4557
|
let [t, n] = p(!1);
|
|
4541
4558
|
return /* @__PURE__ */ W("button", {
|
|
4542
4559
|
onClick: c(async () => {
|
|
@@ -4551,7 +4568,7 @@ function Qr({ code: e }) {
|
|
|
4551
4568
|
children: t ? /* @__PURE__ */ W(k, { className: "h-4 w-4 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ W(B, { className: "h-4 w-4" })
|
|
4552
4569
|
});
|
|
4553
4570
|
}
|
|
4554
|
-
function
|
|
4571
|
+
function ei({ children: e }) {
|
|
4555
4572
|
let t = f(null), [n, r] = p("");
|
|
4556
4573
|
return u(() => {
|
|
4557
4574
|
if (t.current) {
|
|
@@ -4567,15 +4584,15 @@ function $r({ children: e }) {
|
|
|
4567
4584
|
ref: t,
|
|
4568
4585
|
className: J("p-4 rounded-xl overflow-x-auto", "bg-zinc-100 dark:bg-zinc-900", "border border-zinc-200 dark:border-zinc-800", "text-[13px] font-mono leading-relaxed", "text-zinc-800 dark:text-zinc-200", "[&_code]:bg-transparent [&_code]:text-inherit [&_code]:p-0"),
|
|
4569
4586
|
children: e
|
|
4570
|
-
}), n && /* @__PURE__ */ W(
|
|
4587
|
+
}), n && /* @__PURE__ */ W($r, { code: n })]
|
|
4571
4588
|
});
|
|
4572
4589
|
}
|
|
4573
|
-
var
|
|
4590
|
+
var ti = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
4574
4591
|
if (!e) return /* @__PURE__ */ W("div", {
|
|
4575
4592
|
className: J("text-muted-foreground text-sm", t),
|
|
4576
4593
|
children: "No content"
|
|
4577
4594
|
});
|
|
4578
|
-
let r =
|
|
4595
|
+
let r = Xr(e);
|
|
4579
4596
|
return /* @__PURE__ */ W("div", {
|
|
4580
4597
|
className: J("kortix-markdown", t),
|
|
4581
4598
|
children: /* @__PURE__ */ W(xt, {
|
|
@@ -4622,10 +4639,10 @@ var ei = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4622
4639
|
children: e
|
|
4623
4640
|
}),
|
|
4624
4641
|
a: ({ href: e, children: t }) => {
|
|
4625
|
-
let n =
|
|
4642
|
+
let n = Zr(e), r = e?.startsWith("#"), i = J("font-medium text-foreground", "underline decoration-foreground/30 underline-offset-[3px] decoration-[1px]", "hover:decoration-foreground/60 transition-colors duration-150");
|
|
4626
4643
|
return r ? /* @__PURE__ */ W("a", {
|
|
4627
4644
|
href: e,
|
|
4628
|
-
onClick: (t) =>
|
|
4645
|
+
onClick: (t) => Qr(t, e),
|
|
4629
4646
|
className: i,
|
|
4630
4647
|
children: t
|
|
4631
4648
|
}) : n ? /* @__PURE__ */ W(bt, {
|
|
@@ -4647,7 +4664,7 @@ var ei = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4647
4664
|
className: "px-2 py-1 rounded-md text-[13px] font-mono bg-card dark:bg-[#161618] border border-neutral-200 dark:border-neutral-700/50 text-foreground",
|
|
4648
4665
|
children: e
|
|
4649
4666
|
}),
|
|
4650
|
-
pre: ({ children: e }) => /* @__PURE__ */ W(
|
|
4667
|
+
pre: ({ children: e }) => /* @__PURE__ */ W(ei, { children: e }),
|
|
4651
4668
|
blockquote: ({ children: e }) => /* @__PURE__ */ W("blockquote", {
|
|
4652
4669
|
className: J("my-5 pl-4 py-1 text-sm", "border-l-2 border-border", "text-muted-foreground", "[&>p]:my-2"),
|
|
4653
4670
|
children: e
|
|
@@ -4728,11 +4745,11 @@ var ei = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4728
4745
|
})
|
|
4729
4746
|
});
|
|
4730
4747
|
});
|
|
4731
|
-
|
|
4748
|
+
ti.displayName = "UnifiedMarkdown";
|
|
4732
4749
|
//#endregion
|
|
4733
4750
|
//#region src/components/ArticleReader/ArticleExtractPanel.tsx
|
|
4734
|
-
var
|
|
4735
|
-
let { isOpen: n, url: r, searchText: i, panelWidth: a, setPanelWidth: o, closePanel: s } =
|
|
4751
|
+
var ni = (e) => {
|
|
4752
|
+
let { isOpen: n, url: r, searchText: i, panelWidth: a, setPanelWidth: o, closePanel: s } = Et(), { isAuthenticated: c } = Cn(), { chatModelProvider: l } = bn(), d = e.isOpen === void 0 ? n : e.isOpen, m = e.onClose || s, h = e.url || r, g = e.searchText === void 0 ? i : e.searchText, [_, v] = p(null), [y, b] = p([]), [x, S] = p(!1), [C, w] = p(t.defaultSummarizePrompt), [T, E] = p(!1), [D, O] = p(!1), [k, A] = p(!1), [j, M] = p(""), [N, P] = p(""), [F, I] = p([]), [L, R] = p(""), [z, B] = p(!1), [ee, te] = p(!1), [V, ne] = p(!1), [re, ie] = p(!1), [ae, oe] = p(a), [se, ce] = p(!1), [le, ue] = p(!1), de = f(null);
|
|
4736
4753
|
u(() => {
|
|
4737
4754
|
let e = () => {
|
|
4738
4755
|
ie(window.innerWidth >= 1024);
|
|
@@ -4904,7 +4921,7 @@ var ti = (e) => {
|
|
|
4904
4921
|
children: [/* @__PURE__ */ G("div", {
|
|
4905
4922
|
className: "space-y-4",
|
|
4906
4923
|
children: [
|
|
4907
|
-
/* @__PURE__ */ W(
|
|
4924
|
+
/* @__PURE__ */ W(Br, {
|
|
4908
4925
|
isLoadingAI: D,
|
|
4909
4926
|
isLoadingFollowups: k,
|
|
4910
4927
|
isLoadingFavorite: ee,
|
|
@@ -4922,12 +4939,12 @@ var ti = (e) => {
|
|
|
4922
4939
|
className: "bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg",
|
|
4923
4940
|
children: "Copied!"
|
|
4924
4941
|
}),
|
|
4925
|
-
/* @__PURE__ */ W(
|
|
4942
|
+
/* @__PURE__ */ W(Vr, {
|
|
4926
4943
|
value: C,
|
|
4927
4944
|
onChange: w,
|
|
4928
4945
|
onSubmit: () => me("question")
|
|
4929
4946
|
}),
|
|
4930
|
-
/* @__PURE__ */ W(
|
|
4947
|
+
/* @__PURE__ */ W(Hr, {
|
|
4931
4948
|
questions: F,
|
|
4932
4949
|
isLoading: k,
|
|
4933
4950
|
error: L,
|
|
@@ -4958,7 +4975,7 @@ var ti = (e) => {
|
|
|
4958
4975
|
})
|
|
4959
4976
|
}, t))
|
|
4960
4977
|
}),
|
|
4961
|
-
(D || j && y.length === 0) && /* @__PURE__ */ W(
|
|
4978
|
+
(D || j && y.length === 0) && /* @__PURE__ */ W(Ur, {
|
|
4962
4979
|
response: j,
|
|
4963
4980
|
isLoading: D,
|
|
4964
4981
|
error: N
|
|
@@ -4968,7 +4985,7 @@ var ti = (e) => {
|
|
|
4968
4985
|
children: N
|
|
4969
4986
|
})
|
|
4970
4987
|
]
|
|
4971
|
-
}), _ && /* @__PURE__ */ W(
|
|
4988
|
+
}), _ && /* @__PURE__ */ W(Gr, {
|
|
4972
4989
|
article: _,
|
|
4973
4990
|
isHighlightMode: V
|
|
4974
4991
|
})]
|
|
@@ -4985,20 +5002,20 @@ var ti = (e) => {
|
|
|
4985
5002
|
style: { touchAction: "none" },
|
|
4986
5003
|
children: /* @__PURE__ */ W("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-1 h-12 rounded-full bg-muted-foreground opacity-50 hover:opacity-100 transition-opacity" })
|
|
4987
5004
|
}), _e()]
|
|
4988
|
-
}) : /* @__PURE__ */ W(
|
|
5005
|
+
}) : /* @__PURE__ */ W(Or, {
|
|
4989
5006
|
open: d,
|
|
4990
5007
|
onOpenChange: (e) => !e && m(),
|
|
4991
|
-
children: /* @__PURE__ */ G(
|
|
5008
|
+
children: /* @__PURE__ */ G(Mr, {
|
|
4992
5009
|
className: "pointer-events-auto fixed inset-0 !top-0 !left-0 !translate-x-0 !translate-y-0 h-full w-full max-w-none p-0 m-0 rounded-none border-0 overflow-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
|
|
4993
5010
|
hideCloseButton: !0,
|
|
4994
|
-
children: [/* @__PURE__ */ W(
|
|
5011
|
+
children: [/* @__PURE__ */ W(Fr, { children: /* @__PURE__ */ W(Nr, { children: "Article Details" }) }), /* @__PURE__ */ W("div", {
|
|
4995
5012
|
className: "h-full overflow-y-auto",
|
|
4996
5013
|
children: _e()
|
|
4997
5014
|
})]
|
|
4998
5015
|
})
|
|
4999
5016
|
});
|
|
5000
|
-
},
|
|
5001
|
-
let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } =
|
|
5017
|
+
}, ri = () => {
|
|
5018
|
+
let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } = bn(), { isOpen: c, panelWidth: l } = Et(), { isAuthenticated: d } = Cn(), [m, h] = p(!1), g = f(null), _ = f(null), v = f(!1);
|
|
5002
5019
|
return u(() => {
|
|
5003
5020
|
let e = () => {
|
|
5004
5021
|
h(window.innerWidth >= 1024);
|
|
@@ -5019,7 +5036,7 @@ var ti = (e) => {
|
|
|
5019
5036
|
children: [
|
|
5020
5037
|
e.map((t, n) => {
|
|
5021
5038
|
let r = n === e.length - 1;
|
|
5022
|
-
return /* @__PURE__ */ G(i, { children: [/* @__PURE__ */ W(
|
|
5039
|
+
return /* @__PURE__ */ G(i, { children: [/* @__PURE__ */ W(ar, {
|
|
5023
5040
|
section: t,
|
|
5024
5041
|
sectionIndex: n,
|
|
5025
5042
|
dividerRef: r ? g : void 0,
|
|
@@ -5050,13 +5067,13 @@ var ti = (e) => {
|
|
|
5050
5067
|
]
|
|
5051
5068
|
}), /* @__PURE__ */ W("div", {
|
|
5052
5069
|
className: "sticky bottom-[60px] md:bottom-0 z-40 bg-gradient-to-t from-background via-background to-transparent pt-4 pb-2",
|
|
5053
|
-
children: /* @__PURE__ */ W(
|
|
5070
|
+
children: /* @__PURE__ */ W(Dr, {})
|
|
5054
5071
|
})]
|
|
5055
|
-
}), /* @__PURE__ */ W(
|
|
5072
|
+
}), /* @__PURE__ */ W(ni, {})] });
|
|
5056
5073
|
};
|
|
5057
5074
|
//#endregion
|
|
5058
5075
|
//#region src/ui/gradient-blur.tsx
|
|
5059
|
-
function
|
|
5076
|
+
function ii({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
|
|
5060
5077
|
let a = f(null), o = f({
|
|
5061
5078
|
x: 0,
|
|
5062
5079
|
y: 0
|
|
@@ -5116,28 +5133,28 @@ function ri({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "tran
|
|
|
5116
5133
|
}
|
|
5117
5134
|
//#endregion
|
|
5118
5135
|
//#region src/components/ChatHistoryDropdown/useHistoryState.ts
|
|
5119
|
-
var
|
|
5120
|
-
function
|
|
5136
|
+
var ai = "qwksearch_pinned_chats";
|
|
5137
|
+
function oi() {
|
|
5121
5138
|
if (typeof window > "u") return [];
|
|
5122
5139
|
try {
|
|
5123
|
-
let e = localStorage.getItem(
|
|
5140
|
+
let e = localStorage.getItem(ai);
|
|
5124
5141
|
return e ? JSON.parse(e) : [];
|
|
5125
5142
|
} catch {
|
|
5126
5143
|
return [];
|
|
5127
5144
|
}
|
|
5128
5145
|
}
|
|
5129
|
-
function
|
|
5130
|
-
typeof window > "u" || localStorage.setItem(
|
|
5146
|
+
function si(e) {
|
|
5147
|
+
typeof window > "u" || localStorage.setItem(ai, JSON.stringify(e));
|
|
5131
5148
|
}
|
|
5132
|
-
function
|
|
5133
|
-
let [e, t] = p([]), [n, r] = p(!0), [i, a] = p(!1), [o, s] = p(null), [l, f] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p([]), [b, x] = p(""), [S, C] = p([]), [w, T] = p(!1), { isAuthenticated: E, isLoading: D } =
|
|
5149
|
+
function ci() {
|
|
5150
|
+
let [e, t] = p([]), [n, r] = p(!0), [i, a] = p(!1), [o, s] = p(null), [l, f] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p([]), [b, x] = p(""), [S, C] = p([]), [w, T] = p(!1), { isAuthenticated: E, isLoading: D } = Cn(), { incognito: O, setIncognito: k } = bn();
|
|
5134
5151
|
u(() => {
|
|
5135
|
-
y(
|
|
5152
|
+
y(oi());
|
|
5136
5153
|
}, []);
|
|
5137
5154
|
let A = c((e, t) => {
|
|
5138
5155
|
e.preventDefault(), e.stopPropagation(), y((e) => {
|
|
5139
5156
|
let n = e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
|
|
5140
|
-
return
|
|
5157
|
+
return si(n), n;
|
|
5141
5158
|
});
|
|
5142
5159
|
}, []), j = d(() => [...e].sort((e, t) => {
|
|
5143
5160
|
let n = v.includes(e.id), r = v.includes(t.id);
|
|
@@ -5153,7 +5170,7 @@ function si() {
|
|
|
5153
5170
|
if (E) {
|
|
5154
5171
|
let { data: e, error: n } = await Ze();
|
|
5155
5172
|
if (n && n.status === 401) {
|
|
5156
|
-
let e =
|
|
5173
|
+
let e = rn().map((e) => ({
|
|
5157
5174
|
...e,
|
|
5158
5175
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0
|
|
5159
5176
|
}));
|
|
@@ -5163,7 +5180,7 @@ function si() {
|
|
|
5163
5180
|
if (n) throw Error(`Failed to fetch chats: ${n.message}`);
|
|
5164
5181
|
t(Array.isArray(e?.chats) ? e.chats : []);
|
|
5165
5182
|
} else {
|
|
5166
|
-
let e =
|
|
5183
|
+
let e = rn().map((e) => ({
|
|
5167
5184
|
...e,
|
|
5168
5185
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0
|
|
5169
5186
|
}));
|
|
@@ -5188,7 +5205,7 @@ function si() {
|
|
|
5188
5205
|
if (E) {
|
|
5189
5206
|
let { error: e } = await We({ path: { id: o } });
|
|
5190
5207
|
if (e) throw Error(`Failed to delete chat: ${e.message}`);
|
|
5191
|
-
} else
|
|
5208
|
+
} else sn(o);
|
|
5192
5209
|
t((e) => e.filter((e) => e.id !== o)), K.success("Chat deleted");
|
|
5193
5210
|
} catch (e) {
|
|
5194
5211
|
K.error(e.message || "Failed to delete chat");
|
|
@@ -5204,7 +5221,7 @@ function si() {
|
|
|
5204
5221
|
if (E) {
|
|
5205
5222
|
let { error: e } = await Ue();
|
|
5206
5223
|
if (e) throw Error(`Failed to clear history: ${e.message}`);
|
|
5207
|
-
} else
|
|
5224
|
+
} else cn();
|
|
5208
5225
|
t([]), K.success("All history cleared");
|
|
5209
5226
|
} catch (e) {
|
|
5210
5227
|
K.error(e.message || "Failed to clear history");
|
|
@@ -5225,7 +5242,7 @@ function si() {
|
|
|
5225
5242
|
if (n) throw Error(`Failed to search chats: ${n.message}`);
|
|
5226
5243
|
C(Array.isArray(t?.chats) ? t.chats : []);
|
|
5227
5244
|
} else {
|
|
5228
|
-
let t =
|
|
5245
|
+
let t = rn().filter((t) => {
|
|
5229
5246
|
let n = t.title.toLowerCase().includes(e.toLowerCase()), r = t.messages?.some((t) => "content" in t && t.content?.toLowerCase().includes(e.toLowerCase()));
|
|
5230
5247
|
return n || r;
|
|
5231
5248
|
});
|
|
@@ -5276,7 +5293,7 @@ function si() {
|
|
|
5276
5293
|
}
|
|
5277
5294
|
//#endregion
|
|
5278
5295
|
//#region src/components/ChatHistoryDropdown/HistoryHeader.tsx
|
|
5279
|
-
function
|
|
5296
|
+
function li({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
|
|
5280
5297
|
return /* @__PURE__ */ G("div", {
|
|
5281
5298
|
className: "mb-2 pb-2 border-b border-border space-y-2",
|
|
5282
5299
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -5323,7 +5340,7 @@ function ci({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
5323
5340
|
}
|
|
5324
5341
|
//#endregion
|
|
5325
5342
|
//#region src/components/ChatHistoryDropdown/HistoryChatItem.tsx
|
|
5326
|
-
function
|
|
5343
|
+
function ui({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
5327
5344
|
let i = e.messageCount ?? 0;
|
|
5328
5345
|
return /* @__PURE__ */ G("div", {
|
|
5329
5346
|
className: "group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200",
|
|
@@ -5333,12 +5350,12 @@ function li({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
|
5333
5350
|
className: "flex-1 min-w-0 flex items-center gap-1.5",
|
|
5334
5351
|
children: [/* @__PURE__ */ G("span", {
|
|
5335
5352
|
className: "flex items-center gap-1 shrink-0",
|
|
5336
|
-
children: [i > 0 && /* @__PURE__ */ G(
|
|
5353
|
+
children: [i > 0 && /* @__PURE__ */ G(rr, {
|
|
5337
5354
|
className: "px-1.5 py-0 text-[10px] font-medium bg-zinc-200 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-700 border-0 rounded-md",
|
|
5338
5355
|
children: [i, "Q"]
|
|
5339
|
-
}), /* @__PURE__ */ W(
|
|
5356
|
+
}), /* @__PURE__ */ W(rr, {
|
|
5340
5357
|
className: "px-1.5 py-0 text-[10px] font-medium bg-zinc-100 text-zinc-500 hover:bg-zinc-100 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-800 border-0 rounded-md",
|
|
5341
|
-
children:
|
|
5358
|
+
children: Ct(/* @__PURE__ */ new Date(), e.createdAt)
|
|
5342
5359
|
})]
|
|
5343
5360
|
}), /* @__PURE__ */ G("p", {
|
|
5344
5361
|
className: "text-xs text-popover-foreground truncate",
|
|
@@ -5365,20 +5382,20 @@ function li({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
|
5365
5382
|
}
|
|
5366
5383
|
//#endregion
|
|
5367
5384
|
//#region src/components/ChatHistoryDropdown/HistoryDialogs.tsx
|
|
5368
|
-
function
|
|
5369
|
-
return /* @__PURE__ */ W(
|
|
5385
|
+
function di({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
|
|
5386
|
+
return /* @__PURE__ */ W(Or, {
|
|
5370
5387
|
open: e,
|
|
5371
5388
|
onOpenChange: (e) => {
|
|
5372
5389
|
!e && !o && t(!1);
|
|
5373
5390
|
},
|
|
5374
|
-
children: /* @__PURE__ */ G(
|
|
5391
|
+
children: /* @__PURE__ */ G(Mr, {
|
|
5375
5392
|
className: "w-full max-w-md transform rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-left align-middle shadow-xl",
|
|
5376
5393
|
children: [
|
|
5377
|
-
/* @__PURE__ */ W(
|
|
5394
|
+
/* @__PURE__ */ W(Nr, {
|
|
5378
5395
|
className: "text-lg font-medium leading-6 dark:text-white",
|
|
5379
5396
|
children: n
|
|
5380
5397
|
}),
|
|
5381
|
-
/* @__PURE__ */ W(
|
|
5398
|
+
/* @__PURE__ */ W(Pr, {
|
|
5382
5399
|
className: "text-sm dark:text-white/70 text-black/70 mt-2",
|
|
5383
5400
|
children: r
|
|
5384
5401
|
}),
|
|
@@ -5401,8 +5418,8 @@ function ui({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
5401
5418
|
})
|
|
5402
5419
|
});
|
|
5403
5420
|
}
|
|
5404
|
-
function
|
|
5405
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(
|
|
5421
|
+
function fi({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
|
|
5422
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(di, {
|
|
5406
5423
|
open: e,
|
|
5407
5424
|
onOpenChange: (e) => {
|
|
5408
5425
|
t(e), e || r(null);
|
|
@@ -5413,7 +5430,7 @@ function di({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
5413
5430
|
loadingLabel: "Deleting...",
|
|
5414
5431
|
loading: i,
|
|
5415
5432
|
onConfirm: a
|
|
5416
|
-
}), /* @__PURE__ */ W(
|
|
5433
|
+
}), /* @__PURE__ */ W(di, {
|
|
5417
5434
|
open: o,
|
|
5418
5435
|
onOpenChange: s,
|
|
5419
5436
|
title: "Clear All History",
|
|
@@ -5426,13 +5443,13 @@ function di({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
5426
5443
|
}
|
|
5427
5444
|
//#endregion
|
|
5428
5445
|
//#region src/components/ChatHistoryDropdown/HistoryDropdown.tsx
|
|
5429
|
-
var
|
|
5446
|
+
var pi = {
|
|
5430
5447
|
Today: /* @__PURE__ */ W(Oe, { size: 12 }),
|
|
5431
5448
|
Yesterday: /* @__PURE__ */ W(L, { size: 12 }),
|
|
5432
5449
|
"This Week": /* @__PURE__ */ W(O, { size: 12 }),
|
|
5433
5450
|
Older: /* @__PURE__ */ W(S, { size: 12 })
|
|
5434
5451
|
};
|
|
5435
|
-
function
|
|
5452
|
+
function mi(e) {
|
|
5436
5453
|
let t = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), t.getDate()), r = /* @__PURE__ */ new Date(n.getTime() - 864e5), i = /* @__PURE__ */ new Date(n.getTime() - 6 * 864e5), a = {
|
|
5437
5454
|
Today: [],
|
|
5438
5455
|
Yesterday: [],
|
|
@@ -5453,19 +5470,19 @@ function pi(e) {
|
|
|
5453
5470
|
chats: a[e]
|
|
5454
5471
|
}));
|
|
5455
5472
|
}
|
|
5456
|
-
var
|
|
5457
|
-
let t =
|
|
5458
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
5473
|
+
var hi = ({ showLabel: e = !1 }) => {
|
|
5474
|
+
let t = ci();
|
|
5475
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(Or, { children: [/* @__PURE__ */ G(kr, {
|
|
5459
5476
|
className: e ? "inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150" : "p-2 text-muted-foreground rounded-2xl bg-background/60 backdrop-blur-md hover:bg-secondary/80 transition duration-200 hover:text-foreground border border-border/30",
|
|
5460
5477
|
children: [/* @__PURE__ */ W(ue, { size: e ? 14 : 18 }), e && /* @__PURE__ */ W("span", { children: "History" })]
|
|
5461
|
-
}), /* @__PURE__ */ G(
|
|
5478
|
+
}), /* @__PURE__ */ G(Mr, {
|
|
5462
5479
|
className: "max-w-[420px] p-3",
|
|
5463
5480
|
children: [
|
|
5464
|
-
/* @__PURE__ */ W(
|
|
5481
|
+
/* @__PURE__ */ W(Nr, {
|
|
5465
5482
|
className: "sr-only",
|
|
5466
5483
|
children: "Chat History"
|
|
5467
5484
|
}),
|
|
5468
|
-
/* @__PURE__ */ W(
|
|
5485
|
+
/* @__PURE__ */ W(li, {
|
|
5469
5486
|
incognito: t.incognito,
|
|
5470
5487
|
onToggleIncognito: t.toggleIncognito,
|
|
5471
5488
|
showClearAll: t.chats.length > 0 && !t.loading,
|
|
@@ -5503,15 +5520,15 @@ var mi = ({ showLabel: e = !1 }) => {
|
|
|
5503
5520
|
})
|
|
5504
5521
|
}) : /* @__PURE__ */ W("div", {
|
|
5505
5522
|
className: "space-y-1 max-h-[500px] overflow-y-auto",
|
|
5506
|
-
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ W(
|
|
5523
|
+
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ W(ui, {
|
|
5507
5524
|
chat: e,
|
|
5508
5525
|
isPinned: t.pinnedIds.includes(e.id),
|
|
5509
5526
|
onTogglePin: t.togglePin,
|
|
5510
5527
|
onDelete: t.handleDeleteClick
|
|
5511
|
-
}, e.id)) :
|
|
5528
|
+
}, e.id)) : mi(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("div", {
|
|
5512
5529
|
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider",
|
|
5513
|
-
children: [
|
|
5514
|
-
}), n.map((e) => /* @__PURE__ */ W(
|
|
5530
|
+
children: [pi[e], e]
|
|
5531
|
+
}), n.map((e) => /* @__PURE__ */ W(ui, {
|
|
5515
5532
|
chat: e,
|
|
5516
5533
|
isPinned: t.pinnedIds.includes(e.id),
|
|
5517
5534
|
onTogglePin: t.togglePin,
|
|
@@ -5527,7 +5544,7 @@ var mi = ({ showLabel: e = !1 }) => {
|
|
|
5527
5544
|
})
|
|
5528
5545
|
})
|
|
5529
5546
|
]
|
|
5530
|
-
})] }), /* @__PURE__ */ W(
|
|
5547
|
+
})] }), /* @__PURE__ */ W(fi, {
|
|
5531
5548
|
deleteDialogOpen: t.deleteDialogOpen,
|
|
5532
5549
|
setDeleteDialogOpen: t.setDeleteDialogOpen,
|
|
5533
5550
|
chatToDelete: t.chatToDelete,
|
|
@@ -5542,11 +5559,11 @@ var mi = ({ showLabel: e = !1 }) => {
|
|
|
5542
5559
|
};
|
|
5543
5560
|
//#endregion
|
|
5544
5561
|
//#region src/components/ChatConversation/RecentHistoryChips.tsx
|
|
5545
|
-
function
|
|
5546
|
-
let { chats: e, loading: t } =
|
|
5562
|
+
function gi() {
|
|
5563
|
+
let { chats: e, loading: t } = ci(), n = [...e].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()).slice(0, 3);
|
|
5547
5564
|
return t ? null : /* @__PURE__ */ G("div", {
|
|
5548
5565
|
className: "flex flex-row items-center justify-center gap-2 flex-wrap",
|
|
5549
|
-
children: [/* @__PURE__ */ W(
|
|
5566
|
+
children: [/* @__PURE__ */ W(hi, { showLabel: !0 }), n.map((e) => /* @__PURE__ */ W(bt, {
|
|
5550
5567
|
href: `/c/${e.id}`,
|
|
5551
5568
|
className: "px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150 truncate max-w-[160px]",
|
|
5552
5569
|
title: e.title,
|
|
@@ -5556,7 +5573,7 @@ function hi() {
|
|
|
5556
5573
|
}
|
|
5557
5574
|
//#endregion
|
|
5558
5575
|
//#region src/components/Footer.tsx
|
|
5559
|
-
function
|
|
5576
|
+
function _i({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
|
|
5560
5577
|
let [r, i] = p(!1), a = f(null);
|
|
5561
5578
|
u(() => {
|
|
5562
5579
|
if (!r) return;
|
|
@@ -5613,19 +5630,19 @@ function gi({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
5613
5630
|
}
|
|
5614
5631
|
//#endregion
|
|
5615
5632
|
//#region src/components/ChatConversation/background-art.ts
|
|
5616
|
-
function
|
|
5633
|
+
function vi() {
|
|
5617
5634
|
let e = /* @__PURE__ */ "hyZbH3n.mp4,iOeZcCk.mp4,dUZlxYE.mp4,GpWeP6E.gif,LuKUsLE.png,w7X11Dd.png,MHmVtCr.png,HmnUAee.png,vKP22VU.png,l1lsV39.png,Ku8F2qc.png,KUEXtwm.png,vvKFPmY.png,5p8eaEf.png,VAKuJcG.png,sTMPtQW.png,m0gHbZZ.png,cKu7dWQ.png,ogfefYD.png,ey5vAae.png,twuLrvk.png,ELILiYt.png,9el5qpP.png,Up6xTkk.png,W1XKBo0.png,1Y6xvW0.png,JXOytMz.png,DNiI6pp.png,XDv5s6p.jpeg,eRwiRJ9.jpeg,DRAfJoc.jpeg,ASVRQ1G.jpeg,35svwUT.jpeg,81xLiVI.jpeg,6kod2Em.jpeg,eU0C8zt.jpeg,Bv0PBY8.jpeg,DQNbjIZ.jpeg,2uACPqZ.jpeg,XEKltMF.jpeg,WHgLfBm.jpeg,QFYM0Fw.jpeg,K12HCao.jpeg,oN8rtsE.jpeg,9fGnrns.jpeg,2ONJJeW.jpeg,DO23Va7.jpeg,QaKeoXk.jpeg,QU5oCBR.jpeg,MhlYZmh.jpeg,ylL1ToB.jpeg,AWWsCv8.jpeg,Tk9Tzzj.jpeg".split(",");
|
|
5618
5635
|
return "https://i.imgur.com/" + e[Math.floor(Math.random() * e.length)];
|
|
5619
5636
|
}
|
|
5620
5637
|
//#endregion
|
|
5621
5638
|
//#region src/components/ChatConversation/ChatHomepage.tsx
|
|
5622
|
-
function
|
|
5623
|
-
let { sendMessage: e } =
|
|
5639
|
+
function yi() {
|
|
5640
|
+
let { sendMessage: e } = bn(), [n, r] = p(null), [i, a] = p(null), [o, s] = p(!1), [c, l] = p({ os: "" });
|
|
5624
5641
|
u(() => {
|
|
5625
5642
|
if (localStorage.getItem("showBackgroundArt") === "false") return;
|
|
5626
|
-
r(
|
|
5643
|
+
r(vi());
|
|
5627
5644
|
let e = setInterval(() => {
|
|
5628
|
-
let e =
|
|
5645
|
+
let e = vi();
|
|
5629
5646
|
a(e), s(!0), setTimeout(() => {
|
|
5630
5647
|
r(e), s(!1), a(null);
|
|
5631
5648
|
}, 1e3);
|
|
@@ -5657,7 +5674,7 @@ function vi() {
|
|
|
5657
5674
|
children: [
|
|
5658
5675
|
n && f(n, o ? "opacity-0" : "opacity-30"),
|
|
5659
5676
|
i && f(i, o ? "opacity-30" : "opacity-0"),
|
|
5660
|
-
/* @__PURE__ */ W(
|
|
5677
|
+
/* @__PURE__ */ W(ii, {})
|
|
5661
5678
|
]
|
|
5662
5679
|
}),
|
|
5663
5680
|
/* @__PURE__ */ W("div", {
|
|
@@ -5695,18 +5712,18 @@ function vi() {
|
|
|
5695
5712
|
}),
|
|
5696
5713
|
/* @__PURE__ */ G("div", {
|
|
5697
5714
|
className: "w-full max-w-2xl mt-8 space-y-2",
|
|
5698
|
-
children: [/* @__PURE__ */ W(
|
|
5715
|
+
children: [/* @__PURE__ */ W(gi, {}), /* @__PURE__ */ W(Dr, {})]
|
|
5699
5716
|
})
|
|
5700
5717
|
]
|
|
5701
5718
|
})
|
|
5702
5719
|
}),
|
|
5703
|
-
/* @__PURE__ */ W(
|
|
5720
|
+
/* @__PURE__ */ W(_i, { listFooterLinks: t.footerLinks })
|
|
5704
5721
|
]
|
|
5705
5722
|
});
|
|
5706
5723
|
}
|
|
5707
5724
|
//#endregion
|
|
5708
5725
|
//#region src/ui/Loader.tsx
|
|
5709
|
-
var
|
|
5726
|
+
var bi = () => /* @__PURE__ */ G("svg", {
|
|
5710
5727
|
"aria-hidden": "true",
|
|
5711
5728
|
className: "w-8 h-8 text-border fill-secondary animate-spin",
|
|
5712
5729
|
viewBox: "0 0 100 101",
|
|
@@ -5722,7 +5739,7 @@ var yi = () => /* @__PURE__ */ G("svg", {
|
|
|
5722
5739
|
});
|
|
5723
5740
|
//#endregion
|
|
5724
5741
|
//#region src/components/ConfigError.tsx
|
|
5725
|
-
function
|
|
5742
|
+
function xi() {
|
|
5726
5743
|
return /* @__PURE__ */ W("div", {
|
|
5727
5744
|
className: "flex min-h-screen flex-col items-center justify-center p-8",
|
|
5728
5745
|
children: /* @__PURE__ */ G("div", {
|
|
@@ -5840,8 +5857,8 @@ function bi() {
|
|
|
5840
5857
|
}
|
|
5841
5858
|
//#endregion
|
|
5842
5859
|
//#region src/components/ChatConversation/ChatWindow.tsx
|
|
5843
|
-
var
|
|
5844
|
-
let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } =
|
|
5860
|
+
var Si = () => {
|
|
5861
|
+
let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } = bn(), { isAuthenticated: a } = Cn();
|
|
5845
5862
|
return u(() => {
|
|
5846
5863
|
n && r && !a && e.replace("/");
|
|
5847
5864
|
}, [
|
|
@@ -5849,9 +5866,9 @@ var xi = () => {
|
|
|
5849
5866
|
r,
|
|
5850
5867
|
a,
|
|
5851
5868
|
e
|
|
5852
|
-
]), t ? /* @__PURE__ */ W(
|
|
5869
|
+
]), t ? /* @__PURE__ */ W(xi, {}) : n && r && !a ? /* @__PURE__ */ W("div", {
|
|
5853
5870
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
5854
|
-
children: /* @__PURE__ */ W(
|
|
5871
|
+
children: /* @__PURE__ */ W(bi, {})
|
|
5855
5872
|
}) : n ? r ? /* @__PURE__ */ G("div", {
|
|
5856
5873
|
className: "flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center",
|
|
5857
5874
|
children: [/* @__PURE__ */ W("p", {
|
|
@@ -5863,14 +5880,14 @@ var xi = () => {
|
|
|
5863
5880
|
className: "rounded-md border border-black/15 px-3 py-1.5 text-sm hover:bg-black/5 dark:border-white/20 dark:hover:bg-white/10",
|
|
5864
5881
|
children: "Go Home"
|
|
5865
5882
|
})]
|
|
5866
|
-
}) : /* @__PURE__ */ W("div", { children: i.length > 0 ? /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W(
|
|
5883
|
+
}) : /* @__PURE__ */ W("div", { children: i.length > 0 ? /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W(ri, {}) }) : /* @__PURE__ */ W(yi, {}) }) : /* @__PURE__ */ W("div", {
|
|
5867
5884
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
5868
|
-
children: /* @__PURE__ */ W(
|
|
5885
|
+
children: /* @__PURE__ */ W(bi, {})
|
|
5869
5886
|
});
|
|
5870
5887
|
};
|
|
5871
5888
|
//#endregion
|
|
5872
5889
|
//#region src/hooks/voice/useKokoroTTS.ts
|
|
5873
|
-
function
|
|
5890
|
+
function Ci(e, t) {
|
|
5874
5891
|
let [n, r] = p("idle"), [i, a] = p(!1), [o, s] = p([]), [l, d] = p("af_heart"), [m, h] = p(null), g = f(null), _ = f(null);
|
|
5875
5892
|
u(() => {
|
|
5876
5893
|
t?.autoPreload && !i && y();
|
|
@@ -5884,8 +5901,8 @@ function Si(e, t) {
|
|
|
5884
5901
|
g.current &&= (g.current.pause(), g.current.src.startsWith("blob:") && URL.revokeObjectURL(g.current.src), null), _.current?.abort(), _.current = null;
|
|
5885
5902
|
}, []), y = c(async () => {
|
|
5886
5903
|
try {
|
|
5887
|
-
r("loading"), h(null), await
|
|
5888
|
-
let e = await
|
|
5904
|
+
r("loading"), h(null), await Yt();
|
|
5905
|
+
let e = await Zt();
|
|
5889
5906
|
s(e), e.length && !e.includes(l) && d(e[0]), a(!0), r("idle");
|
|
5890
5907
|
} catch (e) {
|
|
5891
5908
|
let t = e instanceof Error ? e.message : "Failed to load model";
|
|
@@ -5909,7 +5926,7 @@ function Si(e, t) {
|
|
|
5909
5926
|
v(), r("generating"), h(null);
|
|
5910
5927
|
let t = new AbortController();
|
|
5911
5928
|
_.current = t;
|
|
5912
|
-
let n = (await (await
|
|
5929
|
+
let n = (await (await Xt()).generate(e.slice(0, 5e3), { voice: l })).toWav(), i = new Blob([n], { type: "audio/wav" }), a = URL.createObjectURL(i), o = new Audio(a);
|
|
5913
5930
|
g.current = o, o.onended = () => {
|
|
5914
5931
|
r("idle"), URL.revokeObjectURL(a), g.current = null;
|
|
5915
5932
|
}, o.onerror = () => {
|
|
@@ -5934,12 +5951,12 @@ function Si(e, t) {
|
|
|
5934
5951
|
changeVoice: c((e) => {
|
|
5935
5952
|
d(e), localStorage.setItem("kokoroVoice", e);
|
|
5936
5953
|
}, []),
|
|
5937
|
-
backend:
|
|
5954
|
+
backend: Qt()
|
|
5938
5955
|
};
|
|
5939
5956
|
}
|
|
5940
5957
|
//#endregion
|
|
5941
5958
|
//#region src/components/VoiceSettings/KokoroVoiceSelector.tsx
|
|
5942
|
-
var
|
|
5959
|
+
var wi = {
|
|
5943
5960
|
af_heart: "American Female - Heart",
|
|
5944
5961
|
af_bella: "American Female - Bella",
|
|
5945
5962
|
af_nicole: "American Female - Nicole",
|
|
@@ -5951,8 +5968,8 @@ var Ci = {
|
|
|
5951
5968
|
bm_george: "British Male - George",
|
|
5952
5969
|
bm_thomas: "British Male - Thomas"
|
|
5953
5970
|
};
|
|
5954
|
-
function
|
|
5955
|
-
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } =
|
|
5971
|
+
function Ti({ preloadOnMount: e = !1 }) {
|
|
5972
|
+
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } = Ci("", { autoPreload: e }), [l, u] = p(!1), d = t === "loading", f = t === "error";
|
|
5956
5973
|
return /* @__PURE__ */ G("div", {
|
|
5957
5974
|
className: "flex flex-col gap-3",
|
|
5958
5975
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -6001,7 +6018,7 @@ function wi({ preloadOnMount: e = !1 }) {
|
|
|
6001
6018
|
className: "w-full text-left px-3 py-2 rounded-md bg-white/5 dark:bg-black/5 hover:bg-white/10 dark:hover:bg-black/10 transition text-sm font-medium",
|
|
6002
6019
|
children: /* @__PURE__ */ G("div", {
|
|
6003
6020
|
className: "flex items-center gap-2",
|
|
6004
|
-
children: [/* @__PURE__ */ W(Ne, { size: 16 }),
|
|
6021
|
+
children: [/* @__PURE__ */ W(Ne, { size: 16 }), wi[i] || i]
|
|
6005
6022
|
})
|
|
6006
6023
|
}), l && /* @__PURE__ */ W("div", {
|
|
6007
6024
|
className: "grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto",
|
|
@@ -6010,7 +6027,7 @@ function wi({ preloadOnMount: e = !1 }) {
|
|
|
6010
6027
|
s(e), u(!1);
|
|
6011
6028
|
},
|
|
6012
6029
|
className: J("p-2 text-left text-sm rounded transition duration-200", i === e ? "bg-blue-500/20 text-blue-600 dark:text-blue-400 font-medium" : "bg-white/5 dark:bg-black/5 text-foreground hover:bg-white/10 dark:hover:bg-black/10"),
|
|
6013
|
-
children:
|
|
6030
|
+
children: wi[e] || e
|
|
6014
6031
|
}, e))
|
|
6015
6032
|
})]
|
|
6016
6033
|
})]
|
|
@@ -6018,8 +6035,8 @@ function wi({ preloadOnMount: e = !1 }) {
|
|
|
6018
6035
|
}
|
|
6019
6036
|
//#endregion
|
|
6020
6037
|
//#region src/components/VoiceSettings/VoiceSettingsPanel.tsx
|
|
6021
|
-
function
|
|
6022
|
-
let [e, t] = p(!1), [n, r] = p(() => localStorage.getItem("useTTSKokoro") !== "false"), [i, a] = p(() => localStorage.getItem("ttsSpeaker") || "angus"), { start: o, speechStatus: s } =
|
|
6038
|
+
function Ei() {
|
|
6039
|
+
let [e, t] = p(!1), [n, r] = p(() => localStorage.getItem("useTTSKokoro") !== "false"), [i, a] = p(() => localStorage.getItem("ttsSpeaker") || "angus"), { start: o, speechStatus: s } = $t("This is a preview of the selected voice.", { enableInterrupt: !1 }), c = (e) => {
|
|
6023
6040
|
r(e), localStorage.setItem("useTTSKokoro", String(e));
|
|
6024
6041
|
}, l = (e) => {
|
|
6025
6042
|
a(e), localStorage.setItem("ttsSpeaker", e);
|
|
@@ -6069,7 +6086,7 @@ function Ti() {
|
|
|
6069
6086
|
children: "Runs locally in your browser. No server requests, lower latency, and multiple voice options."
|
|
6070
6087
|
})] })
|
|
6071
6088
|
]
|
|
6072
|
-
}), n && /* @__PURE__ */ W(
|
|
6089
|
+
}), n && /* @__PURE__ */ W(Ti, { preloadOnMount: !1 })]
|
|
6073
6090
|
}),
|
|
6074
6091
|
/* @__PURE__ */ G("div", {
|
|
6075
6092
|
className: "space-y-2",
|
|
@@ -6139,4 +6156,4 @@ function Ti() {
|
|
|
6139
6156
|
});
|
|
6140
6157
|
}
|
|
6141
6158
|
//#endregion
|
|
6142
|
-
export {
|
|
6159
|
+
export { Ur as ArticleAIResponse, Br as ArticleActionButtons, Gr as ArticleContent, Hr as ArticleFollowupQuestions, Ir as ArticlePanelHeader, Vr as ArticlePromptInput, wn as ChatProvider, Si as ChatWindow, Dt as ExtractPanelProvider, fi as HistoryDialogs, hi as HistoryDropdown, Ti as KokoroVoiceSelector, Wr as LexicalArticleViewer, Sn as SessionProvider, ti as UnifiedMarkdown, Ei as VoiceSettingsPanel, J as cn, e as configureResearchAgentUI, St as formatMessageTime, Ct as formatTimeDifference, t as researchAgentUIConfig, bn as useChat, vn as useChatState, Et as useExtractPanel, ci as useHistoryState, Ci as useKokoroTTS, Cn as useSession, $t as useTextToSpeech };
|