teodor-new-chat-ui 4.3.211 → 4.3.213
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 +244 -243
- package/dist/index.umd.js +14 -14
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -64,8 +64,8 @@ function Dm() {
|
|
|
64
64
|
}
|
|
65
65
|
function b(R, V, se) {
|
|
66
66
|
{
|
|
67
|
-
var be = g.ReactDebugCurrentFrame,
|
|
68
|
-
|
|
67
|
+
var be = g.ReactDebugCurrentFrame, Ge = be.getStackAddendum();
|
|
68
|
+
Ge !== "" && (V += "%s", se = se.concat([Ge]));
|
|
69
69
|
var it = se.map(function(Be) {
|
|
70
70
|
return String(Be);
|
|
71
71
|
});
|
|
@@ -85,8 +85,8 @@ function Dm() {
|
|
|
85
85
|
var be = R.displayName;
|
|
86
86
|
if (be)
|
|
87
87
|
return be;
|
|
88
|
-
var
|
|
89
|
-
return
|
|
88
|
+
var Ge = V.displayName || V.name || "";
|
|
89
|
+
return Ge !== "" ? se + "(" + Ge + ")" : se;
|
|
90
90
|
}
|
|
91
91
|
function L(R) {
|
|
92
92
|
return R.displayName || "Context";
|
|
@@ -126,7 +126,7 @@ function Dm() {
|
|
|
126
126
|
var be = R.displayName || null;
|
|
127
127
|
return be !== null ? be : F(R.type) || "Memo";
|
|
128
128
|
case p: {
|
|
129
|
-
var
|
|
129
|
+
var Ge = R, it = Ge._payload, Be = Ge._init;
|
|
130
130
|
try {
|
|
131
131
|
return F(Be(it));
|
|
132
132
|
} catch {
|
|
@@ -136,14 +136,14 @@ function Dm() {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
var j = Object.assign, $ = 0, A, B, D, O, J, X,
|
|
139
|
+
var j = Object.assign, $ = 0, A, B, D, O, J, X, pe;
|
|
140
140
|
function Ie() {
|
|
141
141
|
}
|
|
142
142
|
Ie.__reactDisabledLog = !0;
|
|
143
143
|
function Ae() {
|
|
144
144
|
{
|
|
145
145
|
if ($ === 0) {
|
|
146
|
-
A = console.log, B = console.info, D = console.warn, O = console.error, J = console.group, X = console.groupCollapsed,
|
|
146
|
+
A = console.log, B = console.info, D = console.warn, O = console.error, J = console.group, X = console.groupCollapsed, pe = console.groupEnd;
|
|
147
147
|
var R = {
|
|
148
148
|
configurable: !0,
|
|
149
149
|
enumerable: !0,
|
|
@@ -191,7 +191,7 @@ function Dm() {
|
|
|
191
191
|
value: X
|
|
192
192
|
}),
|
|
193
193
|
groupEnd: j({}, R, {
|
|
194
|
-
value:
|
|
194
|
+
value: pe
|
|
195
195
|
})
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -204,8 +204,8 @@ function Dm() {
|
|
|
204
204
|
if (q === void 0)
|
|
205
205
|
try {
|
|
206
206
|
throw Error();
|
|
207
|
-
} catch (
|
|
208
|
-
var be =
|
|
207
|
+
} catch (Ge) {
|
|
208
|
+
var be = Ge.stack.trim().match(/\n( *(at )?)/);
|
|
209
209
|
q = be && be[1] || "";
|
|
210
210
|
}
|
|
211
211
|
return `
|
|
@@ -227,7 +227,7 @@ function Dm() {
|
|
|
227
227
|
}
|
|
228
228
|
var be;
|
|
229
229
|
H = !0;
|
|
230
|
-
var
|
|
230
|
+
var Ge = Error.prepareStackTrace;
|
|
231
231
|
Error.prepareStackTrace = void 0;
|
|
232
232
|
var it;
|
|
233
233
|
it = ee.current, ee.current = null, Ae();
|
|
@@ -267,23 +267,23 @@ function Dm() {
|
|
|
267
267
|
if (Ft && be && typeof Ft.stack == "string") {
|
|
268
268
|
for (var $e = Ft.stack.split(`
|
|
269
269
|
`), Ot = be.stack.split(`
|
|
270
|
-
`),
|
|
271
|
-
|
|
272
|
-
for (;
|
|
273
|
-
if ($e[
|
|
274
|
-
if (
|
|
270
|
+
`), bt = $e.length - 1, vt = Ot.length - 1; bt >= 1 && vt >= 0 && $e[bt] !== Ot[vt]; )
|
|
271
|
+
vt--;
|
|
272
|
+
for (; bt >= 1 && vt >= 0; bt--, vt--)
|
|
273
|
+
if ($e[bt] !== Ot[vt]) {
|
|
274
|
+
if (bt !== 1 || vt !== 1)
|
|
275
275
|
do
|
|
276
|
-
if (
|
|
276
|
+
if (bt--, vt--, vt < 0 || $e[bt] !== Ot[vt]) {
|
|
277
277
|
var Kt = `
|
|
278
|
-
` + $e[
|
|
278
|
+
` + $e[bt].replace(" at new ", " at ");
|
|
279
279
|
return R.displayName && Kt.includes("<anonymous>") && (Kt = Kt.replace("<anonymous>", R.displayName)), typeof R == "function" && te.set(R, Kt), Kt;
|
|
280
280
|
}
|
|
281
|
-
while (
|
|
281
|
+
while (bt >= 1 && vt >= 0);
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
} finally {
|
|
286
|
-
H = !1, ee.current = it, K(), Error.prepareStackTrace =
|
|
286
|
+
H = !1, ee.current = it, K(), Error.prepareStackTrace = Ge;
|
|
287
287
|
}
|
|
288
288
|
var Fn = R ? R.displayName || R.name : "", Nn = Fn ? M(Fn) : "";
|
|
289
289
|
return typeof R == "function" && te.set(R, Nn), Nn;
|
|
@@ -315,9 +315,9 @@ function Dm() {
|
|
|
315
315
|
case f:
|
|
316
316
|
return de(R.type, V, se);
|
|
317
317
|
case p: {
|
|
318
|
-
var be = R,
|
|
318
|
+
var be = R, Ge = be._payload, it = be._init;
|
|
319
319
|
try {
|
|
320
|
-
return de(it(
|
|
320
|
+
return de(it(Ge), V, se);
|
|
321
321
|
} catch {
|
|
322
322
|
}
|
|
323
323
|
}
|
|
@@ -332,7 +332,7 @@ function Dm() {
|
|
|
332
332
|
} else
|
|
333
333
|
Le.setExtraStackFrame(null);
|
|
334
334
|
}
|
|
335
|
-
function He(R, V, se, be,
|
|
335
|
+
function He(R, V, se, be, Ge) {
|
|
336
336
|
{
|
|
337
337
|
var it = Function.call.bind(Ee);
|
|
338
338
|
for (var Be in R)
|
|
@@ -344,10 +344,10 @@ function Dm() {
|
|
|
344
344
|
throw Ot.name = "Invariant Violation", Ot;
|
|
345
345
|
}
|
|
346
346
|
$e = R[Be](V, Be, be, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
347
|
-
} catch (
|
|
348
|
-
$e =
|
|
347
|
+
} catch (bt) {
|
|
348
|
+
$e = bt;
|
|
349
349
|
}
|
|
350
|
-
$e && !($e instanceof Error) && (Je(
|
|
350
|
+
$e && !($e instanceof Error) && (Je(Ge), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", be || "React class", se, Be, typeof $e), Je(null)), $e instanceof Error && !($e.message in Ne) && (Ne[$e.message] = !0, Je(Ge), w("Failed %s type: %s", se, $e.message), Je(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -355,7 +355,7 @@ function Dm() {
|
|
|
355
355
|
function Ke(R) {
|
|
356
356
|
return Ve(R);
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function Xe(R) {
|
|
359
359
|
{
|
|
360
360
|
var V = typeof Symbol == "function" && Symbol.toStringTag, se = V && R[Symbol.toStringTag] || R.constructor.name || "Object";
|
|
361
361
|
return se;
|
|
@@ -373,14 +373,14 @@ function Dm() {
|
|
|
373
373
|
}
|
|
374
374
|
function Nt(R) {
|
|
375
375
|
if (Ze(R))
|
|
376
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
376
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(R)), tt(R);
|
|
377
377
|
}
|
|
378
378
|
var ht = g.ReactCurrentOwner, lt = {
|
|
379
379
|
key: !0,
|
|
380
380
|
ref: !0,
|
|
381
381
|
__self: !0,
|
|
382
382
|
__source: !0
|
|
383
|
-
}, ce,
|
|
383
|
+
}, ce, fe;
|
|
384
384
|
function he(R) {
|
|
385
385
|
if (Ee.call(R, "ref")) {
|
|
386
386
|
var V = Object.getOwnPropertyDescriptor(R, "ref").get;
|
|
@@ -389,7 +389,7 @@ function Dm() {
|
|
|
389
389
|
}
|
|
390
390
|
return R.ref !== void 0;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function qe(R) {
|
|
393
393
|
if (Ee.call(R, "key")) {
|
|
394
394
|
var V = Object.getOwnPropertyDescriptor(R, "key").get;
|
|
395
395
|
if (V && V.isReactWarning)
|
|
@@ -400,7 +400,7 @@ function Dm() {
|
|
|
400
400
|
function Fe(R, V) {
|
|
401
401
|
typeof R.ref == "string" && ht.current;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function yt(R, V) {
|
|
404
404
|
{
|
|
405
405
|
var se = function() {
|
|
406
406
|
ce || (ce = !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));
|
|
@@ -414,7 +414,7 @@ function Dm() {
|
|
|
414
414
|
function At(R, V) {
|
|
415
415
|
{
|
|
416
416
|
var se = function() {
|
|
417
|
-
|
|
417
|
+
fe || (fe = !0, w("%s: `ref` 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));
|
|
418
418
|
};
|
|
419
419
|
se.isReactWarning = !0, Object.defineProperty(R, "ref", {
|
|
420
420
|
get: se,
|
|
@@ -422,7 +422,7 @@ function Dm() {
|
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
var st = function(R, V, se, be,
|
|
425
|
+
var st = function(R, V, se, be, Ge, it, Be) {
|
|
426
426
|
var $e = {
|
|
427
427
|
// This tag allows us to uniquely identify this as a React Element
|
|
428
428
|
$$typeof: t,
|
|
@@ -448,25 +448,25 @@ function Dm() {
|
|
|
448
448
|
configurable: !1,
|
|
449
449
|
enumerable: !1,
|
|
450
450
|
writable: !1,
|
|
451
|
-
value:
|
|
451
|
+
value: Ge
|
|
452
452
|
}), Object.freeze && (Object.freeze($e.props), Object.freeze($e)), $e;
|
|
453
453
|
};
|
|
454
|
-
function ze(R, V, se, be,
|
|
454
|
+
function ze(R, V, se, be, Ge) {
|
|
455
455
|
{
|
|
456
456
|
var it, Be = {}, $e = null, Ot = null;
|
|
457
|
-
se !== void 0 && (Nt(se), $e = "" + se),
|
|
457
|
+
se !== void 0 && (Nt(se), $e = "" + se), qe(V) && (Nt(V.key), $e = "" + V.key), he(V) && (Ot = V.ref, Fe(V, Ge));
|
|
458
458
|
for (it in V)
|
|
459
459
|
Ee.call(V, it) && !lt.hasOwnProperty(it) && (Be[it] = V[it]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
461
|
-
var
|
|
462
|
-
for (it in
|
|
463
|
-
Be[it] === void 0 && (Be[it] =
|
|
461
|
+
var bt = R.defaultProps;
|
|
462
|
+
for (it in bt)
|
|
463
|
+
Be[it] === void 0 && (Be[it] = bt[it]);
|
|
464
464
|
}
|
|
465
465
|
if ($e || Ot) {
|
|
466
|
-
var
|
|
467
|
-
$e &&
|
|
466
|
+
var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
|
|
467
|
+
$e && yt(Be, vt), Ot && At(Be, vt);
|
|
468
468
|
}
|
|
469
|
-
return st(R, $e, Ot,
|
|
469
|
+
return st(R, $e, Ot, Ge, be, ht.current, Be);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
var Pt = g.ReactCurrentOwner, jt = g.ReactDebugCurrentFrame;
|
|
@@ -535,9 +535,9 @@ Check the top-level render call using <` + se + ">.");
|
|
|
535
535
|
else if (ye(R))
|
|
536
536
|
R._store && (R._store.validated = !0);
|
|
537
537
|
else if (R) {
|
|
538
|
-
var
|
|
539
|
-
if (typeof
|
|
540
|
-
for (var it =
|
|
538
|
+
var Ge = y(R);
|
|
539
|
+
if (typeof Ge == "function" && Ge !== R.entries)
|
|
540
|
+
for (var it = Ge.call(R), Be; !(Be = it.next()).done; )
|
|
541
541
|
ye(Be.value) && Vt(Be.value, V);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
@@ -561,8 +561,8 @@ Check the top-level render call using <` + se + ">.");
|
|
|
561
561
|
He(se, R.props, "prop", be, R);
|
|
562
562
|
} else if (V.PropTypes !== void 0 && !we) {
|
|
563
563
|
we = !0;
|
|
564
|
-
var
|
|
565
|
-
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
564
|
+
var Ge = F(V);
|
|
565
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ge || "Unknown");
|
|
566
566
|
}
|
|
567
567
|
typeof V.getDefaultProps == "function" && !V.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
568
568
|
}
|
|
@@ -580,7 +580,7 @@ Check the top-level render call using <` + se + ">.");
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
var Jn = {};
|
|
583
|
-
function Ln(R, V, se, be,
|
|
583
|
+
function Ln(R, V, se, be, Ge, it) {
|
|
584
584
|
{
|
|
585
585
|
var Be = I(R);
|
|
586
586
|
if (!Be) {
|
|
@@ -588,12 +588,12 @@ Check the top-level render call using <` + se + ">.");
|
|
|
588
588
|
(R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && ($e += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
589
589
|
var Ot = mt();
|
|
590
590
|
Ot ? $e += Ot : $e += pt();
|
|
591
|
-
var
|
|
592
|
-
R === null ?
|
|
591
|
+
var bt;
|
|
592
|
+
R === null ? bt = "null" : Ke(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (F(R.type) || "Unknown") + " />", $e = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, $e);
|
|
593
593
|
}
|
|
594
|
-
var
|
|
595
|
-
if (
|
|
596
|
-
return
|
|
594
|
+
var vt = ze(R, V, se, Ge, it);
|
|
595
|
+
if (vt == null)
|
|
596
|
+
return vt;
|
|
597
597
|
if (Be) {
|
|
598
598
|
var Kt = V.children;
|
|
599
599
|
if (Kt !== void 0)
|
|
@@ -621,7 +621,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
621
621
|
<%s key={someKey} {...props} />`, Dr, Nn, G, Nn), Jn[Nn + Dr] = !0;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
return R === r ? Dn(
|
|
624
|
+
return R === r ? Dn(vt) : Ct(vt), vt;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
function ti(R, V, se) {
|
|
@@ -1880,8 +1880,8 @@ const xu = (e) => {
|
|
|
1880
1880
|
method: "POST",
|
|
1881
1881
|
body: g,
|
|
1882
1882
|
duplex: "half"
|
|
1883
|
-
}),
|
|
1884
|
-
if (_.isFormData(g) && (
|
|
1883
|
+
}), pe;
|
|
1884
|
+
if (_.isFormData(g) && (pe = X.headers.get("content-type")) && N.setContentType(pe), X.body) {
|
|
1885
1885
|
const [Ie, Ae] = wl(
|
|
1886
1886
|
$,
|
|
1887
1887
|
Xo(bl(S))
|
|
@@ -1907,8 +1907,8 @@ const xu = (e) => {
|
|
|
1907
1907
|
["status", "statusText", "headers"].forEach((K) => {
|
|
1908
1908
|
X[K] = D[K];
|
|
1909
1909
|
});
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1910
|
+
const pe = _.toFiniteNumber(D.headers.get("content-length")), [Ie, Ae] = C && wl(
|
|
1911
|
+
pe,
|
|
1912
1912
|
Xo(bl(C), !0)
|
|
1913
1913
|
) || [];
|
|
1914
1914
|
D = new r(
|
|
@@ -1920,8 +1920,8 @@ const xu = (e) => {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
k = k || "text";
|
|
1922
1922
|
let J = await f[_.findKey(f, k) || "text"](D, m);
|
|
1923
|
-
return !O && j && j(), await new Promise((X,
|
|
1924
|
-
mu(X,
|
|
1923
|
+
return !O && j && j(), await new Promise((X, pe) => {
|
|
1924
|
+
mu(X, pe, {
|
|
1925
1925
|
data: J,
|
|
1926
1926
|
headers: Yt.from(D.headers),
|
|
1927
1927
|
status: D.status,
|
|
@@ -3415,14 +3415,14 @@ function Kx(e = {}) {
|
|
|
3415
3415
|
threadId: j.threadId ?? null,
|
|
3416
3416
|
headers: {}
|
|
3417
3417
|
}, (async () => {
|
|
3418
|
-
var
|
|
3418
|
+
var pe, Ie, Ae, K, ee, q, M, H, te, oe, ne, Te, Z, de, Ee, Ne, Le, Je;
|
|
3419
3419
|
const X = (He) => {
|
|
3420
3420
|
var Ve;
|
|
3421
3421
|
try {
|
|
3422
3422
|
const Ke = JSON.parse(JSON.stringify(He));
|
|
3423
|
-
return (Ve = Ke == null ? void 0 : Ke.payload) != null && Ve.files_info && Array.isArray(Ke.payload.files_info) && (Ke.payload.files_info = Ke.payload.files_info.map((
|
|
3424
|
-
...
|
|
3425
|
-
data:
|
|
3423
|
+
return (Ve = Ke == null ? void 0 : Ke.payload) != null && Ve.files_info && Array.isArray(Ke.payload.files_info) && (Ke.payload.files_info = Ke.payload.files_info.map((Xe) => ({
|
|
3424
|
+
...Xe,
|
|
3425
|
+
data: Xe != null && Xe.data ? `<base64 ${String(Xe.data).length} chars>` : Xe == null ? void 0 : Xe.data
|
|
3426
3426
|
}))), Ke;
|
|
3427
3427
|
} catch {
|
|
3428
3428
|
return He;
|
|
@@ -3434,7 +3434,7 @@ function Kx(e = {}) {
|
|
|
3434
3434
|
if (r)
|
|
3435
3435
|
He = { Authorization: `Bearer ${r}` };
|
|
3436
3436
|
else if (typeof window < "u") {
|
|
3437
|
-
const ze = window.__AUTH_TOKEN__, Pt = ((
|
|
3437
|
+
const ze = window.__AUTH_TOKEN__, Pt = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
|
|
3438
3438
|
let jt = null;
|
|
3439
3439
|
try {
|
|
3440
3440
|
const we = (Ie = window.localStorage) == null ? void 0 : Ie.getItem("chat-settings");
|
|
@@ -3462,13 +3462,13 @@ function Kx(e = {}) {
|
|
|
3462
3462
|
...He,
|
|
3463
3463
|
...Ve,
|
|
3464
3464
|
...s.current
|
|
3465
|
-
},
|
|
3465
|
+
}, Xe = {
|
|
3466
3466
|
"Content-Type": "application/json",
|
|
3467
3467
|
Accept: "text/event-stream",
|
|
3468
3468
|
...Ke
|
|
3469
3469
|
}, Ze = await fetch(t + n, {
|
|
3470
3470
|
method: "POST",
|
|
3471
|
-
headers:
|
|
3471
|
+
headers: Xe,
|
|
3472
3472
|
body: JSON.stringify(j),
|
|
3473
3473
|
signal: B.signal,
|
|
3474
3474
|
credentials: i
|
|
@@ -3487,18 +3487,18 @@ function Kx(e = {}) {
|
|
|
3487
3487
|
const tt = Ze.body.getReader(), Nt = new TextDecoder();
|
|
3488
3488
|
let ht = "", lt = [];
|
|
3489
3489
|
C.current = 0, y(0);
|
|
3490
|
-
let ce = 0,
|
|
3490
|
+
let ce = 0, fe = null;
|
|
3491
3491
|
const he = () => {
|
|
3492
3492
|
if (lt.length) {
|
|
3493
3493
|
const st = lt.join("");
|
|
3494
3494
|
lt = [], T.current && p((ze) => ze + st);
|
|
3495
3495
|
}
|
|
3496
|
-
|
|
3497
|
-
},
|
|
3498
|
-
typeof window < "u" &&
|
|
3496
|
+
fe = null;
|
|
3497
|
+
}, qe = () => {
|
|
3498
|
+
typeof window < "u" && fe == null && (fe = requestAnimationFrame(he));
|
|
3499
3499
|
};
|
|
3500
3500
|
let Fe = Date.now();
|
|
3501
|
-
const
|
|
3501
|
+
const yt = setInterval(() => {
|
|
3502
3502
|
var st;
|
|
3503
3503
|
if (Date.now() - Fe > 18e5) {
|
|
3504
3504
|
const ze = "Stream idle timeout";
|
|
@@ -3567,10 +3567,10 @@ function Kx(e = {}) {
|
|
|
3567
3567
|
console.error("[use-chat] Error in onEvent callback:", ct, "for event:", Pe.type);
|
|
3568
3568
|
}
|
|
3569
3569
|
if (Pe.type === "token" && e.autoAppendAssistant !== !1)
|
|
3570
|
-
lt.push(Pe.content),
|
|
3570
|
+
lt.push(Pe.content), qe();
|
|
3571
3571
|
else if (Pe.type === "message_delta") {
|
|
3572
3572
|
const ct = Pe.delta.filter((Ct) => Ct.type === "text").map((Ct) => Ct.text).join("");
|
|
3573
|
-
ct && e.autoAppendAssistant !== !1 && (lt.push(ct),
|
|
3573
|
+
ct && e.autoAppendAssistant !== !1 && (lt.push(ct), qe());
|
|
3574
3574
|
} else if (Pe.type === "heartbeat") {
|
|
3575
3575
|
console.debug("[use-chat] heartbeat received");
|
|
3576
3576
|
try {
|
|
@@ -3578,7 +3578,7 @@ function Kx(e = {}) {
|
|
|
3578
3578
|
} catch (ct) {
|
|
3579
3579
|
console.warn("[use-chat] heartbeat callback failed", ct);
|
|
3580
3580
|
}
|
|
3581
|
-
} else if (
|
|
3581
|
+
} else if (fe !== null && cancelAnimationFrame(fe), he(), Pe.type === "checkpoint")
|
|
3582
3582
|
m(Pe.checkpointId);
|
|
3583
3583
|
else if (Pe.type === "error") {
|
|
3584
3584
|
const ct = Pe;
|
|
@@ -3609,7 +3609,7 @@ function Kx(e = {}) {
|
|
|
3609
3609
|
} finally {
|
|
3610
3610
|
(Ee = tt.releaseLock) == null || Ee.call(tt);
|
|
3611
3611
|
}
|
|
3612
|
-
|
|
3612
|
+
fe !== null && typeof window < "u" && window.cancelAnimationFrame(fe), clearInterval(yt);
|
|
3613
3613
|
}
|
|
3614
3614
|
} catch (He) {
|
|
3615
3615
|
if (He.name === "AbortError")
|
|
@@ -3619,14 +3619,14 @@ function Kx(e = {}) {
|
|
|
3619
3619
|
D = "error", O = Ve, d(Ve), (Ne = A == null ? void 0 : A.onError) == null || Ne.call(A, Ve), J || ((Le = A == null ? void 0 : A.onConnectionError) == null || Le.call(A, Ve), J = !0);
|
|
3620
3620
|
}
|
|
3621
3621
|
} finally {
|
|
3622
|
-
const He = C.current, Ve = k.current, Ke = N.current,
|
|
3622
|
+
const He = C.current, Ve = k.current, Ke = N.current, Xe = E.current, Ze = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
|
|
3623
3623
|
try {
|
|
3624
3624
|
(Je = A == null ? void 0 : A.onClosed) == null || Je.call(A, {
|
|
3625
3625
|
reason: Ze,
|
|
3626
3626
|
lastSeq: He,
|
|
3627
3627
|
lastCheckpointId: Ve,
|
|
3628
3628
|
lastCheckpointNs: Ke,
|
|
3629
|
-
lastStateHistory:
|
|
3629
|
+
lastStateHistory: Xe,
|
|
3630
3630
|
error: O
|
|
3631
3631
|
});
|
|
3632
3632
|
} catch (tt) {
|
|
@@ -3875,7 +3875,7 @@ function Xx({
|
|
|
3875
3875
|
onThreadChange: a,
|
|
3876
3876
|
checkpointMetadataCache: l
|
|
3877
3877
|
}) {
|
|
3878
|
-
const { api: c, baseUrl: d } = Tu(), f = at(() => _n(d), [d]), [p, h] = xe([]), [m, x] = xe(t), [y, g] = xe(!1), [w, b] = xe(null), [T, C] = xe(!1), [S, k] = xe(null), { state: N, seed: E, prepend: I, pushUser: P, onEvent: L } = Bx(), [F, j] = xe(!1), [$, A] = xe(!1), [B, D] = xe(null), [O, J] = xe([]), [X,
|
|
3878
|
+
const { api: c, baseUrl: d } = Tu(), f = at(() => _n(d), [d]), [p, h] = xe([]), [m, x] = xe(t), [y, g] = xe(!1), [w, b] = xe(null), [T, C] = xe(!1), [S, k] = xe(null), { state: N, seed: E, prepend: I, pushUser: P, onEvent: L } = Bx(), [F, j] = xe(!1), [$, A] = xe(!1), [B, D] = xe(null), [O, J] = xe([]), [X, pe] = xe(!1), Ie = l ?? Lx(), { setCacheForThread: Ae } = Ie, K = Qe(m), ee = Qe(null);
|
|
3879
3879
|
kt(() => {
|
|
3880
3880
|
K.current = m;
|
|
3881
3881
|
}, [m]);
|
|
@@ -3895,18 +3895,18 @@ function Xx({
|
|
|
3895
3895
|
const ce = await c.listThreads();
|
|
3896
3896
|
h(ce ?? []);
|
|
3897
3897
|
} catch (ce) {
|
|
3898
|
-
const
|
|
3899
|
-
b(
|
|
3898
|
+
const fe = String(ce);
|
|
3899
|
+
b(fe), s == null || s(fe);
|
|
3900
3900
|
} finally {
|
|
3901
3901
|
g(!1);
|
|
3902
3902
|
}
|
|
3903
3903
|
}, [c, s]), Z = ke(
|
|
3904
3904
|
async (ce) => {
|
|
3905
3905
|
try {
|
|
3906
|
-
const
|
|
3907
|
-
return x(
|
|
3908
|
-
} catch (
|
|
3909
|
-
return s == null || s(String(
|
|
3906
|
+
const fe = await c.createThread(ce);
|
|
3907
|
+
return x(fe.threadId), await Te(), fe.threadId;
|
|
3908
|
+
} catch (fe) {
|
|
3909
|
+
return s == null || s(String(fe)), null;
|
|
3910
3910
|
}
|
|
3911
3911
|
},
|
|
3912
3912
|
[c, Te, s]
|
|
@@ -3914,48 +3914,49 @@ function Xx({
|
|
|
3914
3914
|
async (ce) => {
|
|
3915
3915
|
try {
|
|
3916
3916
|
await c.deleteThread(ce), K.current === ce && (x(null), E([], {})), await Te();
|
|
3917
|
-
} catch (
|
|
3918
|
-
s == null || s(String(
|
|
3917
|
+
} catch (fe) {
|
|
3918
|
+
s == null || s(String(fe));
|
|
3919
3919
|
}
|
|
3920
3920
|
},
|
|
3921
3921
|
[c, Te, E, s]
|
|
3922
3922
|
), Ee = ke(
|
|
3923
|
-
async (ce,
|
|
3923
|
+
async (ce, fe) => {
|
|
3924
3924
|
try {
|
|
3925
|
-
await c.updateThread(ce,
|
|
3925
|
+
await c.updateThread(ce, fe), await Te();
|
|
3926
3926
|
} catch (he) {
|
|
3927
3927
|
s == null || s(String(he));
|
|
3928
3928
|
}
|
|
3929
3929
|
},
|
|
3930
3930
|
[c, Te, s]
|
|
3931
3931
|
), Ne = ke(
|
|
3932
|
-
(ce,
|
|
3933
|
-
const
|
|
3932
|
+
(ce, fe, he) => {
|
|
3933
|
+
const qe = fe.filter((Fe) => Fe.checkpointId).map((Fe) => ({
|
|
3934
3934
|
checkpointId: Fe.checkpointId,
|
|
3935
3935
|
checkpointNs: Fe.checkpointNs ?? void 0,
|
|
3936
3936
|
createdAt: Fe.createdAt ?? ""
|
|
3937
3937
|
}));
|
|
3938
|
-
console.log(`[ChatSessionProvider] Cached metadata for ${
|
|
3938
|
+
console.log(`[ChatSessionProvider] Cached metadata for ${qe.length} checkpoints from ${he}`), Ae(ce, qe);
|
|
3939
3939
|
},
|
|
3940
3940
|
[Ae]
|
|
3941
3941
|
), Le = ke(
|
|
3942
|
-
async (ce,
|
|
3942
|
+
async (ce, fe) => {
|
|
3943
3943
|
if (ce) {
|
|
3944
3944
|
C(!0), k(null);
|
|
3945
3945
|
try {
|
|
3946
3946
|
const he = await c.getStateHistory({
|
|
3947
3947
|
threadId: ce,
|
|
3948
|
-
checkpointId:
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3948
|
+
checkpointId: fe || void 0
|
|
3949
|
+
// Let backend pick latest if not specified
|
|
3950
|
+
}), { checkpoints: qe } = Ur(he);
|
|
3951
|
+
Ne(ce, qe, `thread load (requested: ${fe})`);
|
|
3952
|
+
const Fe = qe.find((yt) => yt.messages && yt.messages.length > 0) ?? (fe ? qe.find((yt) => yt.checkpointId === fe) : null) ?? qe[0];
|
|
3952
3953
|
E((Fe == null ? void 0 : Fe.messages) ?? [], {
|
|
3953
3954
|
checkpointId: (Fe == null ? void 0 : Fe.checkpointId) ?? null,
|
|
3954
3955
|
checkpointNs: (Fe == null ? void 0 : Fe.checkpointNs) ?? null
|
|
3955
|
-
}), J(
|
|
3956
|
+
}), J(qe), j(!!(Fe != null && Fe.nextCursor)), D((Fe == null ? void 0 : Fe.nextCursor) ?? null);
|
|
3956
3957
|
} catch (he) {
|
|
3957
|
-
const
|
|
3958
|
-
k(
|
|
3958
|
+
const qe = String(he);
|
|
3959
|
+
k(qe), s == null || s(qe);
|
|
3959
3960
|
} finally {
|
|
3960
3961
|
C(!1);
|
|
3961
3962
|
}
|
|
@@ -3967,41 +3968,41 @@ function Xx({
|
|
|
3967
3968
|
q.current = Le;
|
|
3968
3969
|
}, [Le]);
|
|
3969
3970
|
const Je = ke(
|
|
3970
|
-
async (ce,
|
|
3971
|
+
async (ce, fe) => {
|
|
3971
3972
|
const he = K.current;
|
|
3972
3973
|
if (he) {
|
|
3973
|
-
|
|
3974
|
+
pe(!0);
|
|
3974
3975
|
try {
|
|
3975
|
-
const
|
|
3976
|
+
const qe = await c.getStateHistory({
|
|
3976
3977
|
threadId: he,
|
|
3977
3978
|
checkpointId: ce,
|
|
3978
|
-
checkpointNs:
|
|
3979
|
-
}), { checkpoints: Fe } = Ur(
|
|
3979
|
+
checkpointNs: fe ?? void 0
|
|
3980
|
+
}), { checkpoints: Fe } = Ur(qe);
|
|
3980
3981
|
Ne(he, Fe, "checkpoint navigation");
|
|
3981
|
-
const
|
|
3982
|
-
(At) => At.checkpointId === ce && (
|
|
3982
|
+
const yt = Fe.find(
|
|
3983
|
+
(At) => At.checkpointId === ce && (fe ? At.checkpointNs === fe : !0)
|
|
3983
3984
|
);
|
|
3984
|
-
if (!
|
|
3985
|
-
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs:
|
|
3985
|
+
if (!yt) {
|
|
3986
|
+
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs: fe });
|
|
3986
3987
|
return;
|
|
3987
3988
|
}
|
|
3988
|
-
J(Fe), E(
|
|
3989
|
-
checkpointId:
|
|
3990
|
-
checkpointNs:
|
|
3989
|
+
J(Fe), E(yt.messages ?? [], {
|
|
3990
|
+
checkpointId: yt.checkpointId ?? null,
|
|
3991
|
+
checkpointNs: yt.checkpointNs ?? null
|
|
3991
3992
|
});
|
|
3992
|
-
} catch (
|
|
3993
|
-
s == null || s(String(
|
|
3993
|
+
} catch (qe) {
|
|
3994
|
+
s == null || s(String(qe));
|
|
3994
3995
|
} finally {
|
|
3995
|
-
|
|
3996
|
+
pe(!1);
|
|
3996
3997
|
}
|
|
3997
3998
|
}
|
|
3998
3999
|
},
|
|
3999
4000
|
[c, E, s, Ne]
|
|
4000
4001
|
), He = ke(
|
|
4001
|
-
(ce,
|
|
4002
|
+
(ce, fe) => {
|
|
4002
4003
|
E(N.messages, {
|
|
4003
4004
|
checkpointId: ce ?? null,
|
|
4004
|
-
checkpointNs:
|
|
4005
|
+
checkpointNs: fe ?? null
|
|
4005
4006
|
});
|
|
4006
4007
|
},
|
|
4007
4008
|
[E, N.messages]
|
|
@@ -4014,9 +4015,9 @@ function Xx({
|
|
|
4014
4015
|
const ce = await c.getStateHistory({
|
|
4015
4016
|
threadId: K.current,
|
|
4016
4017
|
checkpointId: B
|
|
4017
|
-
}), { checkpoints:
|
|
4018
|
-
if (
|
|
4019
|
-
const he =
|
|
4018
|
+
}), { checkpoints: fe } = Ur(ce);
|
|
4019
|
+
if (fe.length > 0) {
|
|
4020
|
+
const he = fe[fe.length - 1];
|
|
4020
4021
|
I((he == null ? void 0 : he.messages) ?? []), j(!!(he != null && he.nextCursor)), D((he == null ? void 0 : he.nextCursor) ?? null);
|
|
4021
4022
|
}
|
|
4022
4023
|
} catch (ce) {
|
|
@@ -4025,26 +4026,26 @@ function Xx({
|
|
|
4025
4026
|
A(!1);
|
|
4026
4027
|
}
|
|
4027
4028
|
}
|
|
4028
|
-
}, [c, B, I, s]),
|
|
4029
|
+
}, [c, B, I, s]), Xe = ke(async () => {
|
|
4029
4030
|
E([], {}), J([]), j(!1), D(null);
|
|
4030
4031
|
}, [E]), Ze = ke(
|
|
4031
|
-
async (ce,
|
|
4032
|
-
console.log("[ChatSessionProvider] Interrupt:", ce,
|
|
4032
|
+
async (ce, fe) => {
|
|
4033
|
+
console.log("[ChatSessionProvider] Interrupt:", ce, fe);
|
|
4033
4034
|
},
|
|
4034
4035
|
[]
|
|
4035
4036
|
);
|
|
4036
4037
|
kt(() => {
|
|
4037
4038
|
Te();
|
|
4038
4039
|
}, [Te]), kt(() => {
|
|
4039
|
-
var ce,
|
|
4040
|
-
!o || !m || T || ee.current !== m && (ee.current = m, n ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", n), (ce = q.current) == null || ce.call(q, m, n)) : (console.log("[ChatSessionProvider] Loading thread with latest checkpoint"), (
|
|
4040
|
+
var ce, fe;
|
|
4041
|
+
!o || !m || T || ee.current !== m && (ee.current = m, n ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", n), (ce = q.current) == null || ce.call(q, m, n)) : (console.log("[ChatSessionProvider] Loading thread with latest checkpoint"), (fe = q.current) == null || fe.call(q, m)));
|
|
4041
4042
|
}, [o, m, T, n, r]), kt(() => {
|
|
4042
4043
|
a == null || a(m);
|
|
4043
4044
|
}, [m, a]);
|
|
4044
4045
|
const tt = ke(
|
|
4045
|
-
async (ce,
|
|
4046
|
-
const he = K.current,
|
|
4047
|
-
if (!he && !
|
|
4046
|
+
async (ce, fe) => {
|
|
4047
|
+
const he = K.current, qe = (ce == null ? void 0 : ce.text) ?? "";
|
|
4048
|
+
if (!he && !qe) return;
|
|
4048
4049
|
if (!he) {
|
|
4049
4050
|
await Z("New Chat");
|
|
4050
4051
|
return;
|
|
@@ -4052,19 +4053,19 @@ function Xx({
|
|
|
4052
4053
|
const { contentParts: Fe } = await wx(
|
|
4053
4054
|
c,
|
|
4054
4055
|
(ce == null ? void 0 : ce.attachments) ?? []
|
|
4055
|
-
),
|
|
4056
|
-
|
|
4056
|
+
), yt = [...Fe];
|
|
4057
|
+
qe != null && qe.trim() && yt.push({ type: "text", text: qe });
|
|
4057
4058
|
const At = {
|
|
4058
4059
|
id: `msg-${Date.now()}`,
|
|
4059
4060
|
role: "user",
|
|
4060
|
-
content:
|
|
4061
|
+
content: yt,
|
|
4061
4062
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4062
4063
|
};
|
|
4063
4064
|
P(At);
|
|
4064
4065
|
const st = {
|
|
4065
4066
|
threadId: he,
|
|
4066
|
-
checkpointId: (
|
|
4067
|
-
checkpointNs: (
|
|
4067
|
+
checkpointId: (fe == null ? void 0 : fe.checkpointId) ?? N.lastCheckpointId ?? void 0,
|
|
4068
|
+
checkpointNs: (fe == null ? void 0 : fe.checkpointNs) ?? N.lastCheckpointNs ?? void 0
|
|
4068
4069
|
};
|
|
4069
4070
|
M(st);
|
|
4070
4071
|
},
|
|
@@ -4101,12 +4102,12 @@ function Xx({
|
|
|
4101
4102
|
error: S,
|
|
4102
4103
|
hasMore: F,
|
|
4103
4104
|
loadOlder: Ke,
|
|
4104
|
-
clearState:
|
|
4105
|
+
clearState: Xe,
|
|
4105
4106
|
navigateToCheckpoint: Je,
|
|
4106
4107
|
setCurrentCheckpointId: He,
|
|
4107
4108
|
returnToLatest: Ve,
|
|
4108
4109
|
loadThread: Le,
|
|
4109
|
-
clearThread:
|
|
4110
|
+
clearThread: Xe,
|
|
4110
4111
|
respondToInterrupt: Ze
|
|
4111
4112
|
}),
|
|
4112
4113
|
[
|
|
@@ -4119,7 +4120,7 @@ function Xx({
|
|
|
4119
4120
|
S,
|
|
4120
4121
|
F,
|
|
4121
4122
|
Ke,
|
|
4122
|
-
|
|
4123
|
+
Xe,
|
|
4123
4124
|
Je,
|
|
4124
4125
|
He,
|
|
4125
4126
|
Ve,
|
|
@@ -4284,11 +4285,11 @@ function Qx({
|
|
|
4284
4285
|
try {
|
|
4285
4286
|
const X = l(A);
|
|
4286
4287
|
X && typeof X.then == "function" ? X.then(() => {
|
|
4287
|
-
var
|
|
4288
|
-
((
|
|
4288
|
+
var pe, Ie;
|
|
4289
|
+
((pe = S.current) == null ? void 0 : pe.id) === B && S.current.shouldClear && (m || (y(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((Ie = S.current) == null ? void 0 : Ie.id) === B && (S.current = null);
|
|
4289
4290
|
}).catch(() => {
|
|
4290
|
-
var
|
|
4291
|
-
((
|
|
4291
|
+
var pe;
|
|
4292
|
+
((pe = S.current) == null ? void 0 : pe.id) === B && (S.current = null);
|
|
4292
4293
|
}) : (((D = S.current) == null ? void 0 : D.id) === B && S.current.shouldClear && (m || (y(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((O = S.current) == null ? void 0 : O.id) === B && (S.current = null));
|
|
4293
4294
|
} catch {
|
|
4294
4295
|
((J = S.current) == null ? void 0 : J.id) === B && (S.current = null);
|
|
@@ -6272,7 +6273,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6272
6273
|
Lt(() => {
|
|
6273
6274
|
B && (X == null || X());
|
|
6274
6275
|
}, [B, X]);
|
|
6275
|
-
const
|
|
6276
|
+
const pe = (q = D.arrow) == null ? void 0 : q.x, Ie = (M = D.arrow) == null ? void 0 : M.y, Ae = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [K, ee] = v.useState();
|
|
6276
6277
|
return Lt(() => {
|
|
6277
6278
|
g && ee(window.getComputedStyle(g).zIndex);
|
|
6278
6279
|
}, [g]), /* @__PURE__ */ u.jsx(
|
|
@@ -6305,7 +6306,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6305
6306
|
scope: n,
|
|
6306
6307
|
placedSide: O,
|
|
6307
6308
|
onArrowChange: C,
|
|
6308
|
-
arrowX:
|
|
6309
|
+
arrowX: pe,
|
|
6309
6310
|
arrowY: Ie,
|
|
6310
6311
|
shouldHideArrow: Ae,
|
|
6311
6312
|
children: /* @__PURE__ */ u.jsx(
|
|
@@ -7271,15 +7272,15 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7271
7272
|
...x
|
|
7272
7273
|
} = e, y = fr(an, n), g = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = We(t, k, y.onContentChange), E = v.useRef(0), I = v.useRef(""), P = v.useRef(0), L = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = m ? Ds : v.Fragment, A = m ? { as: rb, allowPinchZoom: !0 } : void 0, B = (O) => {
|
|
7273
7274
|
var q, M;
|
|
7274
|
-
const J = I.current + O, X = T().filter((H) => !H.disabled),
|
|
7275
|
+
const J = I.current + O, X = T().filter((H) => !H.disabled), pe = document.activeElement, Ie = (q = X.find((H) => H.ref.current === pe)) == null ? void 0 : q.textValue, Ae = X.map((H) => H.textValue), K = mb(Ae, J, Ie), ee = (M = X.find((H) => H.textValue === K)) == null ? void 0 : M.ref.current;
|
|
7275
7276
|
(function H(te) {
|
|
7276
7277
|
I.current = te, window.clearTimeout(E.current), te !== "" && (E.current = window.setTimeout(() => H(""), 1e3));
|
|
7277
7278
|
})(J), ee && setTimeout(() => ee.focus());
|
|
7278
7279
|
};
|
|
7279
7280
|
v.useEffect(() => () => window.clearTimeout(E.current), []), ba();
|
|
7280
7281
|
const D = v.useCallback((O) => {
|
|
7281
|
-
var X,
|
|
7282
|
-
return F.current === ((X = L.current) == null ? void 0 : X.side) && xb(O, (
|
|
7282
|
+
var X, pe;
|
|
7283
|
+
return F.current === ((X = L.current) == null ? void 0 : X.side) && xb(O, (pe = L.current) == null ? void 0 : pe.area);
|
|
7283
7284
|
}, []);
|
|
7284
7285
|
return /* @__PURE__ */ u.jsx(
|
|
7285
7286
|
eb,
|
|
@@ -7356,8 +7357,8 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7356
7357
|
ref: N,
|
|
7357
7358
|
style: { outline: "none", ...x.style },
|
|
7358
7359
|
onKeyDown: ue(x.onKeyDown, (O) => {
|
|
7359
|
-
const X = O.target.closest("[data-radix-menu-content]") === O.currentTarget,
|
|
7360
|
-
X && (O.key === "Tab" && O.preventDefault(), !
|
|
7360
|
+
const X = O.target.closest("[data-radix-menu-content]") === O.currentTarget, pe = O.ctrlKey || O.altKey || O.metaKey, Ie = O.key.length === 1;
|
|
7361
|
+
X && (O.key === "Tab" && O.preventDefault(), !pe && Ie && B(O.key));
|
|
7361
7362
|
const Ae = k.current;
|
|
7362
7363
|
if (O.target !== Ae || !Vw.includes(O.key)) return;
|
|
7363
7364
|
O.preventDefault();
|
|
@@ -7372,8 +7373,8 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7372
7373
|
to((O) => {
|
|
7373
7374
|
const J = O.target, X = j.current !== O.clientX;
|
|
7374
7375
|
if (O.currentTarget.contains(J) && X) {
|
|
7375
|
-
const
|
|
7376
|
-
F.current =
|
|
7376
|
+
const pe = O.clientX > j.current ? "right" : "left";
|
|
7377
|
+
F.current = pe, j.current = O.clientX;
|
|
7377
7378
|
}
|
|
7378
7379
|
})
|
|
7379
7380
|
)
|
|
@@ -9105,7 +9106,7 @@ const vo = et(
|
|
|
9105
9106
|
const $ = Pf(T), { align: A, behavior: B, offset: D } = $, O = k - 1, J = jf($, C, O);
|
|
9106
9107
|
let X = so(J, C.offsetTree, L) + E;
|
|
9107
9108
|
A === "end" ? (X += F + gn(C.sizeTree, J)[1] - S + j, J === O && (X += I)) : A === "center" ? X += (F + gn(C.sizeTree, J)[1] - S + j) / 2 : X -= N, D && (X += D);
|
|
9108
|
-
const
|
|
9109
|
+
const pe = (Ie) => {
|
|
9109
9110
|
b(), Ie ? (P("retrying to scroll to", { location: T }, Xt.DEBUG), Me(h, T)) : (Me(m, !0), P("list did not change, scroll successful", {}, Xt.DEBUG));
|
|
9110
9111
|
};
|
|
9111
9112
|
if (b(), B === "smooth") {
|
|
@@ -9113,10 +9114,10 @@ const vo = et(
|
|
|
9113
9114
|
w = ot(t, (Ae) => {
|
|
9114
9115
|
Ie = Ie || Ae;
|
|
9115
9116
|
}), y = pn(d, () => {
|
|
9116
|
-
|
|
9117
|
+
pe(Ie);
|
|
9117
9118
|
});
|
|
9118
9119
|
} else
|
|
9119
|
-
y = pn(U(t, D0(150)),
|
|
9120
|
+
y = pn(U(t, D0(150)), pe);
|
|
9120
9121
|
return g = setTimeout(() => {
|
|
9121
9122
|
b();
|
|
9122
9123
|
}, 1200), Me(l, !0), P("scrolling from index to", { behavior: B, index: J, top: X }, Xt.DEBUG), { behavior: B, top: X };
|
|
@@ -9558,11 +9559,11 @@ const hr = et(
|
|
|
9558
9559
|
}
|
|
9559
9560
|
if (!P)
|
|
9560
9561
|
return Ko([], J, N, j, A, F);
|
|
9561
|
-
const X = L.length > 0 ? L[L.length - 1] + 1 : 0,
|
|
9562
|
-
if (
|
|
9562
|
+
const X = L.length > 0 ? L[L.length - 1] + 1 : 0, pe = I0(B, S, k, X);
|
|
9563
|
+
if (pe.length === 0)
|
|
9563
9564
|
return null;
|
|
9564
9565
|
const Ie = N - 1, Ae = Bs([], (K) => {
|
|
9565
|
-
for (const ee of
|
|
9566
|
+
for (const ee of pe) {
|
|
9566
9567
|
const q = ee.value;
|
|
9567
9568
|
let M = q.offset, H = ee.start;
|
|
9568
9569
|
const te = q.size;
|
|
@@ -10739,7 +10740,7 @@ const TS = /* @__PURE__ */ et(
|
|
|
10739
10740
|
{ customScrollParent: y, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
|
|
10740
10741
|
C
|
|
10741
10742
|
]) => {
|
|
10742
|
-
const S = Y(0), k = Y(0), N = Y(Rc), E = Y({ height: 0, width: 0 }), I = Y({ height: 0, width: 0 }), P = Ue(), L = Ue(), F = Y(0), j = Y(null), $ = Y({ column: 0, row: 0 }), A = Ue(), B = Ue(), D = Y(!1), O = Y(0), J = Y(!0), X = Y(!1),
|
|
10743
|
+
const S = Y(0), k = Y(0), N = Y(Rc), E = Y({ height: 0, width: 0 }), I = Y({ height: 0, width: 0 }), P = Ue(), L = Ue(), F = Y(0), j = Y(null), $ = Y({ column: 0, row: 0 }), A = Ue(), B = Ue(), D = Y(!1), O = Y(0), J = Y(!0), X = Y(!1), pe = Y(!1);
|
|
10743
10744
|
ot(
|
|
10744
10745
|
U(
|
|
10745
10746
|
m,
|
|
@@ -10833,14 +10834,14 @@ const TS = /* @__PURE__ */ et(
|
|
|
10833
10834
|
if (de === 0 && (M === 0 || Ke === 0))
|
|
10834
10835
|
return Rc;
|
|
10835
10836
|
if (Ve === 0) {
|
|
10836
|
-
const he = Wa(Ne, M),
|
|
10837
|
-
return SS(Nc(he,
|
|
10837
|
+
const he = Wa(Ne, M), qe = he + Math.max(de - 1, 0);
|
|
10838
|
+
return SS(Nc(he, qe, Z));
|
|
10838
10839
|
}
|
|
10839
|
-
const
|
|
10840
|
+
const Xe = Xf(Ke, Ve, Le);
|
|
10840
10841
|
let Ze, tt;
|
|
10841
|
-
Ee ? H === 0 && te === 0 && de > 0 ? (Ze = 0, tt = de - 1) : (Ze =
|
|
10842
|
-
const Nt = Nc(Ze, tt, Z), { bottom: ht, top: lt } = Ac(Te, oe, ne, Nt), ce = Ec(M /
|
|
10843
|
-
return { bottom: ht, itemHeight: He, items: Nt, itemWidth: Ve, offsetBottom:
|
|
10842
|
+
Ee ? H === 0 && te === 0 && de > 0 ? (Ze = 0, tt = de - 1) : (Ze = Xe * as((H + Je) / (He + Je)), tt = Xe * Ec((te + Je) / (He + Je)) - 1, tt = Ei(M - 1, Kr(tt, Xe - 1)), Ze = Ei(tt, Kr(0, Ze))) : (Ze = 0, tt = -1);
|
|
10843
|
+
const Nt = Nc(Ze, tt, Z), { bottom: ht, top: lt } = Ac(Te, oe, ne, Nt), ce = Ec(M / Xe), fe = ce * He + (ce - 1) * Je - ht;
|
|
10844
|
+
return { bottom: ht, itemHeight: He, items: Nt, itemWidth: Ve, offsetBottom: fe, offsetTop: lt, top: lt };
|
|
10844
10845
|
}
|
|
10845
10846
|
)
|
|
10846
10847
|
),
|
|
@@ -10961,7 +10962,7 @@ const TS = /* @__PURE__ */ et(
|
|
|
10961
10962
|
...h,
|
|
10962
10963
|
// output
|
|
10963
10964
|
gridState: N,
|
|
10964
|
-
horizontalDirection:
|
|
10965
|
+
horizontalDirection: pe,
|
|
10965
10966
|
initialTopMostItemIndex: O,
|
|
10966
10967
|
totalListHeight: q,
|
|
10967
10968
|
...p,
|
|
@@ -11021,7 +11022,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11021
11022
|
([e, t]) => ({ ...e, ...t }),
|
|
11022
11023
|
xt(TS, kS)
|
|
11023
11024
|
), ES = /* @__PURE__ */ z.memo(function() {
|
|
11024
|
-
const e =
|
|
11025
|
+
const e = wt("gridState"), t = wt("listClassName"), n = wt("itemClassName"), r = wt("itemContent"), o = wt("computeItemKey"), s = wt("isSeeking"), i = sn("scrollHeight"), a = wt("ItemComponent"), l = wt("ListComponent"), c = wt("ScrollSeekPlaceholder"), d = wt("context"), f = sn("itemDimensions"), p = sn("gap"), h = wt("log"), m = wt("stateRestoreInProgress"), x = sn("reportReadyState"), y = pr(
|
|
11025
11026
|
z.useMemo(
|
|
11026
11027
|
() => (g) => {
|
|
11027
11028
|
const w = g.parentElement.parentElement.scrollHeight;
|
|
@@ -11076,7 +11077,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11076
11077
|
}
|
|
11077
11078
|
);
|
|
11078
11079
|
}), IS = z.memo(function() {
|
|
11079
|
-
const e =
|
|
11080
|
+
const e = wt("HeaderComponent"), t = sn("headerHeight"), n = wt("headerFooterTag"), r = pr(
|
|
11080
11081
|
z.useMemo(
|
|
11081
11082
|
() => (s) => {
|
|
11082
11083
|
t(Un(s, "height"));
|
|
@@ -11085,10 +11086,10 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11085
11086
|
),
|
|
11086
11087
|
!0,
|
|
11087
11088
|
!1
|
|
11088
|
-
), o =
|
|
11089
|
+
), o = wt("context");
|
|
11089
11090
|
return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
|
|
11090
11091
|
}), NS = z.memo(function() {
|
|
11091
|
-
const e =
|
|
11092
|
+
const e = wt("FooterComponent"), t = sn("footerHeight"), n = wt("headerFooterTag"), r = pr(
|
|
11092
11093
|
z.useMemo(
|
|
11093
11094
|
() => (s) => {
|
|
11094
11095
|
t(Un(s, "height"));
|
|
@@ -11097,7 +11098,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11097
11098
|
),
|
|
11098
11099
|
!0,
|
|
11099
11100
|
!1
|
|
11100
|
-
), o =
|
|
11101
|
+
), o = wt("context");
|
|
11101
11102
|
return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
|
|
11102
11103
|
}), AS = ({ children: e }) => {
|
|
11103
11104
|
const t = z.useContext(Wf), n = sn("itemDimensions"), r = sn("viewportDimensions"), o = pr(
|
|
@@ -11114,12 +11115,12 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11114
11115
|
t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
|
|
11115
11116
|
}, [t, r, n]), /* @__PURE__ */ u.jsx("div", { ref: o, style: Ws(!1), children: e });
|
|
11116
11117
|
}, jS = ({ children: e }) => {
|
|
11117
|
-
const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o =
|
|
11118
|
+
const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o = wt("customScrollParent"), s = Sf(n, o, !1);
|
|
11118
11119
|
return z.useEffect(() => {
|
|
11119
11120
|
t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
|
|
11120
11121
|
}, [t, n, r]), /* @__PURE__ */ u.jsx("div", { ref: s, style: Ws(!1), children: e });
|
|
11121
11122
|
}, _S = /* @__PURE__ */ z.memo(function({ ...e }) {
|
|
11122
|
-
const t =
|
|
11123
|
+
const t = wt("useWindowScroll"), n = wt("customScrollParent"), r = n || t ? OS : PS, o = n || t ? jS : AS, s = wt("context");
|
|
11123
11124
|
return /* @__PURE__ */ u.jsx(r, { ...e, ...Bt(r, s), children: /* @__PURE__ */ u.jsxs(o, { children: [
|
|
11124
11125
|
/* @__PURE__ */ u.jsx(IS, {}),
|
|
11125
11126
|
/* @__PURE__ */ u.jsx(ES, {}),
|
|
@@ -11127,7 +11128,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11127
11128
|
] }) });
|
|
11128
11129
|
}), {
|
|
11129
11130
|
useEmitter: Jf,
|
|
11130
|
-
useEmitterValue:
|
|
11131
|
+
useEmitterValue: wt,
|
|
11131
11132
|
usePublisher: sn
|
|
11132
11133
|
} = /* @__PURE__ */ Hf(
|
|
11133
11134
|
RS,
|
|
@@ -11170,7 +11171,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11170
11171
|
}
|
|
11171
11172
|
},
|
|
11172
11173
|
_S
|
|
11173
|
-
), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue:
|
|
11174
|
+
), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn }), OS = /* @__PURE__ */ Yf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn });
|
|
11174
11175
|
function jc(e, t, n) {
|
|
11175
11176
|
return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Xt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
|
|
11176
11177
|
}
|
|
@@ -13585,7 +13586,7 @@ const Bc = z.memo(function({
|
|
|
13585
13586
|
defaultCheckpointId: N = null,
|
|
13586
13587
|
messageParentCheckpointId: E = null
|
|
13587
13588
|
}) {
|
|
13588
|
-
const [I, P] = xe(!1), [L, F] = xe("preview"), [j, $] = xe(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", O = t.role, J = O === "tool", X = at(() => "type" in t && t.type === "default_message" ? t : null, [t]),
|
|
13589
|
+
const [I, P] = xe(!1), [L, F] = xe("preview"), [j, $] = xe(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", O = t.role, J = O === "tool", X = at(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!X, Ie = !(r && O !== "user"), {
|
|
13589
13590
|
uploadingFiles: Ae,
|
|
13590
13591
|
handleFileClick: K,
|
|
13591
13592
|
fileViewerOpen: ee,
|
|
@@ -13657,7 +13658,7 @@ const Bc = z.memo(function({
|
|
|
13657
13658
|
default:
|
|
13658
13659
|
return /* @__PURE__ */ u.jsx(si, { className: we });
|
|
13659
13660
|
}
|
|
13660
|
-
}, [D, H, O]),
|
|
13661
|
+
}, [D, H, O]), Xe = z.useCallback(() => {
|
|
13661
13662
|
const W = "group relative mb-4 flex w-full";
|
|
13662
13663
|
switch (O) {
|
|
13663
13664
|
case "user":
|
|
@@ -13674,7 +13675,7 @@ const Bc = z.memo(function({
|
|
|
13674
13675
|
"rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
|
|
13675
13676
|
D && "px-3 py-2 text-sm"
|
|
13676
13677
|
);
|
|
13677
|
-
if (
|
|
13678
|
+
if (pe)
|
|
13678
13679
|
return Q(
|
|
13679
13680
|
W,
|
|
13680
13681
|
"w-full",
|
|
@@ -13708,9 +13709,9 @@ const Bc = z.memo(function({
|
|
|
13708
13709
|
"border border-border/60 dark:border-border/40"
|
|
13709
13710
|
);
|
|
13710
13711
|
}
|
|
13711
|
-
}, [D,
|
|
13712
|
-
if (
|
|
13713
|
-
return /* @__PURE__ */ u.jsx("div", { className: Q(
|
|
13712
|
+
}, [D, pe, O]);
|
|
13713
|
+
if (pe && X)
|
|
13714
|
+
return /* @__PURE__ */ u.jsx("div", { className: Q(Xe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Ze(), p.content), children: [
|
|
13714
13715
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
|
|
13715
13716
|
/* @__PURE__ */ u.jsx(si, { className: Q("h-4 w-4", H) }),
|
|
13716
13717
|
a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
|
|
@@ -13872,17 +13873,17 @@ const Bc = z.memo(function({
|
|
|
13872
13873
|
L,
|
|
13873
13874
|
lt,
|
|
13874
13875
|
H
|
|
13875
|
-
]),
|
|
13876
|
+
]), fe = at(() => X ? "Assistant" : kC(t), [X, t]), he = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), qe = z.useMemo(() => {
|
|
13876
13877
|
var W;
|
|
13877
13878
|
return he.length ? N && he.some((we) => we.id === N) ? N : ((W = he[0]) == null ? void 0 : W.id) ?? null : null;
|
|
13878
|
-
}, [N, he]),
|
|
13879
|
+
}, [N, he]), yt = z.useMemo(() => !he.length || !S ? null : he.some((W) => W.id === S) ? S : null, [S, he]) ?? qe, At = O === "user" && he.length > 0 && typeof k == "function", st = z.useCallback(
|
|
13879
13880
|
(W) => {
|
|
13880
13881
|
if (!k) return;
|
|
13881
13882
|
const we = (W == null ? void 0 : W.id) ?? null, ye = (W == null ? void 0 : W.parentId) ?? E ?? null;
|
|
13882
13883
|
k(we, ye);
|
|
13883
13884
|
},
|
|
13884
13885
|
[E, k]
|
|
13885
|
-
), ze = z.useMemo(() =>
|
|
13886
|
+
), ze = z.useMemo(() => yt ? he.findIndex((W) => W.id === yt) : -1, [yt, he]), Pt = z.useMemo(() => ze < 0 ? null : he[ze] ?? null, [ze, he]), jt = z.useCallback((W) => {
|
|
13886
13887
|
const we = [];
|
|
13887
13888
|
if (W.step !== null && we.push(`Step ${W.step}`), W.source && we.push(W.source), !W.createdAt)
|
|
13888
13889
|
return we.length ? we.join(" • ") : W.id.slice(0, 8);
|
|
@@ -13899,7 +13900,7 @@ const Bc = z.memo(function({
|
|
|
13899
13900
|
return `${ye}`;
|
|
13900
13901
|
}, []);
|
|
13901
13902
|
return J && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
13902
|
-
/* @__PURE__ */ u.jsx("div", { className: Q(
|
|
13903
|
+
/* @__PURE__ */ u.jsx("div", { className: Q(Xe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Ze(), p.content), children: [
|
|
13903
13904
|
(i || a || J) && /* @__PURE__ */ u.jsxs(
|
|
13904
13905
|
"div",
|
|
13905
13906
|
{
|
|
@@ -13912,7 +13913,7 @@ const Bc = z.memo(function({
|
|
|
13912
13913
|
children: [
|
|
13913
13914
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13914
13915
|
Ke(),
|
|
13915
|
-
a &&
|
|
13916
|
+
a && fe && /* @__PURE__ */ u.jsx("span", { className: Q("font-medium", D ? "text-xs" : "text-sm"), children: fe }),
|
|
13916
13917
|
J && /* @__PURE__ */ u.jsxs(
|
|
13917
13918
|
Zf,
|
|
13918
13919
|
{
|
|
@@ -14399,7 +14400,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14399
14400
|
}
|
|
14400
14401
|
]
|
|
14401
14402
|
};
|
|
14402
|
-
}, [w, D]), J = at(() => O ? [...e, O] : e, [e, O]), X = at(() => S ? J : J.filter((Z) => (Z == null ? void 0 : Z.role) !== "tool"), [J, S]),
|
|
14403
|
+
}, [w, D]), J = at(() => O ? [...e, O] : e, [e, O]), X = at(() => S ? J : J.filter((Z) => (Z == null ? void 0 : Z.role) !== "tool"), [J, S]), pe = at(() => {
|
|
14403
14404
|
const Z = /* @__PURE__ */ new Set(), de = [];
|
|
14404
14405
|
for (let Ee = X.length - 1; Ee >= 0; Ee--) {
|
|
14405
14406
|
const Ne = X[Ee];
|
|
@@ -14502,14 +14503,14 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14502
14503
|
onCancelEdit: () => {
|
|
14503
14504
|
}
|
|
14504
14505
|
}
|
|
14505
|
-
) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Te =
|
|
14506
|
+
) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Te = pe.length > 0;
|
|
14506
14507
|
return lm(
|
|
14507
14508
|
L,
|
|
14508
14509
|
() => ({
|
|
14509
14510
|
scrollToLatest: () => {
|
|
14510
14511
|
var Z, de;
|
|
14511
|
-
if (F.current &&
|
|
14512
|
-
const Ee =
|
|
14512
|
+
if (F.current && pe.length > 0) {
|
|
14513
|
+
const Ee = pe.length - 1;
|
|
14513
14514
|
(de = (Z = F.current).scrollToIndex) == null || de.call(Z, {
|
|
14514
14515
|
index: Ee,
|
|
14515
14516
|
align: "end",
|
|
@@ -14519,14 +14520,14 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14519
14520
|
},
|
|
14520
14521
|
scrollToTop: () => {
|
|
14521
14522
|
var Z, de;
|
|
14522
|
-
F.current &&
|
|
14523
|
+
F.current && pe.length > 0 ? (de = (Z = F.current).scrollToIndex) == null || de.call(Z, {
|
|
14523
14524
|
index: 0,
|
|
14524
14525
|
align: "start",
|
|
14525
14526
|
behavior: "auto"
|
|
14526
14527
|
}) : j.current && (j.current.scrollTop = 0);
|
|
14527
14528
|
}
|
|
14528
14529
|
}),
|
|
14529
|
-
[
|
|
14530
|
+
[pe]
|
|
14530
14531
|
), /* @__PURE__ */ u.jsxs("div", { className: oe, style: p, children: [
|
|
14531
14532
|
te,
|
|
14532
14533
|
/* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Te ? /* @__PURE__ */ u.jsx(
|
|
@@ -14538,7 +14539,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14538
14539
|
scrollerRef: (Z) => {
|
|
14539
14540
|
j.current = Z instanceof HTMLDivElement ? Z : null;
|
|
14540
14541
|
},
|
|
14541
|
-
data:
|
|
14542
|
+
data: pe,
|
|
14542
14543
|
followOutput: K,
|
|
14543
14544
|
overscan: 200,
|
|
14544
14545
|
increaseViewportBy: { top: 100, bottom: 200 },
|
|
@@ -14554,16 +14555,16 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14554
14555
|
itemContent: (Z, de) => {
|
|
14555
14556
|
var tt;
|
|
14556
14557
|
const Ee = Hc(de, Z), Ne = "type" in de && de.type === "default_message";
|
|
14557
|
-
let Le = [], Je = null, He = {}, Ve = {}, Ke = null,
|
|
14558
|
+
let Le = [], Je = null, He = {}, Ve = {}, Ke = null, Xe = null;
|
|
14558
14559
|
if (!Ne) {
|
|
14559
14560
|
const Nt = de, ht = Nt.checkpointId ?? null;
|
|
14560
14561
|
He = Nt.additionalKwargs ?? {}, Ve = Nt.responseMetadata ?? {};
|
|
14561
14562
|
const lt = ht && k ? k.get(ht) ?? null : null;
|
|
14562
14563
|
Ke = typeof He.step == "number" ? He.step : typeof Ve.step == "number" ? Ve.step : (lt == null ? void 0 : lt.step) ?? null;
|
|
14563
14564
|
const ce = typeof He.source == "string" ? He.source : typeof Ve.source == "string" ? Ve.source : (lt == null ? void 0 : lt.source) ?? null;
|
|
14564
|
-
|
|
14565
|
-
const
|
|
14566
|
-
|
|
14565
|
+
Xe = ce ? String(ce) : null;
|
|
14566
|
+
const fe = Ke !== null && Xe ? `${Ke}:${Xe}` : null;
|
|
14567
|
+
fe && (N != null && N.has(fe)) ? Le = N.get(fe) ?? [] : ht && lt && (Le = [lt]), Je = ht ?? ((tt = Le[0]) == null ? void 0 : tt.id) ?? null;
|
|
14567
14568
|
}
|
|
14568
14569
|
const Ze = (() => {
|
|
14569
14570
|
if (typeof He.parentCheckpointId == "string")
|
|
@@ -14648,15 +14649,15 @@ function Ai({
|
|
|
14648
14649
|
checkpoints: I,
|
|
14649
14650
|
interrupt: P,
|
|
14650
14651
|
metadata: L
|
|
14651
|
-
} = ya(), { isStreaming: F, error: j, connectionState: $, submit: A, stop: B } = Jx(), D = g ?? y ?? null, O = (E == null ? void 0 : E.id) ?? null, J = (E == null ? void 0 : E.namespace) ?? null, X = (L == null ? void 0 : L.assemblingMessageId) ?? null,
|
|
14652
|
+
} = ya(), { isStreaming: F, error: j, connectionState: $, submit: A, stop: B } = Jx(), D = g ?? y ?? null, O = (E == null ? void 0 : E.id) ?? null, J = (E == null ? void 0 : E.namespace) ?? null, X = (L == null ? void 0 : L.assemblingMessageId) ?? null, pe = P, [Ie, Ae] = xe(!1);
|
|
14652
14653
|
kt(() => {
|
|
14653
|
-
|
|
14654
|
-
}, [
|
|
14654
|
+
pe || Ae(!1);
|
|
14655
|
+
}, [pe]);
|
|
14655
14656
|
const K = ke(() => {
|
|
14656
14657
|
Ae(!0);
|
|
14657
14658
|
}, []), ee = ke(() => {
|
|
14658
14659
|
Ae(!1);
|
|
14659
|
-
}, []), q = !!
|
|
14660
|
+
}, []), q = !!pe || Ie, [M, H] = xe(null), [te, oe] = xe(""), [ne, Te] = xe(null), [Z, de] = xe(null), [Ee, Ne] = xe([]), [Le, Je] = xe(0), [He, Ve] = xe(0), [Ke, Xe] = xe(!1), [Ze, tt] = xe(null), [Nt, ht] = xe(null), [lt, ce] = xe(!1), [fe, he] = xe(null), [qe, Fe] = xe(!1), yt = Qe(!1), [At, st] = xe(() => Uc.value), ze = Qe(At), Pt = Qe(null), jt = ke((G) => {
|
|
14660
14661
|
Uc.value = G, st(G);
|
|
14661
14662
|
}, []), [W, we] = xe(!1), ye = Qe(null), pt = ke((G) => {
|
|
14662
14663
|
if (!Array.isArray(G))
|
|
@@ -14664,7 +14665,7 @@ function Ai({
|
|
|
14664
14665
|
for (let re = G.length - 1; re >= 0; re--) {
|
|
14665
14666
|
const ie = G[re];
|
|
14666
14667
|
if (!ie || ie.role !== "user") continue;
|
|
14667
|
-
const Se = (ie.content ?? []).filter((
|
|
14668
|
+
const Se = (ie.content ?? []).filter((Ye) => (Ye == null ? void 0 : Ye.type) === "text").map((Ye) => Ye.text).filter((Ye) => typeof Ye == "string" && Ye.trim().length > 0);
|
|
14668
14669
|
return {
|
|
14669
14670
|
text: Se.length ? Se.join(" ").trim() : null,
|
|
14670
14671
|
messageId: ie.id ?? null
|
|
@@ -14689,16 +14690,16 @@ function Ai({
|
|
|
14689
14690
|
const G = (Se) => {
|
|
14690
14691
|
if (!Array.isArray(Se) || Se.length === 0)
|
|
14691
14692
|
return null;
|
|
14692
|
-
const ut = Se.map((
|
|
14693
|
-
if (typeof
|
|
14694
|
-
return
|
|
14695
|
-
if (
|
|
14696
|
-
const nt =
|
|
14693
|
+
const ut = Se.map((Ye) => {
|
|
14694
|
+
if (typeof Ye == "string")
|
|
14695
|
+
return Ye.trim();
|
|
14696
|
+
if (Ye && typeof Ye == "object" && "type" in Ye) {
|
|
14697
|
+
const nt = Ye;
|
|
14697
14698
|
if (typeof nt.type == "string")
|
|
14698
14699
|
return nt.type;
|
|
14699
14700
|
}
|
|
14700
14701
|
return null;
|
|
14701
|
-
}).filter((
|
|
14702
|
+
}).filter((Ye) => !!(Ye && Ye.length));
|
|
14702
14703
|
return ut.length ? ut.join(", ") : null;
|
|
14703
14704
|
}, re = Array.isArray(I) ? I.map((Se) => {
|
|
14704
14705
|
const ut = G(Se.next);
|
|
@@ -14711,9 +14712,9 @@ function Ai({
|
|
|
14711
14712
|
} : Se;
|
|
14712
14713
|
}) : [];
|
|
14713
14714
|
return re.some((Se) => mt(Se.metadata, "step") !== null) && re.sort((Se, ut) => {
|
|
14714
|
-
const
|
|
14715
|
-
if (
|
|
14716
|
-
return (nt ?? Number.NEGATIVE_INFINITY) - (
|
|
14715
|
+
const Ye = mt(Se.metadata, "step"), nt = mt(ut.metadata, "step");
|
|
14716
|
+
if (Ye !== null || nt !== null)
|
|
14717
|
+
return (nt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
|
|
14717
14718
|
const Mt = Date.parse(Se.createdAt ?? ""), tn = Date.parse(ut.createdAt ?? "");
|
|
14718
14719
|
return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
|
|
14719
14720
|
}), re;
|
|
@@ -14722,27 +14723,27 @@ function Ai({
|
|
|
14722
14723
|
for (const ie of Pe) {
|
|
14723
14724
|
const Se = ie.checkpointId ?? null;
|
|
14724
14725
|
if (!Se) continue;
|
|
14725
|
-
const ut = mt(ie.metadata, "step"),
|
|
14726
|
+
const ut = mt(ie.metadata, "step"), Ye = St(ie.metadata, "source"), nt = {
|
|
14726
14727
|
id: Se,
|
|
14727
14728
|
step: ut,
|
|
14728
|
-
source:
|
|
14729
|
+
source: Ye,
|
|
14729
14730
|
createdAt: ie.createdAt ?? null,
|
|
14730
14731
|
namespace: ie.checkpointNs ?? null,
|
|
14731
14732
|
parentId: ie.parentId ?? null
|
|
14732
14733
|
};
|
|
14733
|
-
if (G.set(Se, nt), ut !== null &&
|
|
14734
|
-
const Mt = `${ut}:${
|
|
14734
|
+
if (G.set(Se, nt), ut !== null && Ye) {
|
|
14735
|
+
const Mt = `${ut}:${Ye}`, tn = re.get(Mt) ?? [];
|
|
14735
14736
|
tn.push(nt), re.set(Mt, tn);
|
|
14736
14737
|
}
|
|
14737
14738
|
}
|
|
14738
14739
|
for (const ie of re.values())
|
|
14739
14740
|
ie.sort((Se, ut) => {
|
|
14740
|
-
const
|
|
14741
|
-
return (ut.createdAt ?? "").localeCompare(
|
|
14741
|
+
const Ye = Se.createdAt ?? "";
|
|
14742
|
+
return (ut.createdAt ?? "").localeCompare(Ye);
|
|
14742
14743
|
});
|
|
14743
14744
|
return { checkpointMetaById: G, checkpointIndexByKey: re };
|
|
14744
14745
|
}, [Pe, mt, St]), Ct = at(() => {
|
|
14745
|
-
var
|
|
14746
|
+
var Ye;
|
|
14746
14747
|
if (!Pe.length) return [];
|
|
14747
14748
|
const G = [...Pe].reverse(), re = (nt, Mt) => {
|
|
14748
14749
|
const tn = nt.checkpointId ?? null;
|
|
@@ -14761,7 +14762,7 @@ function Ai({
|
|
|
14761
14762
|
};
|
|
14762
14763
|
}, ie = [], Se = /* @__PURE__ */ new Set();
|
|
14763
14764
|
for (const nt of G) {
|
|
14764
|
-
const Mt = ((
|
|
14765
|
+
const Mt = ((Ye = St(nt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
|
|
14765
14766
|
if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
|
|
14766
14767
|
const Zn = re(nt, "User input");
|
|
14767
14768
|
Zn && !Se.has(Zn.id) && (ie.push(Zn), Se.add(Zn.id));
|
|
@@ -14799,7 +14800,7 @@ function Ai({
|
|
|
14799
14800
|
};
|
|
14800
14801
|
return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
|
|
14801
14802
|
}, []), kt(() => {
|
|
14802
|
-
Fe(!1),
|
|
14803
|
+
Fe(!1), yt.current = !1;
|
|
14803
14804
|
}, [D]), kt(() => {
|
|
14804
14805
|
ze.current = At;
|
|
14805
14806
|
}, [At]), kt(() => {
|
|
@@ -14810,13 +14811,13 @@ function Ai({
|
|
|
14810
14811
|
Pt.current === null && (Pt.current = ze.current), jt(te ?? "");
|
|
14811
14812
|
}, [te, M, jt]);
|
|
14812
14813
|
const R = ke(async () => {
|
|
14813
|
-
if (!(!b || T || !
|
|
14814
|
+
if (!(!b || T || !qe))
|
|
14814
14815
|
try {
|
|
14815
14816
|
await S();
|
|
14816
14817
|
} catch (G) {
|
|
14817
14818
|
console.warn("loadOlder failed", G);
|
|
14818
14819
|
}
|
|
14819
|
-
}, [b,
|
|
14820
|
+
}, [b, qe, T, S]);
|
|
14820
14821
|
kt(() => {
|
|
14821
14822
|
(async () => {
|
|
14822
14823
|
if (!x.baseUrl) {
|
|
@@ -14882,7 +14883,7 @@ function Ai({
|
|
|
14882
14883
|
}));
|
|
14883
14884
|
},
|
|
14884
14885
|
[At, c, jt]
|
|
14885
|
-
),
|
|
14886
|
+
), Ge = z.useCallback(() => {
|
|
14886
14887
|
H(null), oe(""), Te(null), de(null), jt(Pt.current ?? At), Pt.current = null;
|
|
14887
14888
|
}, [At, jt]), it = ke(
|
|
14888
14889
|
(G, re, ie) => {
|
|
@@ -14892,7 +14893,7 @@ function Ai({
|
|
|
14892
14893
|
), Be = ke((G) => {
|
|
14893
14894
|
for (let re = G - 1; re >= 0; re--)
|
|
14894
14895
|
if (w[re].role === "user") {
|
|
14895
|
-
const ie = w[re].content || [], ut = ie.filter((
|
|
14896
|
+
const ie = w[re].content || [], ut = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
|
|
14896
14897
|
try {
|
|
14897
14898
|
return JSON.stringify(ie, null, 2);
|
|
14898
14899
|
} catch {
|
|
@@ -14916,10 +14917,10 @@ function Ai({
|
|
|
14916
14917
|
const ie = re.filter((Se, ut) => G !== ut);
|
|
14917
14918
|
return ie.length === 0 && Ln(), ie;
|
|
14918
14919
|
});
|
|
14919
|
-
},
|
|
14920
|
+
}, bt = async (G) => {
|
|
14920
14921
|
const re = (G.target.files || [])[0];
|
|
14921
14922
|
if (re) {
|
|
14922
|
-
tt(null), ht(null),
|
|
14923
|
+
tt(null), ht(null), Xe(!0);
|
|
14923
14924
|
try {
|
|
14924
14925
|
await A(
|
|
14925
14926
|
{ attachments: [re] },
|
|
@@ -14934,10 +14935,10 @@ function Ai({
|
|
|
14934
14935
|
const Se = ie instanceof Error ? ie.message : "Failed to upload Excel file";
|
|
14935
14936
|
console.error("Excel upload failed", ie), tt(Se), m == null || m(Se);
|
|
14936
14937
|
} finally {
|
|
14937
|
-
|
|
14938
|
+
Xe(!1), G.target.value = "", Ln();
|
|
14938
14939
|
}
|
|
14939
14940
|
}
|
|
14940
|
-
},
|
|
14941
|
+
}, vt = async (G) => {
|
|
14941
14942
|
if (y) {
|
|
14942
14943
|
we(!0);
|
|
14943
14944
|
try {
|
|
@@ -14959,9 +14960,9 @@ function Ai({
|
|
|
14959
14960
|
}
|
|
14960
14961
|
}, Kt = ke(
|
|
14961
14962
|
async (G) => {
|
|
14962
|
-
await
|
|
14963
|
+
await vt(G);
|
|
14963
14964
|
},
|
|
14964
|
-
[
|
|
14965
|
+
[vt]
|
|
14965
14966
|
), Fn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${f.container || ""}`, Nn = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${f.messagesArea || ""}`, Ft = `flex-shrink-0 w-full border-t p-4 bg-transparent ${f.inputArea || ""}`, Dr = ke(
|
|
14966
14967
|
(G) => {
|
|
14967
14968
|
if (!G)
|
|
@@ -14997,7 +14998,7 @@ function Ai({
|
|
|
14997
14998
|
value: O ?? "",
|
|
14998
14999
|
onChange: (G) => {
|
|
14999
15000
|
const re = G.target.value || null;
|
|
15000
|
-
|
|
15001
|
+
vt(re);
|
|
15001
15002
|
},
|
|
15002
15003
|
children: [
|
|
15003
15004
|
/* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
|
|
@@ -15030,21 +15031,21 @@ function Ai({
|
|
|
15030
15031
|
enableMessageEditing: c,
|
|
15031
15032
|
editingMessageId: M,
|
|
15032
15033
|
onStartReached: () => {
|
|
15033
|
-
|
|
15034
|
+
qe && R();
|
|
15034
15035
|
},
|
|
15035
15036
|
onScrollAway: (G) => {
|
|
15036
|
-
if (!
|
|
15037
|
-
|
|
15037
|
+
if (!yt.current) {
|
|
15038
|
+
yt.current = !0;
|
|
15038
15039
|
return;
|
|
15039
15040
|
}
|
|
15040
15041
|
G && Fe(!0);
|
|
15041
15042
|
},
|
|
15042
15043
|
onEdit: it,
|
|
15043
15044
|
onRegenerate: Be,
|
|
15044
|
-
onCancelEdit:
|
|
15045
|
-
emptyMessage:
|
|
15045
|
+
onCancelEdit: Ge,
|
|
15046
|
+
emptyMessage: fe ?? void 0,
|
|
15046
15047
|
isNavigatingCheckpoint: W,
|
|
15047
|
-
activeInterrupt:
|
|
15048
|
+
activeInterrupt: pe,
|
|
15048
15049
|
disableInterruptActions: Ie,
|
|
15049
15050
|
onInterruptActionStart: K,
|
|
15050
15051
|
onInterruptActionEnd: ee,
|
|
@@ -15083,7 +15084,7 @@ function Ai({
|
|
|
15083
15084
|
{
|
|
15084
15085
|
variant: "ghost",
|
|
15085
15086
|
size: "sm",
|
|
15086
|
-
onClick:
|
|
15087
|
+
onClick: Ge,
|
|
15087
15088
|
className: "text-blue-600 hover:bg-blue-100",
|
|
15088
15089
|
children: /* @__PURE__ */ u.jsx(vr, { size: 16 })
|
|
15089
15090
|
}
|
|
@@ -15125,7 +15126,7 @@ function Ai({
|
|
|
15125
15126
|
ref: Jn,
|
|
15126
15127
|
type: "file",
|
|
15127
15128
|
accept: ".xls,.xlsx,.xlsm",
|
|
15128
|
-
onChange:
|
|
15129
|
+
onChange: bt,
|
|
15129
15130
|
className: "hidden"
|
|
15130
15131
|
},
|
|
15131
15132
|
He
|
|
@@ -15189,7 +15190,7 @@ function Ai({
|
|
|
15189
15190
|
disabled: q,
|
|
15190
15191
|
maxLength: Wo,
|
|
15191
15192
|
onSend: se,
|
|
15192
|
-
onCancelEdit:
|
|
15193
|
+
onCancelEdit: Ge,
|
|
15193
15194
|
onStop: B,
|
|
15194
15195
|
allowEmptySend: Ee.length > 0,
|
|
15195
15196
|
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${M ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${Z ? "border-red-400" : ""} ${f.textarea || ""}`
|
|
@@ -15842,7 +15843,7 @@ function Kc({
|
|
|
15842
15843
|
I(null), L("");
|
|
15843
15844
|
}, X = (K, ee) => {
|
|
15844
15845
|
K.key === "Enter" ? O(ee) : K.key === "Escape" && J();
|
|
15845
|
-
},
|
|
15846
|
+
}, pe = (K) => {
|
|
15846
15847
|
if (!K) return "";
|
|
15847
15848
|
try {
|
|
15848
15849
|
const ee = new Date(K), M = (/* @__PURE__ */ new Date()).getTime() - ee.getTime(), H = Math.floor(M / (1e3 * 60 * 60 * 24));
|
|
@@ -15894,7 +15895,7 @@ function Kc({
|
|
|
15894
15895
|
/* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(K) }),
|
|
15895
15896
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
15896
15897
|
/* @__PURE__ */ u.jsx(Cm, { size: 10 }),
|
|
15897
|
-
/* @__PURE__ */ u.jsx("span", { children:
|
|
15898
|
+
/* @__PURE__ */ u.jsx("span", { children: pe(K.updatedAt || K.createdAt) })
|
|
15898
15899
|
] })
|
|
15899
15900
|
] }) }),
|
|
15900
15901
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
@@ -16455,7 +16456,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
|
|
|
16455
16456
|
const [J, X] = Lh((q) => {
|
|
16456
16457
|
const M = L().filter((oe) => !oe.disabled), H = M.find((oe) => oe.ref.current === document.activeElement), te = Fh(M, q, H);
|
|
16457
16458
|
te && setTimeout(() => te.ref.current.focus());
|
|
16458
|
-
}),
|
|
16459
|
+
}), pe = v.useCallback(
|
|
16459
16460
|
(q, M, H) => {
|
|
16460
16461
|
const te = !$.current && !H;
|
|
16461
16462
|
(w.value !== void 0 && w.value === M || te) && (E(q), te && ($.current = !0));
|
|
@@ -16486,7 +16487,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
|
|
|
16486
16487
|
content: b,
|
|
16487
16488
|
viewport: C,
|
|
16488
16489
|
onViewportChange: S,
|
|
16489
|
-
itemRefCallback:
|
|
16490
|
+
itemRefCallback: pe,
|
|
16490
16491
|
selectedItem: N,
|
|
16491
16492
|
onItemLeave: Ie,
|
|
16492
16493
|
itemTextRefCallback: Ae,
|
|
@@ -16580,7 +16581,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16580
16581
|
]);
|
|
16581
16582
|
a.style.minWidth = Z + "px", a.style.right = Ne + "px";
|
|
16582
16583
|
}
|
|
16583
|
-
const P = p(), L = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), O = $ + A + F + D + B, J = Math.min(y.offsetHeight * 5, O), X = window.getComputedStyle(x),
|
|
16584
|
+
const P = p(), L = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), O = $ + A + F + D + B, J = Math.min(y.offsetHeight * 5, O), X = window.getComputedStyle(x), pe = parseInt(X.paddingTop, 10), Ie = parseInt(X.paddingBottom, 10), Ae = k.top + k.height / 2 - dn, K = L - Ae, ee = y.offsetHeight / 2, q = y.offsetTop + ee, M = $ + A + q, H = O - M;
|
|
16584
16585
|
if (M <= Ae) {
|
|
16585
16586
|
const oe = P.length > 0 && y === P[P.length - 1].ref.current;
|
|
16586
16587
|
a.style.bottom = "0px";
|
|
@@ -16596,7 +16597,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16596
16597
|
const Te = Math.max(
|
|
16597
16598
|
Ae,
|
|
16598
16599
|
$ + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
16599
|
-
(oe ?
|
|
16600
|
+
(oe ? pe : 0) + ee
|
|
16600
16601
|
) + H;
|
|
16601
16602
|
a.style.height = Te + "px", x.scrollTop = M - Ae + x.offsetTop;
|
|
16602
16603
|
}
|