teodor-new-chat-ui 4.3.208 → 4.3.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +124 -128
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var om = Object.defineProperty;
|
|
|
2
2
|
var sm = (e, t, n) => t in e ? om(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var cl = (e, t, n) => sm(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as v from "react";
|
|
5
|
-
import z, { createContext as co, useContext as xs, useRef as et, useCallback as Ee, useReducer as im, useEffect as
|
|
5
|
+
import z, { createContext as co, useContext as xs, useRef as et, useCallback as Ee, useReducer as im, useEffect as Nt, useMemo as lt, useState as ge, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
|
|
6
6
|
import { Square as cm, Send as um, ChevronRight as Xc, Check as ca, Circle as dm, X as vr, ExternalLink as fm, Download as pm, Image as hm, FileText as ul, Loader as ua, Bot as si, Wrench as mm, User as gm, Paperclip as ji, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as _i, Info as ym, Loader2 as zr, Edit3 as Jc, Plus as vm, FileSpreadsheet as wm, MessageSquarePlus as bm, MessageSquare as Sm, Calendar as Cm, Trash2 as Tm, Settings as km, Server as Rm, EyeOff as Em, Eye as Im, Layout as Nm, MessageCircle as Am, Save as jm } from "lucide-react";
|
|
7
7
|
import { Slot as _m, createSlot as Tr } from "@radix-ui/react-slot";
|
|
8
8
|
import { cva as vs } from "class-variance-authority";
|
|
@@ -371,7 +371,7 @@ function Dm() {
|
|
|
371
371
|
function rt(R) {
|
|
372
372
|
return "" + R;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function Ct(R) {
|
|
375
375
|
if (Qe(R))
|
|
376
376
|
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ze(R)), rt(R);
|
|
377
377
|
}
|
|
@@ -380,7 +380,7 @@ function Dm() {
|
|
|
380
380
|
ref: !0,
|
|
381
381
|
__self: !0,
|
|
382
382
|
__source: !0
|
|
383
|
-
},
|
|
383
|
+
}, Tt, wt;
|
|
384
384
|
function Xe(R) {
|
|
385
385
|
if (xe.call(R, "ref")) {
|
|
386
386
|
var V = Object.getOwnPropertyDescriptor(R, "ref").get;
|
|
@@ -403,7 +403,7 @@ function Dm() {
|
|
|
403
403
|
function Le(R, V) {
|
|
404
404
|
{
|
|
405
405
|
var se = function() {
|
|
406
|
-
|
|
406
|
+
Tt || (Tt = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
|
|
407
407
|
};
|
|
408
408
|
se.isReactWarning = !0, Object.defineProperty(R, "key", {
|
|
409
409
|
get: se,
|
|
@@ -454,7 +454,7 @@ function Dm() {
|
|
|
454
454
|
function Re(R, V, se, Se, Ge) {
|
|
455
455
|
{
|
|
456
456
|
var at, He = {}, ze = null, Ot = null;
|
|
457
|
-
se !== void 0 && (
|
|
457
|
+
se !== void 0 && (Ct(se), ze = "" + se), fe(V) && (Ct(V.key), ze = "" + V.key), Xe(V) && (Ot = V.ref, we(V, Ge));
|
|
458
458
|
for (at in V)
|
|
459
459
|
xe.call(V, at) && !ot.hasOwnProperty(at) && (He[at] = V[at]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
@@ -469,13 +469,13 @@ function Dm() {
|
|
|
469
469
|
return me(R, ze, Ot, Ge, Se, pt.current, He);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
var bt = m.ReactCurrentOwner,
|
|
472
|
+
var bt = m.ReactCurrentOwner, kt = m.ReactDebugCurrentFrame;
|
|
473
473
|
function W(R) {
|
|
474
474
|
if (R) {
|
|
475
475
|
var V = R._owner, se = ue(R.type, R._source, V ? V.type : null);
|
|
476
|
-
|
|
476
|
+
kt.setExtraStackFrame(se);
|
|
477
477
|
} else
|
|
478
|
-
|
|
478
|
+
kt.setExtraStackFrame(null);
|
|
479
479
|
}
|
|
480
480
|
var be;
|
|
481
481
|
be = !1;
|
|
@@ -497,7 +497,7 @@ Check the render method of \`` + R + "`.";
|
|
|
497
497
|
function mt(R) {
|
|
498
498
|
return "";
|
|
499
499
|
}
|
|
500
|
-
var
|
|
500
|
+
var Rt = {};
|
|
501
501
|
function Pe(R) {
|
|
502
502
|
{
|
|
503
503
|
var V = ht();
|
|
@@ -516,9 +516,9 @@ Check the top-level render call using <` + se + ">.");
|
|
|
516
516
|
return;
|
|
517
517
|
R._store.validated = !0;
|
|
518
518
|
var se = Pe(V);
|
|
519
|
-
if (
|
|
519
|
+
if (Rt[se])
|
|
520
520
|
return;
|
|
521
|
-
|
|
521
|
+
Rt[se] = !0;
|
|
522
522
|
var Se = "";
|
|
523
523
|
R && R._owner && R._owner !== bt.current && (Se = " It was passed a child from " + F(R._owner.type) + "."), W(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', se, Se), W(null);
|
|
524
524
|
}
|
|
@@ -542,7 +542,7 @@ Check the top-level render call using <` + se + ">.");
|
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Et(R) {
|
|
546
546
|
{
|
|
547
547
|
var V = R.type;
|
|
548
548
|
if (V == null || typeof V == "string")
|
|
@@ -621,7 +621,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
621
621
|
<%s key={someKey} {...props} />`, Dr, Nn, K, Nn), Jn[Nn + Dr] = !0;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
return R === r ? Dn(yt) :
|
|
624
|
+
return R === r ? Dn(yt) : Et(yt), yt;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
function ti(R, V, se) {
|
|
@@ -3061,7 +3061,7 @@ function Bx(e = []) {
|
|
|
3061
3061
|
}, [i]), l = Ee((d) => {
|
|
3062
3062
|
r.current.push(d), a();
|
|
3063
3063
|
}, [a]);
|
|
3064
|
-
|
|
3064
|
+
Nt(() => () => {
|
|
3065
3065
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
|
|
3066
3066
|
}, []);
|
|
3067
3067
|
const c = lt(() => ({
|
|
@@ -3435,13 +3435,13 @@ function Kx(e = {}) {
|
|
|
3435
3435
|
Be = { Authorization: `Bearer ${r}` };
|
|
3436
3436
|
else if (typeof window < "u") {
|
|
3437
3437
|
const Re = window.__AUTH_TOKEN__, bt = ((de = window.localStorage) == null ? void 0 : de.getItem("authToken")) || null;
|
|
3438
|
-
let
|
|
3438
|
+
let kt = null;
|
|
3439
3439
|
try {
|
|
3440
3440
|
const be = (ke = window.localStorage) == null ? void 0 : ke.getItem("chat-settings");
|
|
3441
|
-
be && (
|
|
3441
|
+
be && (kt = ((Ae = JSON.parse(be)) == null ? void 0 : Ae.apiKey) || null);
|
|
3442
3442
|
} catch {
|
|
3443
3443
|
}
|
|
3444
|
-
const W = Re || bt ||
|
|
3444
|
+
const W = Re || bt || kt || null;
|
|
3445
3445
|
W && (Be = { Authorization: `Bearer ${W}` });
|
|
3446
3446
|
}
|
|
3447
3447
|
} catch {
|
|
@@ -3484,10 +3484,10 @@ function Kx(e = {}) {
|
|
|
3484
3484
|
throw (te = A == null ? void 0 : A.onConnectionError) == null || te.call(A, Re), J = !0, L = "error", M = Re, new Error(Re);
|
|
3485
3485
|
}
|
|
3486
3486
|
w(!0);
|
|
3487
|
-
const rt = Qe.body.getReader(),
|
|
3487
|
+
const rt = Qe.body.getReader(), Ct = new TextDecoder();
|
|
3488
3488
|
let pt = "", ot = [];
|
|
3489
3489
|
C.current = 0, y(0);
|
|
3490
|
-
let
|
|
3490
|
+
let Tt = 0, wt = null;
|
|
3491
3491
|
const Xe = () => {
|
|
3492
3492
|
if (ot.length) {
|
|
3493
3493
|
const me = ot.join("");
|
|
@@ -3506,14 +3506,14 @@ function Kx(e = {}) {
|
|
|
3506
3506
|
}
|
|
3507
3507
|
}, 5e3), Ue = 1024 * 1024;
|
|
3508
3508
|
try {
|
|
3509
|
-
const me = Qe.headers.get("X-Thread-Id") || Qe.headers.get("x-thread-id"), Re = Qe.headers.get("X-Thread-Created") || Qe.headers.get("x-thread-created"), bt = me ?? null,
|
|
3509
|
+
const me = Qe.headers.get("X-Thread-Id") || Qe.headers.get("x-thread-id"), Re = Qe.headers.get("X-Thread-Created") || Qe.headers.get("x-thread-created"), bt = me ?? null, kt = String(Re ?? "").toLowerCase() === "true";
|
|
3510
3510
|
for (S.current && !S.current.threadId && (S.current = {
|
|
3511
3511
|
...S.current,
|
|
3512
3512
|
threadId: bt
|
|
3513
|
-
}), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: bt, created:
|
|
3513
|
+
}), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: bt, created: kt }); ; ) {
|
|
3514
3514
|
const { value: W, done: be } = await rt.read();
|
|
3515
3515
|
if (be) break;
|
|
3516
|
-
pt +=
|
|
3516
|
+
pt += Ct.decode(W, { stream: !0 }), pt.length > Ue && (pt = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3517
3517
|
let ye;
|
|
3518
3518
|
for (; (ye = pt.indexOf(`
|
|
3519
3519
|
|
|
@@ -3522,22 +3522,22 @@ function Kx(e = {}) {
|
|
|
3522
3522
|
pt = pt.slice(ye + 2);
|
|
3523
3523
|
const mt = Gx(ht);
|
|
3524
3524
|
if (!mt) continue;
|
|
3525
|
-
let
|
|
3525
|
+
let Rt;
|
|
3526
3526
|
try {
|
|
3527
|
-
|
|
3527
|
+
Rt = JSON.parse(mt);
|
|
3528
3528
|
} catch {
|
|
3529
3529
|
console.debug("[use-chat] malformed SSE:", mt.slice(0, 200));
|
|
3530
3530
|
continue;
|
|
3531
3531
|
}
|
|
3532
|
-
const Pe = qx(
|
|
3532
|
+
const Pe = qx(Rt) ? Rt.data : Rt;
|
|
3533
3533
|
we = Date.now();
|
|
3534
3534
|
const Vt = Pe.seq;
|
|
3535
3535
|
if (Vt !== void 0) {
|
|
3536
|
-
if (Vt <=
|
|
3537
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq:
|
|
3536
|
+
if (Vt <= Tt) {
|
|
3537
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Tt, type: Pe.type });
|
|
3538
3538
|
continue;
|
|
3539
3539
|
}
|
|
3540
|
-
|
|
3540
|
+
Tt > 0 && Vt > Tt + 1 && ((P = A == null ? void 0 : A.onGap) == null || P.call(A, { from: Tt, to: Vt })), Tt = Vt, C.current = Vt, y(Vt);
|
|
3541
3541
|
}
|
|
3542
3542
|
if (console.debug("[use-chat] received event", {
|
|
3543
3543
|
seq: Pe.seq,
|
|
@@ -3545,9 +3545,9 @@ function Kx(e = {}) {
|
|
|
3545
3545
|
preview: (() => {
|
|
3546
3546
|
var ct;
|
|
3547
3547
|
try {
|
|
3548
|
-
return Pe.type === "message_delta" ? { deltaTypes: (ct = Pe.delta) == null ? void 0 : ct.map((
|
|
3549
|
-
} catch (
|
|
3550
|
-
return { err: String(
|
|
3548
|
+
return Pe.type === "message_delta" ? { deltaTypes: (ct = Pe.delta) == null ? void 0 : ct.map((Et) => Et.type), textLen: (Pe.delta || []).filter((Et) => Et.type === "text").map((Et) => String(Et.text || "").length) } : Pe.content || Pe.delta ? { hasContent: !0 } : {};
|
|
3549
|
+
} catch (Et) {
|
|
3550
|
+
return { err: String(Et) };
|
|
3551
3551
|
}
|
|
3552
3552
|
})()
|
|
3553
3553
|
}), Pe.type === "checkpoint")
|
|
@@ -3555,8 +3555,8 @@ function Kx(e = {}) {
|
|
|
3555
3555
|
else if (Pe.type === "state_history") {
|
|
3556
3556
|
E.current = Pe;
|
|
3557
3557
|
try {
|
|
3558
|
-
const
|
|
3559
|
-
|
|
3558
|
+
const Et = Ur(Pe).latest;
|
|
3559
|
+
Et && (k.current = Et.checkpointId ?? null, N.current = Et.checkpointNs ?? null, g(Et.checkpointId ?? null));
|
|
3560
3560
|
} catch (ct) {
|
|
3561
3561
|
console.warn("[use-chat] Failed to hydrate state_history payload", ct);
|
|
3562
3562
|
}
|
|
@@ -3569,7 +3569,7 @@ function Kx(e = {}) {
|
|
|
3569
3569
|
if (Pe.type === "token" && e.autoAppendAssistant !== !1)
|
|
3570
3570
|
ot.push(Pe.content), fe();
|
|
3571
3571
|
else if (Pe.type === "message_delta") {
|
|
3572
|
-
const ct = Pe.delta.filter((
|
|
3572
|
+
const ct = Pe.delta.filter((Et) => Et.type === "text").map((Et) => Et.text).join("");
|
|
3573
3573
|
ct && e.autoAppendAssistant !== !1 && (ot.push(ct), fe());
|
|
3574
3574
|
} else if (Pe.type === "heartbeat") {
|
|
3575
3575
|
console.debug("[use-chat] heartbeat received");
|
|
@@ -3638,7 +3638,7 @@ function Kx(e = {}) {
|
|
|
3638
3638
|
},
|
|
3639
3639
|
[t, n, r, e.autoAppendAssistant]
|
|
3640
3640
|
);
|
|
3641
|
-
return
|
|
3641
|
+
return Nt(() => () => {
|
|
3642
3642
|
var j;
|
|
3643
3643
|
T.current = !1, (j = b.current) == null || j.abort();
|
|
3644
3644
|
}, []), {
|
|
@@ -3879,7 +3879,7 @@ function Xx({
|
|
|
3879
3879
|
checkpointMetadataCache: f
|
|
3880
3880
|
}) {
|
|
3881
3881
|
const { api: p, baseUrl: h } = Tu(), g = lt(() => _n(h), [h]), [x, y] = ge([]), [m, w] = ge(t), [b, T] = ge(!1), [C, S] = ge(null), [k, N] = ge(!1), [E, I] = ge(null), { state: _, seed: D, prepend: F, pushUser: j, onEvent: $ } = Bx(), [A, B] = ge(!1), [L, M] = ge(!1), [J, Y] = ge(null), [de, ke] = ge([]), [Ae, G] = ge(!1), te = f ?? Lx(), { setCacheForThread: q } = te, P = et(m), H = et(null);
|
|
3882
|
-
|
|
3882
|
+
Nt(() => {
|
|
3883
3883
|
P.current = m;
|
|
3884
3884
|
}, [m]);
|
|
3885
3885
|
const Z = et(), { startStream: oe, stop: ne, isStreaming: De, error: ee, setAuthToken: ue } = Yx({
|
|
@@ -3951,9 +3951,7 @@ function Xx({
|
|
|
3951
3951
|
checkpointId: we
|
|
3952
3952
|
}), { checkpoints: Ue } = Ur(Le);
|
|
3953
3953
|
Be(fe, Ue, `thread load (requested: ${we})`);
|
|
3954
|
-
const me = Ue.find(
|
|
3955
|
-
(Re) => Re.messages && Re.messages.length > 0
|
|
3956
|
-
) ?? Ue[0];
|
|
3954
|
+
const me = Ue.find((Re) => Re.messages && Re.messages.length > 0) ?? Ue[0];
|
|
3957
3955
|
D((me == null ? void 0 : me.messages) ?? [], {
|
|
3958
3956
|
checkpointId: (me == null ? void 0 : me.checkpointId) ?? null,
|
|
3959
3957
|
checkpointNs: (me == null ? void 0 : me.checkpointNs) ?? null
|
|
@@ -3968,7 +3966,7 @@ function Xx({
|
|
|
3968
3966
|
},
|
|
3969
3967
|
[p, D, l, Be]
|
|
3970
3968
|
);
|
|
3971
|
-
|
|
3969
|
+
Nt(() => {
|
|
3972
3970
|
Z.current = $e;
|
|
3973
3971
|
}, [$e]);
|
|
3974
3972
|
const qe = Ee(
|
|
@@ -4030,7 +4028,7 @@ function Xx({
|
|
|
4030
4028
|
M(!1);
|
|
4031
4029
|
}
|
|
4032
4030
|
}
|
|
4033
|
-
}, [p, J, F, l]),
|
|
4031
|
+
}, [p, J, F, l]), Ct = Ee(async () => {
|
|
4034
4032
|
D([], {}), ke([]), B(!1), Y(null);
|
|
4035
4033
|
}, [D]), pt = Ee(
|
|
4036
4034
|
async (fe, we) => {
|
|
@@ -4038,9 +4036,9 @@ function Xx({
|
|
|
4038
4036
|
},
|
|
4039
4037
|
[]
|
|
4040
4038
|
);
|
|
4041
|
-
|
|
4039
|
+
Nt(() => {
|
|
4042
4040
|
xe();
|
|
4043
|
-
}, [xe]),
|
|
4041
|
+
}, [xe]), Nt(() => {
|
|
4044
4042
|
var we, Le;
|
|
4045
4043
|
if (!o || !m || k || H.current === m)
|
|
4046
4044
|
return;
|
|
@@ -4050,11 +4048,9 @@ function Xx({
|
|
|
4050
4048
|
ns: localStorage.getItem("lastCheckpointNs") || r
|
|
4051
4049
|
};
|
|
4052
4050
|
fe.id ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", fe.id), (we = Z.current) == null || we.call(Z, m, fe.id)) : (console.log("[ChatSessionProvider] Loading thread with latest checkpoint"), (Le = Z.current) == null || Le.call(Z, m));
|
|
4053
|
-
}, [o, m, k, n, r]),
|
|
4051
|
+
}, [o, m, k, n, r]), Nt(() => {
|
|
4054
4052
|
d == null || d(m);
|
|
4055
|
-
}, [m, d])
|
|
4056
|
-
_.lastCheckpointId && (localStorage.setItem("lastCheckpointId", _.lastCheckpointId), _.lastCheckpointNs && localStorage.setItem("lastCheckpointNs", _.lastCheckpointNs));
|
|
4057
|
-
}, [_.lastCheckpointId, _.lastCheckpointNs]);
|
|
4053
|
+
}, [m, d]);
|
|
4058
4054
|
const ot = Ee(
|
|
4059
4055
|
async (fe, we) => {
|
|
4060
4056
|
const Le = P.current, Ue = (fe == null ? void 0 : fe.text) ?? "";
|
|
@@ -4075,15 +4071,15 @@ function Xx({
|
|
|
4075
4071
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4076
4072
|
};
|
|
4077
4073
|
j(bt);
|
|
4078
|
-
const
|
|
4074
|
+
const kt = {
|
|
4079
4075
|
threadId: Le,
|
|
4080
4076
|
checkpointId: (we == null ? void 0 : we.checkpointId) ?? _.lastCheckpointId ?? void 0,
|
|
4081
4077
|
checkpointNs: (we == null ? void 0 : we.checkpointNs) ?? _.lastCheckpointNs ?? void 0
|
|
4082
4078
|
};
|
|
4083
|
-
oe(
|
|
4079
|
+
oe(kt);
|
|
4084
4080
|
},
|
|
4085
4081
|
[p, Ne, j, _, oe]
|
|
4086
|
-
),
|
|
4082
|
+
), Tt = lt(
|
|
4087
4083
|
() => ({
|
|
4088
4084
|
threads: x,
|
|
4089
4085
|
currentThreadId: m,
|
|
@@ -4115,12 +4111,12 @@ function Xx({
|
|
|
4115
4111
|
error: E,
|
|
4116
4112
|
hasMore: A,
|
|
4117
4113
|
loadOlder: rt,
|
|
4118
|
-
clearState:
|
|
4114
|
+
clearState: Ct,
|
|
4119
4115
|
navigateToCheckpoint: qe,
|
|
4120
4116
|
setCurrentCheckpointId: Ze,
|
|
4121
4117
|
returnToLatest: Qe,
|
|
4122
4118
|
loadThread: $e,
|
|
4123
|
-
clearThread:
|
|
4119
|
+
clearThread: Ct,
|
|
4124
4120
|
respondToInterrupt: pt
|
|
4125
4121
|
}),
|
|
4126
4122
|
[
|
|
@@ -4133,7 +4129,7 @@ function Xx({
|
|
|
4133
4129
|
E,
|
|
4134
4130
|
A,
|
|
4135
4131
|
rt,
|
|
4136
|
-
|
|
4132
|
+
Ct,
|
|
4137
4133
|
qe,
|
|
4138
4134
|
Ze,
|
|
4139
4135
|
Qe,
|
|
@@ -4152,7 +4148,7 @@ function Xx({
|
|
|
4152
4148
|
}),
|
|
4153
4149
|
[De, ee, ot, ne, ue]
|
|
4154
4150
|
);
|
|
4155
|
-
return /* @__PURE__ */ u.jsx(Au.Provider, { value:
|
|
4151
|
+
return /* @__PURE__ */ u.jsx(Au.Provider, { value: Tt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: wt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Xe, children: e }) }) });
|
|
4156
4152
|
}
|
|
4157
4153
|
function xa() {
|
|
4158
4154
|
const e = xs(Au);
|
|
@@ -8110,7 +8106,7 @@ function Me(e, t) {
|
|
|
8110
8106
|
function $a(e) {
|
|
8111
8107
|
e(Pr);
|
|
8112
8108
|
}
|
|
8113
|
-
function
|
|
8109
|
+
function It(e) {
|
|
8114
8110
|
return e(vf);
|
|
8115
8111
|
}
|
|
8116
8112
|
function pe(e, t) {
|
|
@@ -8325,7 +8321,7 @@ const y0 = {
|
|
|
8325
8321
|
return {
|
|
8326
8322
|
log: X((t, n, r = 1) => {
|
|
8327
8323
|
var o;
|
|
8328
|
-
const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o :
|
|
8324
|
+
const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : It(e);
|
|
8329
8325
|
r >= s && console[y0[r]](
|
|
8330
8326
|
"%creact-virtuoso: %c%s %o",
|
|
8331
8327
|
"color: #0253b3; font-weight: bold",
|
|
@@ -8849,7 +8845,7 @@ const P0 = {
|
|
|
8849
8845
|
pe(
|
|
8850
8846
|
U(
|
|
8851
8847
|
d,
|
|
8852
|
-
Ie((C) => C !== void 0 && dt(
|
|
8848
|
+
Ie((C) => C !== void 0 && dt(It(x).sizeTree)),
|
|
8853
8849
|
ae((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
|
|
8854
8850
|
),
|
|
8855
8851
|
n
|
|
@@ -8878,11 +8874,11 @@ const P0 = {
|
|
|
8878
8874
|
ae((C) => C.diff)
|
|
8879
8875
|
),
|
|
8880
8876
|
(C) => {
|
|
8881
|
-
const { groupIndices: S } =
|
|
8877
|
+
const { groupIndices: S } = It(x);
|
|
8882
8878
|
if (C > 0)
|
|
8883
8879
|
Me(t, !0), Me(s, C + yc(C, S));
|
|
8884
8880
|
else if (C < 0) {
|
|
8885
|
-
const k =
|
|
8881
|
+
const k = It(y);
|
|
8886
8882
|
k.length > 0 && (C -= yc(-C, k)), Me(i, C);
|
|
8887
8883
|
}
|
|
8888
8884
|
}
|
|
@@ -8974,7 +8970,7 @@ const P0 = {
|
|
|
8974
8970
|
if (dt(S.sizeTree))
|
|
8975
8971
|
return S;
|
|
8976
8972
|
let N = Sr();
|
|
8977
|
-
const E =
|
|
8973
|
+
const E = It(y);
|
|
8978
8974
|
let I = 0, _ = 0, D = 0;
|
|
8979
8975
|
for (; I < -C; ) {
|
|
8980
8976
|
D = E[_];
|
|
@@ -9074,7 +9070,7 @@ const _f = tt(
|
|
|
9074
9070
|
)
|
|
9075
9071
|
);
|
|
9076
9072
|
return it(t, (r) => {
|
|
9077
|
-
r &&
|
|
9073
|
+
r && It(e)("props updated", {}, Xt.DEBUG);
|
|
9078
9074
|
}), { didMount: n, propsReady: t };
|
|
9079
9075
|
},
|
|
9080
9076
|
xt(qn),
|
|
@@ -9316,7 +9312,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
|
|
|
9316
9312
|
ae(({ scrollTop: w }) => w),
|
|
9317
9313
|
gt(),
|
|
9318
9314
|
Cn(
|
|
9319
|
-
(w, b) =>
|
|
9315
|
+
(w, b) => It(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
|
|
9320
9316
|
{ direction: Vr, prevScrollTop: 0 }
|
|
9321
9317
|
),
|
|
9322
9318
|
ae((w) => w.direction)
|
|
@@ -9546,7 +9542,7 @@ const hr = tt(
|
|
|
9546
9542
|
j,
|
|
9547
9543
|
$
|
|
9548
9544
|
]) => {
|
|
9549
|
-
const A = E, { offsetTree: B, sizeTree: L } = A, M =
|
|
9545
|
+
const A = E, { offsetTree: B, sizeTree: L } = A, M = It(y);
|
|
9550
9546
|
if (N === 0)
|
|
9551
9547
|
return { ...Ti, totalCount: N };
|
|
9552
9548
|
if (S === 0 && k === 0)
|
|
@@ -9738,7 +9734,7 @@ const hr = tt(
|
|
|
9738
9734
|
Ie(($) => !$),
|
|
9739
9735
|
// skips the initial publish of false, and the cleanup call.
|
|
9740
9736
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
9741
|
-
ar(
|
|
9737
|
+
ar(It(i) ? 1 : 2)
|
|
9742
9738
|
),
|
|
9743
9739
|
k
|
|
9744
9740
|
) : k && k(), j;
|
|
@@ -9788,16 +9784,16 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9788
9784
|
Ie(({ shouldFollow: C }) => C)
|
|
9789
9785
|
),
|
|
9790
9786
|
({ followOutputBehavior: C, totalCount: S }) => {
|
|
9791
|
-
y && (y(), y = null),
|
|
9792
|
-
|
|
9787
|
+
y && (y(), y = null), It(n) ? requestAnimationFrame(() => {
|
|
9788
|
+
It(d)("following output to ", { totalCount: S }, Xt.DEBUG), m(C);
|
|
9793
9789
|
}) : y = pn(e, () => {
|
|
9794
|
-
|
|
9790
|
+
It(d)("following output to ", { totalCount: S }, Xt.DEBUG), m(C), y = null;
|
|
9795
9791
|
});
|
|
9796
9792
|
}
|
|
9797
9793
|
);
|
|
9798
9794
|
function w(C) {
|
|
9799
9795
|
const S = pn(o, (k) => {
|
|
9800
|
-
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !y && (
|
|
9796
|
+
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !y && (It(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), m("auto"));
|
|
9801
9797
|
});
|
|
9802
9798
|
setTimeout(S, 100);
|
|
9803
9799
|
}
|
|
@@ -9813,10 +9809,10 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9813
9809
|
Fe(g, t)
|
|
9814
9810
|
),
|
|
9815
9811
|
([, C]) => {
|
|
9816
|
-
|
|
9812
|
+
It(a) && w(C !== !1);
|
|
9817
9813
|
}
|
|
9818
9814
|
), it(x, () => {
|
|
9819
|
-
w(
|
|
9815
|
+
w(It(g) !== !1);
|
|
9820
9816
|
}), it(_t(Te(g), o), ([C, S]) => {
|
|
9821
9817
|
C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && m("auto");
|
|
9822
9818
|
});
|
|
@@ -9842,10 +9838,10 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9842
9838
|
An(0)
|
|
9843
9839
|
),
|
|
9844
9840
|
(C) => {
|
|
9845
|
-
y && (y(), y = null),
|
|
9846
|
-
|
|
9841
|
+
y && (y(), y = null), It(n) ? requestAnimationFrame(() => {
|
|
9842
|
+
It(d)("scrolling into view", {}), Me(h, C);
|
|
9847
9843
|
}) : y = pn(e, () => {
|
|
9848
|
-
|
|
9844
|
+
It(d)("scrolling into view", {}), Me(h, C), y = null;
|
|
9849
9845
|
});
|
|
9850
9846
|
}
|
|
9851
9847
|
), { autoscrollToBottom: x, followOutput: g, scrollIntoViewOnChange: b };
|
|
@@ -10277,11 +10273,11 @@ function Hf(e, t, n) {
|
|
|
10277
10273
|
);
|
|
10278
10274
|
return z.useSyncExternalStore(
|
|
10279
10275
|
w,
|
|
10280
|
-
() =>
|
|
10281
|
-
() =>
|
|
10276
|
+
() => It(m),
|
|
10277
|
+
() => It(m)
|
|
10282
10278
|
);
|
|
10283
10279
|
}, g = (y) => {
|
|
10284
|
-
const m = z.useContext(a)[y], [w, b] = z.useState(hc(
|
|
10280
|
+
const m = z.useContext(a)[y], [w, b] = z.useState(hc(It, m));
|
|
10285
10281
|
return _o(
|
|
10286
10282
|
() => it(m, (T) => {
|
|
10287
10283
|
T !== w && b(pc(T));
|
|
@@ -10853,8 +10849,8 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10853
10849
|
const Ze = Xf(qe, $e, Ke);
|
|
10854
10850
|
let Qe, rt;
|
|
10855
10851
|
xe ? H === 0 && Z === 0 && ue > 0 ? (Qe = 0, rt = ue - 1) : (Qe = Ze * as((H + Je) / (Be + Je)), rt = Ze * Ec((Z + Je) / (Be + Je)) - 1, rt = Ei(P - 1, Kr(rt, Ze - 1)), Qe = Ei(rt, Kr(0, Qe))) : (Qe = 0, rt = -1);
|
|
10856
|
-
const
|
|
10857
|
-
return { bottom: pt, itemHeight: Be, items:
|
|
10852
|
+
const Ct = Nc(Qe, rt, ee), { bottom: pt, top: ot } = Ac(De, oe, ne, Ct), Tt = Ec(P / Ze), wt = Tt * Be + (Tt - 1) * Je - pt;
|
|
10853
|
+
return { bottom: pt, itemHeight: Be, items: Ct, itemWidth: $e, offsetBottom: wt, offsetTop: ot, top: ot };
|
|
10858
10854
|
}
|
|
10859
10855
|
)
|
|
10860
10856
|
),
|
|
@@ -11795,7 +11791,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
|
|
|
11795
11791
|
}
|
|
11796
11792
|
}
|
|
11797
11793
|
}, [n]);
|
|
11798
|
-
|
|
11794
|
+
Nt(() => {
|
|
11799
11795
|
e && n && p();
|
|
11800
11796
|
}, [e, n, p]);
|
|
11801
11797
|
const h = async () => {
|
|
@@ -13557,7 +13553,7 @@ function zc(e) {
|
|
|
13557
13553
|
}
|
|
13558
13554
|
function RC({ className: e }) {
|
|
13559
13555
|
const [t, n] = ge(0);
|
|
13560
|
-
return
|
|
13556
|
+
return Nt(() => {
|
|
13561
13557
|
const r = setInterval(() => n((o) => (o + 1) % 4), 500);
|
|
13562
13558
|
return () => clearInterval(r);
|
|
13563
13559
|
}, []), /* @__PURE__ */ u.jsxs(
|
|
@@ -13754,7 +13750,7 @@ const Bc = z.memo(function({
|
|
|
13754
13750
|
} finally {
|
|
13755
13751
|
T == null || T();
|
|
13756
13752
|
}
|
|
13757
|
-
}, [w, T, b, B]),
|
|
13753
|
+
}, [w, T, b, B]), Ct = z.useCallback(async (W) => {
|
|
13758
13754
|
if (w)
|
|
13759
13755
|
return;
|
|
13760
13756
|
const be = Mo(
|
|
@@ -13821,16 +13817,16 @@ const Bc = z.memo(function({
|
|
|
13821
13817
|
if (W.type === "interrupt") {
|
|
13822
13818
|
const ye = W, ht = Mo(
|
|
13823
13819
|
(ye == null ? void 0 : ye.id) ?? (ye == null ? void 0 : ye.interrupt_id)
|
|
13824
|
-
), mt = !!(xe && ht && ht === xe),
|
|
13820
|
+
), mt = !!(xe && ht && ht === xe), Rt = mt ? Ne ?? (ye == null ? void 0 : ye.value) : ye == null ? void 0 : ye.value, Pe = ht ? { ...ye, id: ht, interrupt_id: ht } : ye;
|
|
13825
13821
|
return /* @__PURE__ */ u.jsx(
|
|
13826
13822
|
EC,
|
|
13827
13823
|
{
|
|
13828
13824
|
interruptPart: Pe,
|
|
13829
13825
|
onApprove: rt,
|
|
13830
|
-
onReject:
|
|
13826
|
+
onReject: Ct,
|
|
13831
13827
|
disabled: w,
|
|
13832
13828
|
isActive: mt,
|
|
13833
|
-
payload:
|
|
13829
|
+
payload: Rt
|
|
13834
13830
|
},
|
|
13835
13831
|
be
|
|
13836
13832
|
);
|
|
@@ -13840,7 +13836,7 @@ const Bc = z.memo(function({
|
|
|
13840
13836
|
G,
|
|
13841
13837
|
Ae,
|
|
13842
13838
|
rt,
|
|
13843
|
-
|
|
13839
|
+
Ct,
|
|
13844
13840
|
M,
|
|
13845
13841
|
c,
|
|
13846
13842
|
d,
|
|
@@ -13854,7 +13850,7 @@ const Bc = z.memo(function({
|
|
|
13854
13850
|
]), ot = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
|
|
13855
13851
|
/* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
|
|
13856
13852
|
/* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
13857
|
-
] }), []),
|
|
13853
|
+
] }), []), Tt = z.useCallback(() => {
|
|
13858
13854
|
const W = Z.trim().length > 0 || ne.length > 0 || De.length > 0 || ee.length > 0;
|
|
13859
13855
|
if (!J && De.length > 0 && !r)
|
|
13860
13856
|
return ot();
|
|
@@ -13896,7 +13892,7 @@ const Bc = z.memo(function({
|
|
|
13896
13892
|
k(be, ye);
|
|
13897
13893
|
},
|
|
13898
13894
|
[E, k]
|
|
13899
|
-
), Re = z.useMemo(() => Le ? Xe.findIndex((W) => W.id === Le) : -1, [Le, Xe]), bt = z.useMemo(() => Re < 0 ? null : Xe[Re] ?? null, [Re, Xe]),
|
|
13895
|
+
), Re = z.useMemo(() => Le ? Xe.findIndex((W) => W.id === Le) : -1, [Le, Xe]), bt = z.useMemo(() => Re < 0 ? null : Xe[Re] ?? null, [Re, Xe]), kt = z.useCallback((W) => {
|
|
13900
13896
|
const be = [];
|
|
13901
13897
|
if (W.step !== null && be.push(`Step ${W.step}`), W.source && be.push(W.source), !W.createdAt)
|
|
13902
13898
|
return be.length ? be.join(" • ") : W.id.slice(0, 8);
|
|
@@ -13978,7 +13974,7 @@ const Bc = z.memo(function({
|
|
|
13978
13974
|
" / ",
|
|
13979
13975
|
Xe.length
|
|
13980
13976
|
] }),
|
|
13981
|
-
/* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children:
|
|
13977
|
+
/* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: kt(bt) })
|
|
13982
13978
|
] }),
|
|
13983
13979
|
/* @__PURE__ */ u.jsx(
|
|
13984
13980
|
"button",
|
|
@@ -14058,7 +14054,7 @@ const Bc = z.memo(function({
|
|
|
14058
14054
|
]
|
|
14059
14055
|
}
|
|
14060
14056
|
),
|
|
14061
|
-
/* @__PURE__ */ u.jsx("div", { className: "relative", children:
|
|
14057
|
+
/* @__PURE__ */ u.jsx("div", { className: "relative", children: Tt() }),
|
|
14062
14058
|
J && D === "expanded" && (oe.toolCallId || oe.name) && /* @__PURE__ */ u.jsxs("div", { className: Q("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", L && "text-xs"), children: [
|
|
14063
14059
|
oe.name && /* @__PURE__ */ u.jsxs("div", { children: [
|
|
14064
14060
|
"Function: ",
|
|
@@ -14570,12 +14566,12 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14570
14566
|
const xe = Hc(ue, ee), Ne = "type" in ue && ue.type === "default_message";
|
|
14571
14567
|
let Ke = [], Je = null, Be = {}, $e = {}, qe = null, Ze = null;
|
|
14572
14568
|
if (!Ne) {
|
|
14573
|
-
const
|
|
14574
|
-
Be =
|
|
14569
|
+
const Ct = ue, pt = Ct.checkpointId ?? null;
|
|
14570
|
+
Be = Ct.additionalKwargs ?? {}, $e = Ct.responseMetadata ?? {};
|
|
14575
14571
|
const ot = pt && k ? k.get(pt) ?? null : null;
|
|
14576
14572
|
qe = typeof Be.step == "number" ? Be.step : typeof $e.step == "number" ? $e.step : (ot == null ? void 0 : ot.step) ?? null;
|
|
14577
|
-
const
|
|
14578
|
-
Ze =
|
|
14573
|
+
const Tt = typeof Be.source == "string" ? Be.source : typeof $e.source == "string" ? $e.source : (ot == null ? void 0 : ot.source) ?? null;
|
|
14574
|
+
Ze = Tt ? String(Tt) : null;
|
|
14579
14575
|
const wt = qe !== null && Ze ? `${qe}:${Ze}` : null;
|
|
14580
14576
|
wt && (N != null && N.has(wt)) ? Ke = N.get(wt) ?? [] : pt && ot && (Ke = [ot]), Je = pt ?? ((rt = Ke[0]) == null ? void 0 : rt.id) ?? null;
|
|
14581
14577
|
}
|
|
@@ -14663,14 +14659,14 @@ function Ai({
|
|
|
14663
14659
|
interrupt: _,
|
|
14664
14660
|
metadata: D
|
|
14665
14661
|
} = ya(), { isStreaming: F, error: j, connectionState: $, submit: A, stop: B } = Jx(), L = m ?? y ?? null, M = (E == null ? void 0 : E.id) ?? null, J = (E == null ? void 0 : E.namespace) ?? null, Y = (D == null ? void 0 : D.assemblingMessageId) ?? null, de = _, [ke, Ae] = ge(!1);
|
|
14666
|
-
|
|
14662
|
+
Nt(() => {
|
|
14667
14663
|
de || Ae(!1);
|
|
14668
14664
|
}, [de]);
|
|
14669
14665
|
const G = Ee(() => {
|
|
14670
14666
|
Ae(!0);
|
|
14671
14667
|
}, []), te = Ee(() => {
|
|
14672
14668
|
Ae(!1);
|
|
14673
|
-
}, []), q = !!de || ke, [P, H] = ge(null), [Z, oe] = ge(""), [ne, De] = ge(null), [ee, ue] = ge(null), [xe, Ne] = ge([]), [Ke, Je] = ge(0), [Be, $e] = ge(0), [qe, Ze] = ge(!1), [Qe, rt] = ge(null), [
|
|
14669
|
+
}, []), q = !!de || ke, [P, H] = ge(null), [Z, oe] = ge(""), [ne, De] = ge(null), [ee, ue] = ge(null), [xe, Ne] = ge([]), [Ke, Je] = ge(0), [Be, $e] = ge(0), [qe, Ze] = ge(!1), [Qe, rt] = ge(null), [Ct, pt] = ge(null), [ot, Tt] = ge(!1), [wt, Xe] = ge(null), [fe, we] = ge(!1), Le = et(!1), [Ue, me] = ge(() => Uc.value), Re = et(Ue), bt = et(null), kt = Ee((K) => {
|
|
14674
14670
|
Uc.value = K, me(K);
|
|
14675
14671
|
}, []), [W, be] = ge(!1), ye = et(null), ht = Ee((K) => {
|
|
14676
14672
|
if (!Array.isArray(K))
|
|
@@ -14692,7 +14688,7 @@ function Ai({
|
|
|
14692
14688
|
return typeof ie == "number" ? ie : null;
|
|
14693
14689
|
},
|
|
14694
14690
|
[]
|
|
14695
|
-
),
|
|
14691
|
+
), Rt = Ee(
|
|
14696
14692
|
(K, re) => {
|
|
14697
14693
|
if (!K || typeof K != "object") return null;
|
|
14698
14694
|
const ie = K[re];
|
|
@@ -14736,7 +14732,7 @@ function Ai({
|
|
|
14736
14732
|
for (const ie of Pe) {
|
|
14737
14733
|
const Ce = ie.checkpointId ?? null;
|
|
14738
14734
|
if (!Ce) continue;
|
|
14739
|
-
const ut = mt(ie.metadata, "step"), Ye =
|
|
14735
|
+
const ut = mt(ie.metadata, "step"), Ye = Rt(ie.metadata, "source"), nt = {
|
|
14740
14736
|
id: Ce,
|
|
14741
14737
|
step: ut,
|
|
14742
14738
|
source: Ye,
|
|
@@ -14755,15 +14751,15 @@ function Ai({
|
|
|
14755
14751
|
return (ut.createdAt ?? "").localeCompare(Ye);
|
|
14756
14752
|
});
|
|
14757
14753
|
return { checkpointMetaById: K, checkpointIndexByKey: re };
|
|
14758
|
-
}, [Pe, mt,
|
|
14754
|
+
}, [Pe, mt, Rt]), Et = lt(() => {
|
|
14759
14755
|
var Ye;
|
|
14760
14756
|
if (!Pe.length) return [];
|
|
14761
14757
|
const K = [...Pe].reverse(), re = (nt, Mt) => {
|
|
14762
14758
|
const tn = nt.checkpointId ?? null;
|
|
14763
14759
|
if (!tn) return null;
|
|
14764
|
-
const Zn =
|
|
14765
|
-
|
|
14766
|
-
const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() ||
|
|
14760
|
+
const Zn = Rt(nt.metadata, "source");
|
|
14761
|
+
Rt(nt.metadata, "next");
|
|
14762
|
+
const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Rt(nt.metadata, "title") || Rt(nt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
|
|
14767
14763
|
return {
|
|
14768
14764
|
id: tn,
|
|
14769
14765
|
label: rm,
|
|
@@ -14771,11 +14767,11 @@ function Ai({
|
|
|
14771
14767
|
createdAt: nt.createdAt ?? null,
|
|
14772
14768
|
step: mt(nt.metadata, "step"),
|
|
14773
14769
|
source: Zn ?? null,
|
|
14774
|
-
next:
|
|
14770
|
+
next: Rt(nt.metadata, "next")
|
|
14775
14771
|
};
|
|
14776
14772
|
}, ie = [], Ce = /* @__PURE__ */ new Set();
|
|
14777
14773
|
for (const nt of K) {
|
|
14778
|
-
const Mt = ((Ye =
|
|
14774
|
+
const Mt = ((Ye = Rt(nt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
|
|
14779
14775
|
if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
|
|
14780
14776
|
const Zn = re(nt, "User input");
|
|
14781
14777
|
Zn && !Ce.has(Zn.id) && (ie.push(Zn), Ce.add(Zn.id));
|
|
@@ -14787,42 +14783,42 @@ function Ai({
|
|
|
14787
14783
|
}
|
|
14788
14784
|
const ut = Pe.find((nt) => {
|
|
14789
14785
|
var tn;
|
|
14790
|
-
return (((tn =
|
|
14786
|
+
return (((tn = Rt(nt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
|
|
14791
14787
|
});
|
|
14792
14788
|
if (ut) {
|
|
14793
14789
|
const nt = re(ut, "Latest loop");
|
|
14794
14790
|
nt && !Ce.has(nt.id) && (ie.push(nt), Ce.add(nt.id));
|
|
14795
14791
|
}
|
|
14796
14792
|
return ie;
|
|
14797
|
-
}, [Pe, ht, mt,
|
|
14793
|
+
}, [Pe, ht, mt, Rt]), Dn = et(null), Jn = et(null), Ln = Ee(() => {
|
|
14798
14794
|
Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Je((K) => K + 1), $e((K) => K + 1);
|
|
14799
14795
|
}, []), ti = Ee(
|
|
14800
14796
|
(K) => {
|
|
14801
|
-
|
|
14797
|
+
kt(K);
|
|
14802
14798
|
},
|
|
14803
|
-
[
|
|
14799
|
+
[kt]
|
|
14804
14800
|
), So = et(!1);
|
|
14805
|
-
|
|
14801
|
+
Nt(() => {
|
|
14806
14802
|
So.current && !F && (Ne([]), Ln()), So.current = F;
|
|
14807
14803
|
}, [F, Ln]);
|
|
14808
14804
|
const [ni, ri] = ge("desktop");
|
|
14809
|
-
|
|
14805
|
+
Nt(() => {
|
|
14810
14806
|
const K = () => {
|
|
14811
14807
|
const re = window.innerWidth;
|
|
14812
14808
|
ri(re < 640 ? "phone" : re < 1024 ? "tablet" : "desktop");
|
|
14813
14809
|
};
|
|
14814
14810
|
return K(), window.addEventListener("resize", K), () => window.removeEventListener("resize", K);
|
|
14815
|
-
}, []),
|
|
14811
|
+
}, []), Nt(() => {
|
|
14816
14812
|
we(!1), Le.current = !1;
|
|
14817
|
-
}, [L]),
|
|
14813
|
+
}, [L]), Nt(() => {
|
|
14818
14814
|
Re.current = Ue;
|
|
14819
|
-
}, [Ue]),
|
|
14815
|
+
}, [Ue]), Nt(() => {
|
|
14820
14816
|
if (!P) {
|
|
14821
14817
|
bt.current = null;
|
|
14822
14818
|
return;
|
|
14823
14819
|
}
|
|
14824
|
-
bt.current === null && (bt.current = Re.current),
|
|
14825
|
-
}, [Z, P,
|
|
14820
|
+
bt.current === null && (bt.current = Re.current), kt(Z ?? "");
|
|
14821
|
+
}, [Z, P, kt]);
|
|
14826
14822
|
const R = Ee(async () => {
|
|
14827
14823
|
if (!(!b || T || !fe))
|
|
14828
14824
|
try {
|
|
@@ -14831,7 +14827,7 @@ function Ai({
|
|
|
14831
14827
|
console.warn("loadOlder failed", K);
|
|
14832
14828
|
}
|
|
14833
14829
|
}, [b, fe, T, S]);
|
|
14834
|
-
|
|
14830
|
+
Nt(() => {
|
|
14835
14831
|
(async () => {
|
|
14836
14832
|
if (!x.baseUrl) {
|
|
14837
14833
|
Xe(null);
|
|
@@ -14844,7 +14840,7 @@ function Ai({
|
|
|
14844
14840
|
console.warn("Failed to fetch default message:", re), Xe(null);
|
|
14845
14841
|
}
|
|
14846
14842
|
})();
|
|
14847
|
-
}, [x.baseUrl]),
|
|
14843
|
+
}, [x.baseUrl]), Nt(() => {
|
|
14848
14844
|
j && !ot && (g == null || g(j));
|
|
14849
14845
|
}, [j, ot, g]);
|
|
14850
14846
|
const V = (K) => {
|
|
@@ -14882,7 +14878,7 @@ function Ai({
|
|
|
14882
14878
|
checkpointId: ie,
|
|
14883
14879
|
checkpointNs: Ce
|
|
14884
14880
|
}
|
|
14885
|
-
), p == null || p(re),
|
|
14881
|
+
), p == null || p(re), kt(""), ue(null), Ne([]), Ln(), H(null), oe(""), De(null);
|
|
14886
14882
|
} catch (ie) {
|
|
14887
14883
|
const Ce = (ie == null ? void 0 : ie.message) || "Failed to send message";
|
|
14888
14884
|
ue(Ce), g == null || g(Ce);
|
|
@@ -14890,15 +14886,15 @@ function Ai({
|
|
|
14890
14886
|
}
|
|
14891
14887
|
}, Se = z.useCallback(
|
|
14892
14888
|
(K, re, ie) => {
|
|
14893
|
-
c && (bt.current = Ue, H(K), oe(re),
|
|
14889
|
+
c && (bt.current = Ue, H(K), oe(re), kt(re), ue(null), De({
|
|
14894
14890
|
checkpointId: (ie == null ? void 0 : ie.checkpointId) ?? null,
|
|
14895
14891
|
checkpointNs: (ie == null ? void 0 : ie.checkpointNs) ?? null
|
|
14896
14892
|
}));
|
|
14897
14893
|
},
|
|
14898
|
-
[Ue, c,
|
|
14894
|
+
[Ue, c, kt]
|
|
14899
14895
|
), Ge = z.useCallback(() => {
|
|
14900
|
-
H(null), oe(""), De(null), ue(null),
|
|
14901
|
-
}, [Ue,
|
|
14896
|
+
H(null), oe(""), De(null), ue(null), kt(bt.current ?? Ue), bt.current = null;
|
|
14897
|
+
}, [Ue, kt]), at = Ee(
|
|
14902
14898
|
(K, re, ie) => {
|
|
14903
14899
|
Se(K, re, ie);
|
|
14904
14900
|
},
|
|
@@ -14995,7 +14991,7 @@ function Ai({
|
|
|
14995
14991
|
{
|
|
14996
14992
|
variant: "ghost",
|
|
14997
14993
|
size: "sm",
|
|
14998
|
-
onClick: () =>
|
|
14994
|
+
onClick: () => Tt(!0),
|
|
14999
14995
|
className: "text-red-800 hover:bg-red-100",
|
|
15000
14996
|
"aria-label": "Dismiss error",
|
|
15001
14997
|
children: /* @__PURE__ */ u.jsx(vr, { size: 16 })
|
|
@@ -15067,7 +15063,7 @@ function Ai({
|
|
|
15067
15063
|
checkpointIndexByKey: ct,
|
|
15068
15064
|
activeCheckpointId: M,
|
|
15069
15065
|
onSelectCheckpoint: Kt,
|
|
15070
|
-
timelineCheckpoints:
|
|
15066
|
+
timelineCheckpoints: Et
|
|
15071
15067
|
}
|
|
15072
15068
|
),
|
|
15073
15069
|
($ === "reconnecting" || $ === "connecting") && /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute top-3 right-3 z-20 rounded-full bg-muted/80 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm dark:bg-muted/60", children: /* @__PURE__ */ u.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
@@ -15148,7 +15144,7 @@ function Ai({
|
|
|
15148
15144
|
/* @__PURE__ */ u.jsx(zr, { className: "h-4 w-4 animate-spin" }),
|
|
15149
15145
|
" Uploading Excel file..."
|
|
15150
15146
|
] }),
|
|
15151
|
-
|
|
15147
|
+
Ct && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Ct }),
|
|
15152
15148
|
Qe && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Qe })
|
|
15153
15149
|
] })
|
|
15154
15150
|
] }),
|
|
@@ -15793,14 +15789,14 @@ function Kc({
|
|
|
15793
15789
|
isLoading: g,
|
|
15794
15790
|
actions: x
|
|
15795
15791
|
} = xa(), { loadThread: y } = ya(), { createThread: m, deleteThread: w, renameThread: b } = x, [T, C] = ge(Array.isArray(f) ? f : []), S = et(T.length > 0), k = et(null), N = et(0), [E, I] = ge(null), [_, D] = ge(""), [F, j] = ge(!1);
|
|
15796
|
-
|
|
15792
|
+
Nt(() => {
|
|
15797
15793
|
const G = Array.isArray(f) ? f : [];
|
|
15798
15794
|
if (G.length > 0) {
|
|
15799
15795
|
S.current = !0, C(G);
|
|
15800
15796
|
return;
|
|
15801
15797
|
}
|
|
15802
15798
|
g || (S.current = !1, C(G));
|
|
15803
|
-
}, [f, g]),
|
|
15799
|
+
}, [f, g]), Nt(() => {
|
|
15804
15800
|
if (!k.current) return;
|
|
15805
15801
|
const G = k.current.querySelector(
|
|
15806
15802
|
"[data-radix-scroll-area-viewport]"
|
|
@@ -17267,10 +17263,10 @@ const HT = {
|
|
|
17267
17263
|
};
|
|
17268
17264
|
function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
17269
17265
|
const [r, o] = ge(!1), [s, i] = ge(!1), [a, l] = ge(e), [c, d] = ge(!1), { toast: f } = Xa();
|
|
17270
|
-
|
|
17266
|
+
Nt(() => {
|
|
17271
17267
|
const y = JSON.stringify(a) !== JSON.stringify(e);
|
|
17272
17268
|
d(y);
|
|
17273
|
-
}, [a, e]),
|
|
17269
|
+
}, [a, e]), Nt(() => {
|
|
17274
17270
|
l(e);
|
|
17275
17271
|
}, [e]);
|
|
17276
17272
|
const p = () => {
|