teodor-new-chat-ui 4.3.211 → 4.3.212
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 +243 -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,48 @@ 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
|
-
}), { checkpoints:
|
|
3950
|
-
Ne(ce,
|
|
3951
|
-
const Fe =
|
|
3948
|
+
checkpointId: fe
|
|
3949
|
+
}), { checkpoints: qe } = Ur(he);
|
|
3950
|
+
Ne(ce, qe, `thread load (requested: ${fe})`);
|
|
3951
|
+
const Fe = qe.find((yt) => yt.messages && yt.messages.length > 0) ?? (fe ? qe.find((yt) => yt.checkpointId === fe) : null) ?? qe[0];
|
|
3952
3952
|
E((Fe == null ? void 0 : Fe.messages) ?? [], {
|
|
3953
3953
|
checkpointId: (Fe == null ? void 0 : Fe.checkpointId) ?? null,
|
|
3954
3954
|
checkpointNs: (Fe == null ? void 0 : Fe.checkpointNs) ?? null
|
|
3955
|
-
}), J(
|
|
3955
|
+
}), J(qe), j(!!(Fe != null && Fe.nextCursor)), D((Fe == null ? void 0 : Fe.nextCursor) ?? null);
|
|
3956
3956
|
} catch (he) {
|
|
3957
|
-
const
|
|
3958
|
-
k(
|
|
3957
|
+
const qe = String(he);
|
|
3958
|
+
k(qe), s == null || s(qe);
|
|
3959
3959
|
} finally {
|
|
3960
3960
|
C(!1);
|
|
3961
3961
|
}
|
|
@@ -3967,41 +3967,41 @@ function Xx({
|
|
|
3967
3967
|
q.current = Le;
|
|
3968
3968
|
}, [Le]);
|
|
3969
3969
|
const Je = ke(
|
|
3970
|
-
async (ce,
|
|
3970
|
+
async (ce, fe) => {
|
|
3971
3971
|
const he = K.current;
|
|
3972
3972
|
if (he) {
|
|
3973
|
-
|
|
3973
|
+
pe(!0);
|
|
3974
3974
|
try {
|
|
3975
|
-
const
|
|
3975
|
+
const qe = await c.getStateHistory({
|
|
3976
3976
|
threadId: he,
|
|
3977
3977
|
checkpointId: ce,
|
|
3978
|
-
checkpointNs:
|
|
3979
|
-
}), { checkpoints: Fe } = Ur(
|
|
3978
|
+
checkpointNs: fe ?? void 0
|
|
3979
|
+
}), { checkpoints: Fe } = Ur(qe);
|
|
3980
3980
|
Ne(he, Fe, "checkpoint navigation");
|
|
3981
|
-
const
|
|
3982
|
-
(At) => At.checkpointId === ce && (
|
|
3981
|
+
const yt = Fe.find(
|
|
3982
|
+
(At) => At.checkpointId === ce && (fe ? At.checkpointNs === fe : !0)
|
|
3983
3983
|
);
|
|
3984
|
-
if (!
|
|
3985
|
-
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs:
|
|
3984
|
+
if (!yt) {
|
|
3985
|
+
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs: fe });
|
|
3986
3986
|
return;
|
|
3987
3987
|
}
|
|
3988
|
-
J(Fe), E(
|
|
3989
|
-
checkpointId:
|
|
3990
|
-
checkpointNs:
|
|
3988
|
+
J(Fe), E(yt.messages ?? [], {
|
|
3989
|
+
checkpointId: yt.checkpointId ?? null,
|
|
3990
|
+
checkpointNs: yt.checkpointNs ?? null
|
|
3991
3991
|
});
|
|
3992
|
-
} catch (
|
|
3993
|
-
s == null || s(String(
|
|
3992
|
+
} catch (qe) {
|
|
3993
|
+
s == null || s(String(qe));
|
|
3994
3994
|
} finally {
|
|
3995
|
-
|
|
3995
|
+
pe(!1);
|
|
3996
3996
|
}
|
|
3997
3997
|
}
|
|
3998
3998
|
},
|
|
3999
3999
|
[c, E, s, Ne]
|
|
4000
4000
|
), He = ke(
|
|
4001
|
-
(ce,
|
|
4001
|
+
(ce, fe) => {
|
|
4002
4002
|
E(N.messages, {
|
|
4003
4003
|
checkpointId: ce ?? null,
|
|
4004
|
-
checkpointNs:
|
|
4004
|
+
checkpointNs: fe ?? null
|
|
4005
4005
|
});
|
|
4006
4006
|
},
|
|
4007
4007
|
[E, N.messages]
|
|
@@ -4014,9 +4014,9 @@ function Xx({
|
|
|
4014
4014
|
const ce = await c.getStateHistory({
|
|
4015
4015
|
threadId: K.current,
|
|
4016
4016
|
checkpointId: B
|
|
4017
|
-
}), { checkpoints:
|
|
4018
|
-
if (
|
|
4019
|
-
const he =
|
|
4017
|
+
}), { checkpoints: fe } = Ur(ce);
|
|
4018
|
+
if (fe.length > 0) {
|
|
4019
|
+
const he = fe[fe.length - 1];
|
|
4020
4020
|
I((he == null ? void 0 : he.messages) ?? []), j(!!(he != null && he.nextCursor)), D((he == null ? void 0 : he.nextCursor) ?? null);
|
|
4021
4021
|
}
|
|
4022
4022
|
} catch (ce) {
|
|
@@ -4025,26 +4025,26 @@ function Xx({
|
|
|
4025
4025
|
A(!1);
|
|
4026
4026
|
}
|
|
4027
4027
|
}
|
|
4028
|
-
}, [c, B, I, s]),
|
|
4028
|
+
}, [c, B, I, s]), Xe = ke(async () => {
|
|
4029
4029
|
E([], {}), J([]), j(!1), D(null);
|
|
4030
4030
|
}, [E]), Ze = ke(
|
|
4031
|
-
async (ce,
|
|
4032
|
-
console.log("[ChatSessionProvider] Interrupt:", ce,
|
|
4031
|
+
async (ce, fe) => {
|
|
4032
|
+
console.log("[ChatSessionProvider] Interrupt:", ce, fe);
|
|
4033
4033
|
},
|
|
4034
4034
|
[]
|
|
4035
4035
|
);
|
|
4036
4036
|
kt(() => {
|
|
4037
4037
|
Te();
|
|
4038
4038
|
}, [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"), (
|
|
4039
|
+
var ce, fe;
|
|
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"), (fe = q.current) == null || fe.call(q, m)));
|
|
4041
4041
|
}, [o, m, T, n, r]), kt(() => {
|
|
4042
4042
|
a == null || a(m);
|
|
4043
4043
|
}, [m, a]);
|
|
4044
4044
|
const tt = ke(
|
|
4045
|
-
async (ce,
|
|
4046
|
-
const he = K.current,
|
|
4047
|
-
if (!he && !
|
|
4045
|
+
async (ce, fe) => {
|
|
4046
|
+
const he = K.current, qe = (ce == null ? void 0 : ce.text) ?? "";
|
|
4047
|
+
if (!he && !qe) return;
|
|
4048
4048
|
if (!he) {
|
|
4049
4049
|
await Z("New Chat");
|
|
4050
4050
|
return;
|
|
@@ -4052,19 +4052,19 @@ function Xx({
|
|
|
4052
4052
|
const { contentParts: Fe } = await wx(
|
|
4053
4053
|
c,
|
|
4054
4054
|
(ce == null ? void 0 : ce.attachments) ?? []
|
|
4055
|
-
),
|
|
4056
|
-
|
|
4055
|
+
), yt = [...Fe];
|
|
4056
|
+
qe != null && qe.trim() && yt.push({ type: "text", text: qe });
|
|
4057
4057
|
const At = {
|
|
4058
4058
|
id: `msg-${Date.now()}`,
|
|
4059
4059
|
role: "user",
|
|
4060
|
-
content:
|
|
4060
|
+
content: yt,
|
|
4061
4061
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4062
4062
|
};
|
|
4063
4063
|
P(At);
|
|
4064
4064
|
const st = {
|
|
4065
4065
|
threadId: he,
|
|
4066
|
-
checkpointId: (
|
|
4067
|
-
checkpointNs: (
|
|
4066
|
+
checkpointId: (fe == null ? void 0 : fe.checkpointId) ?? N.lastCheckpointId ?? void 0,
|
|
4067
|
+
checkpointNs: (fe == null ? void 0 : fe.checkpointNs) ?? N.lastCheckpointNs ?? void 0
|
|
4068
4068
|
};
|
|
4069
4069
|
M(st);
|
|
4070
4070
|
},
|
|
@@ -4101,12 +4101,12 @@ function Xx({
|
|
|
4101
4101
|
error: S,
|
|
4102
4102
|
hasMore: F,
|
|
4103
4103
|
loadOlder: Ke,
|
|
4104
|
-
clearState:
|
|
4104
|
+
clearState: Xe,
|
|
4105
4105
|
navigateToCheckpoint: Je,
|
|
4106
4106
|
setCurrentCheckpointId: He,
|
|
4107
4107
|
returnToLatest: Ve,
|
|
4108
4108
|
loadThread: Le,
|
|
4109
|
-
clearThread:
|
|
4109
|
+
clearThread: Xe,
|
|
4110
4110
|
respondToInterrupt: Ze
|
|
4111
4111
|
}),
|
|
4112
4112
|
[
|
|
@@ -4119,7 +4119,7 @@ function Xx({
|
|
|
4119
4119
|
S,
|
|
4120
4120
|
F,
|
|
4121
4121
|
Ke,
|
|
4122
|
-
|
|
4122
|
+
Xe,
|
|
4123
4123
|
Je,
|
|
4124
4124
|
He,
|
|
4125
4125
|
Ve,
|
|
@@ -4284,11 +4284,11 @@ function Qx({
|
|
|
4284
4284
|
try {
|
|
4285
4285
|
const X = l(A);
|
|
4286
4286
|
X && typeof X.then == "function" ? X.then(() => {
|
|
4287
|
-
var
|
|
4288
|
-
((
|
|
4287
|
+
var pe, Ie;
|
|
4288
|
+
((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
4289
|
}).catch(() => {
|
|
4290
|
-
var
|
|
4291
|
-
((
|
|
4290
|
+
var pe;
|
|
4291
|
+
((pe = S.current) == null ? void 0 : pe.id) === B && (S.current = null);
|
|
4292
4292
|
}) : (((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
4293
|
} catch {
|
|
4294
4294
|
((J = S.current) == null ? void 0 : J.id) === B && (S.current = null);
|
|
@@ -6272,7 +6272,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6272
6272
|
Lt(() => {
|
|
6273
6273
|
B && (X == null || X());
|
|
6274
6274
|
}, [B, X]);
|
|
6275
|
-
const
|
|
6275
|
+
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
6276
|
return Lt(() => {
|
|
6277
6277
|
g && ee(window.getComputedStyle(g).zIndex);
|
|
6278
6278
|
}, [g]), /* @__PURE__ */ u.jsx(
|
|
@@ -6305,7 +6305,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6305
6305
|
scope: n,
|
|
6306
6306
|
placedSide: O,
|
|
6307
6307
|
onArrowChange: C,
|
|
6308
|
-
arrowX:
|
|
6308
|
+
arrowX: pe,
|
|
6309
6309
|
arrowY: Ie,
|
|
6310
6310
|
shouldHideArrow: Ae,
|
|
6311
6311
|
children: /* @__PURE__ */ u.jsx(
|
|
@@ -7271,15 +7271,15 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7271
7271
|
...x
|
|
7272
7272
|
} = 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
7273
|
var q, M;
|
|
7274
|
-
const J = I.current + O, X = T().filter((H) => !H.disabled),
|
|
7274
|
+
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
7275
|
(function H(te) {
|
|
7276
7276
|
I.current = te, window.clearTimeout(E.current), te !== "" && (E.current = window.setTimeout(() => H(""), 1e3));
|
|
7277
7277
|
})(J), ee && setTimeout(() => ee.focus());
|
|
7278
7278
|
};
|
|
7279
7279
|
v.useEffect(() => () => window.clearTimeout(E.current), []), ba();
|
|
7280
7280
|
const D = v.useCallback((O) => {
|
|
7281
|
-
var X,
|
|
7282
|
-
return F.current === ((X = L.current) == null ? void 0 : X.side) && xb(O, (
|
|
7281
|
+
var X, pe;
|
|
7282
|
+
return F.current === ((X = L.current) == null ? void 0 : X.side) && xb(O, (pe = L.current) == null ? void 0 : pe.area);
|
|
7283
7283
|
}, []);
|
|
7284
7284
|
return /* @__PURE__ */ u.jsx(
|
|
7285
7285
|
eb,
|
|
@@ -7356,8 +7356,8 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7356
7356
|
ref: N,
|
|
7357
7357
|
style: { outline: "none", ...x.style },
|
|
7358
7358
|
onKeyDown: ue(x.onKeyDown, (O) => {
|
|
7359
|
-
const X = O.target.closest("[data-radix-menu-content]") === O.currentTarget,
|
|
7360
|
-
X && (O.key === "Tab" && O.preventDefault(), !
|
|
7359
|
+
const X = O.target.closest("[data-radix-menu-content]") === O.currentTarget, pe = O.ctrlKey || O.altKey || O.metaKey, Ie = O.key.length === 1;
|
|
7360
|
+
X && (O.key === "Tab" && O.preventDefault(), !pe && Ie && B(O.key));
|
|
7361
7361
|
const Ae = k.current;
|
|
7362
7362
|
if (O.target !== Ae || !Vw.includes(O.key)) return;
|
|
7363
7363
|
O.preventDefault();
|
|
@@ -7372,8 +7372,8 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7372
7372
|
to((O) => {
|
|
7373
7373
|
const J = O.target, X = j.current !== O.clientX;
|
|
7374
7374
|
if (O.currentTarget.contains(J) && X) {
|
|
7375
|
-
const
|
|
7376
|
-
F.current =
|
|
7375
|
+
const pe = O.clientX > j.current ? "right" : "left";
|
|
7376
|
+
F.current = pe, j.current = O.clientX;
|
|
7377
7377
|
}
|
|
7378
7378
|
})
|
|
7379
7379
|
)
|
|
@@ -9105,7 +9105,7 @@ const vo = et(
|
|
|
9105
9105
|
const $ = Pf(T), { align: A, behavior: B, offset: D } = $, O = k - 1, J = jf($, C, O);
|
|
9106
9106
|
let X = so(J, C.offsetTree, L) + E;
|
|
9107
9107
|
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
|
|
9108
|
+
const pe = (Ie) => {
|
|
9109
9109
|
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
9110
|
};
|
|
9111
9111
|
if (b(), B === "smooth") {
|
|
@@ -9113,10 +9113,10 @@ const vo = et(
|
|
|
9113
9113
|
w = ot(t, (Ae) => {
|
|
9114
9114
|
Ie = Ie || Ae;
|
|
9115
9115
|
}), y = pn(d, () => {
|
|
9116
|
-
|
|
9116
|
+
pe(Ie);
|
|
9117
9117
|
});
|
|
9118
9118
|
} else
|
|
9119
|
-
y = pn(U(t, D0(150)),
|
|
9119
|
+
y = pn(U(t, D0(150)), pe);
|
|
9120
9120
|
return g = setTimeout(() => {
|
|
9121
9121
|
b();
|
|
9122
9122
|
}, 1200), Me(l, !0), P("scrolling from index to", { behavior: B, index: J, top: X }, Xt.DEBUG), { behavior: B, top: X };
|
|
@@ -9558,11 +9558,11 @@ const hr = et(
|
|
|
9558
9558
|
}
|
|
9559
9559
|
if (!P)
|
|
9560
9560
|
return Ko([], J, N, j, A, F);
|
|
9561
|
-
const X = L.length > 0 ? L[L.length - 1] + 1 : 0,
|
|
9562
|
-
if (
|
|
9561
|
+
const X = L.length > 0 ? L[L.length - 1] + 1 : 0, pe = I0(B, S, k, X);
|
|
9562
|
+
if (pe.length === 0)
|
|
9563
9563
|
return null;
|
|
9564
9564
|
const Ie = N - 1, Ae = Bs([], (K) => {
|
|
9565
|
-
for (const ee of
|
|
9565
|
+
for (const ee of pe) {
|
|
9566
9566
|
const q = ee.value;
|
|
9567
9567
|
let M = q.offset, H = ee.start;
|
|
9568
9568
|
const te = q.size;
|
|
@@ -10739,7 +10739,7 @@ const TS = /* @__PURE__ */ et(
|
|
|
10739
10739
|
{ customScrollParent: y, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
|
|
10740
10740
|
C
|
|
10741
10741
|
]) => {
|
|
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),
|
|
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), pe = Y(!1);
|
|
10743
10743
|
ot(
|
|
10744
10744
|
U(
|
|
10745
10745
|
m,
|
|
@@ -10833,14 +10833,14 @@ const TS = /* @__PURE__ */ et(
|
|
|
10833
10833
|
if (de === 0 && (M === 0 || Ke === 0))
|
|
10834
10834
|
return Rc;
|
|
10835
10835
|
if (Ve === 0) {
|
|
10836
|
-
const he = Wa(Ne, M),
|
|
10837
|
-
return SS(Nc(he,
|
|
10836
|
+
const he = Wa(Ne, M), qe = he + Math.max(de - 1, 0);
|
|
10837
|
+
return SS(Nc(he, qe, Z));
|
|
10838
10838
|
}
|
|
10839
|
-
const
|
|
10839
|
+
const Xe = Xf(Ke, Ve, Le);
|
|
10840
10840
|
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:
|
|
10841
|
+
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);
|
|
10842
|
+
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;
|
|
10843
|
+
return { bottom: ht, itemHeight: He, items: Nt, itemWidth: Ve, offsetBottom: fe, offsetTop: lt, top: lt };
|
|
10844
10844
|
}
|
|
10845
10845
|
)
|
|
10846
10846
|
),
|
|
@@ -10961,7 +10961,7 @@ const TS = /* @__PURE__ */ et(
|
|
|
10961
10961
|
...h,
|
|
10962
10962
|
// output
|
|
10963
10963
|
gridState: N,
|
|
10964
|
-
horizontalDirection:
|
|
10964
|
+
horizontalDirection: pe,
|
|
10965
10965
|
initialTopMostItemIndex: O,
|
|
10966
10966
|
totalListHeight: q,
|
|
10967
10967
|
...p,
|
|
@@ -11021,7 +11021,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11021
11021
|
([e, t]) => ({ ...e, ...t }),
|
|
11022
11022
|
xt(TS, kS)
|
|
11023
11023
|
), ES = /* @__PURE__ */ z.memo(function() {
|
|
11024
|
-
const e =
|
|
11024
|
+
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
11025
|
z.useMemo(
|
|
11026
11026
|
() => (g) => {
|
|
11027
11027
|
const w = g.parentElement.parentElement.scrollHeight;
|
|
@@ -11076,7 +11076,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11076
11076
|
}
|
|
11077
11077
|
);
|
|
11078
11078
|
}), IS = z.memo(function() {
|
|
11079
|
-
const e =
|
|
11079
|
+
const e = wt("HeaderComponent"), t = sn("headerHeight"), n = wt("headerFooterTag"), r = pr(
|
|
11080
11080
|
z.useMemo(
|
|
11081
11081
|
() => (s) => {
|
|
11082
11082
|
t(Un(s, "height"));
|
|
@@ -11085,10 +11085,10 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11085
11085
|
),
|
|
11086
11086
|
!0,
|
|
11087
11087
|
!1
|
|
11088
|
-
), o =
|
|
11088
|
+
), o = wt("context");
|
|
11089
11089
|
return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
|
|
11090
11090
|
}), NS = z.memo(function() {
|
|
11091
|
-
const e =
|
|
11091
|
+
const e = wt("FooterComponent"), t = sn("footerHeight"), n = wt("headerFooterTag"), r = pr(
|
|
11092
11092
|
z.useMemo(
|
|
11093
11093
|
() => (s) => {
|
|
11094
11094
|
t(Un(s, "height"));
|
|
@@ -11097,7 +11097,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11097
11097
|
),
|
|
11098
11098
|
!0,
|
|
11099
11099
|
!1
|
|
11100
|
-
), o =
|
|
11100
|
+
), o = wt("context");
|
|
11101
11101
|
return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
|
|
11102
11102
|
}), AS = ({ children: e }) => {
|
|
11103
11103
|
const t = z.useContext(Wf), n = sn("itemDimensions"), r = sn("viewportDimensions"), o = pr(
|
|
@@ -11114,12 +11114,12 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11114
11114
|
t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
|
|
11115
11115
|
}, [t, r, n]), /* @__PURE__ */ u.jsx("div", { ref: o, style: Ws(!1), children: e });
|
|
11116
11116
|
}, jS = ({ children: e }) => {
|
|
11117
|
-
const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o =
|
|
11117
|
+
const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o = wt("customScrollParent"), s = Sf(n, o, !1);
|
|
11118
11118
|
return z.useEffect(() => {
|
|
11119
11119
|
t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
|
|
11120
11120
|
}, [t, n, r]), /* @__PURE__ */ u.jsx("div", { ref: s, style: Ws(!1), children: e });
|
|
11121
11121
|
}, _S = /* @__PURE__ */ z.memo(function({ ...e }) {
|
|
11122
|
-
const t =
|
|
11122
|
+
const t = wt("useWindowScroll"), n = wt("customScrollParent"), r = n || t ? OS : PS, o = n || t ? jS : AS, s = wt("context");
|
|
11123
11123
|
return /* @__PURE__ */ u.jsx(r, { ...e, ...Bt(r, s), children: /* @__PURE__ */ u.jsxs(o, { children: [
|
|
11124
11124
|
/* @__PURE__ */ u.jsx(IS, {}),
|
|
11125
11125
|
/* @__PURE__ */ u.jsx(ES, {}),
|
|
@@ -11127,7 +11127,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11127
11127
|
] }) });
|
|
11128
11128
|
}), {
|
|
11129
11129
|
useEmitter: Jf,
|
|
11130
|
-
useEmitterValue:
|
|
11130
|
+
useEmitterValue: wt,
|
|
11131
11131
|
usePublisher: sn
|
|
11132
11132
|
} = /* @__PURE__ */ Hf(
|
|
11133
11133
|
RS,
|
|
@@ -11170,7 +11170,7 @@ const kS = /* @__PURE__ */ et(() => {
|
|
|
11170
11170
|
}
|
|
11171
11171
|
},
|
|
11172
11172
|
_S
|
|
11173
|
-
), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue:
|
|
11173
|
+
), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn }), OS = /* @__PURE__ */ Yf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn });
|
|
11174
11174
|
function jc(e, t, n) {
|
|
11175
11175
|
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
11176
|
}
|
|
@@ -13585,7 +13585,7 @@ const Bc = z.memo(function({
|
|
|
13585
13585
|
defaultCheckpointId: N = null,
|
|
13586
13586
|
messageParentCheckpointId: E = null
|
|
13587
13587
|
}) {
|
|
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]),
|
|
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]), pe = !!X, Ie = !(r && O !== "user"), {
|
|
13589
13589
|
uploadingFiles: Ae,
|
|
13590
13590
|
handleFileClick: K,
|
|
13591
13591
|
fileViewerOpen: ee,
|
|
@@ -13657,7 +13657,7 @@ const Bc = z.memo(function({
|
|
|
13657
13657
|
default:
|
|
13658
13658
|
return /* @__PURE__ */ u.jsx(si, { className: we });
|
|
13659
13659
|
}
|
|
13660
|
-
}, [D, H, O]),
|
|
13660
|
+
}, [D, H, O]), Xe = z.useCallback(() => {
|
|
13661
13661
|
const W = "group relative mb-4 flex w-full";
|
|
13662
13662
|
switch (O) {
|
|
13663
13663
|
case "user":
|
|
@@ -13674,7 +13674,7 @@ const Bc = z.memo(function({
|
|
|
13674
13674
|
"rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
|
|
13675
13675
|
D && "px-3 py-2 text-sm"
|
|
13676
13676
|
);
|
|
13677
|
-
if (
|
|
13677
|
+
if (pe)
|
|
13678
13678
|
return Q(
|
|
13679
13679
|
W,
|
|
13680
13680
|
"w-full",
|
|
@@ -13708,9 +13708,9 @@ const Bc = z.memo(function({
|
|
|
13708
13708
|
"border border-border/60 dark:border-border/40"
|
|
13709
13709
|
);
|
|
13710
13710
|
}
|
|
13711
|
-
}, [D,
|
|
13712
|
-
if (
|
|
13713
|
-
return /* @__PURE__ */ u.jsx("div", { className: Q(
|
|
13711
|
+
}, [D, pe, O]);
|
|
13712
|
+
if (pe && X)
|
|
13713
|
+
return /* @__PURE__ */ u.jsx("div", { className: Q(Xe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Ze(), p.content), children: [
|
|
13714
13714
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
|
|
13715
13715
|
/* @__PURE__ */ u.jsx(si, { className: Q("h-4 w-4", H) }),
|
|
13716
13716
|
a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
|
|
@@ -13872,17 +13872,17 @@ const Bc = z.memo(function({
|
|
|
13872
13872
|
L,
|
|
13873
13873
|
lt,
|
|
13874
13874
|
H
|
|
13875
|
-
]),
|
|
13875
|
+
]), fe = at(() => X ? "Assistant" : kC(t), [X, t]), he = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), qe = z.useMemo(() => {
|
|
13876
13876
|
var W;
|
|
13877
13877
|
return he.length ? N && he.some((we) => we.id === N) ? N : ((W = he[0]) == null ? void 0 : W.id) ?? null : null;
|
|
13878
|
-
}, [N, he]),
|
|
13878
|
+
}, [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
13879
|
(W) => {
|
|
13880
13880
|
if (!k) return;
|
|
13881
13881
|
const we = (W == null ? void 0 : W.id) ?? null, ye = (W == null ? void 0 : W.parentId) ?? E ?? null;
|
|
13882
13882
|
k(we, ye);
|
|
13883
13883
|
},
|
|
13884
13884
|
[E, k]
|
|
13885
|
-
), ze = z.useMemo(() =>
|
|
13885
|
+
), 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
13886
|
const we = [];
|
|
13887
13887
|
if (W.step !== null && we.push(`Step ${W.step}`), W.source && we.push(W.source), !W.createdAt)
|
|
13888
13888
|
return we.length ? we.join(" • ") : W.id.slice(0, 8);
|
|
@@ -13899,7 +13899,7 @@ const Bc = z.memo(function({
|
|
|
13899
13899
|
return `${ye}`;
|
|
13900
13900
|
}, []);
|
|
13901
13901
|
return J && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
13902
|
-
/* @__PURE__ */ u.jsx("div", { className: Q(
|
|
13902
|
+
/* @__PURE__ */ u.jsx("div", { className: Q(Xe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Ze(), p.content), children: [
|
|
13903
13903
|
(i || a || J) && /* @__PURE__ */ u.jsxs(
|
|
13904
13904
|
"div",
|
|
13905
13905
|
{
|
|
@@ -13912,7 +13912,7 @@ const Bc = z.memo(function({
|
|
|
13912
13912
|
children: [
|
|
13913
13913
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13914
13914
|
Ke(),
|
|
13915
|
-
a &&
|
|
13915
|
+
a && fe && /* @__PURE__ */ u.jsx("span", { className: Q("font-medium", D ? "text-xs" : "text-sm"), children: fe }),
|
|
13916
13916
|
J && /* @__PURE__ */ u.jsxs(
|
|
13917
13917
|
Zf,
|
|
13918
13918
|
{
|
|
@@ -14399,7 +14399,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14399
14399
|
}
|
|
14400
14400
|
]
|
|
14401
14401
|
};
|
|
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]),
|
|
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]), pe = at(() => {
|
|
14403
14403
|
const Z = /* @__PURE__ */ new Set(), de = [];
|
|
14404
14404
|
for (let Ee = X.length - 1; Ee >= 0; Ee--) {
|
|
14405
14405
|
const Ne = X[Ee];
|
|
@@ -14502,14 +14502,14 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14502
14502
|
onCancelEdit: () => {
|
|
14503
14503
|
}
|
|
14504
14504
|
}
|
|
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 =
|
|
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 = pe.length > 0;
|
|
14506
14506
|
return lm(
|
|
14507
14507
|
L,
|
|
14508
14508
|
() => ({
|
|
14509
14509
|
scrollToLatest: () => {
|
|
14510
14510
|
var Z, de;
|
|
14511
|
-
if (F.current &&
|
|
14512
|
-
const Ee =
|
|
14511
|
+
if (F.current && pe.length > 0) {
|
|
14512
|
+
const Ee = pe.length - 1;
|
|
14513
14513
|
(de = (Z = F.current).scrollToIndex) == null || de.call(Z, {
|
|
14514
14514
|
index: Ee,
|
|
14515
14515
|
align: "end",
|
|
@@ -14519,14 +14519,14 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14519
14519
|
},
|
|
14520
14520
|
scrollToTop: () => {
|
|
14521
14521
|
var Z, de;
|
|
14522
|
-
F.current &&
|
|
14522
|
+
F.current && pe.length > 0 ? (de = (Z = F.current).scrollToIndex) == null || de.call(Z, {
|
|
14523
14523
|
index: 0,
|
|
14524
14524
|
align: "start",
|
|
14525
14525
|
behavior: "auto"
|
|
14526
14526
|
}) : j.current && (j.current.scrollTop = 0);
|
|
14527
14527
|
}
|
|
14528
14528
|
}),
|
|
14529
|
-
[
|
|
14529
|
+
[pe]
|
|
14530
14530
|
), /* @__PURE__ */ u.jsxs("div", { className: oe, style: p, children: [
|
|
14531
14531
|
te,
|
|
14532
14532
|
/* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Te ? /* @__PURE__ */ u.jsx(
|
|
@@ -14538,7 +14538,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14538
14538
|
scrollerRef: (Z) => {
|
|
14539
14539
|
j.current = Z instanceof HTMLDivElement ? Z : null;
|
|
14540
14540
|
},
|
|
14541
|
-
data:
|
|
14541
|
+
data: pe,
|
|
14542
14542
|
followOutput: K,
|
|
14543
14543
|
overscan: 200,
|
|
14544
14544
|
increaseViewportBy: { top: 100, bottom: 200 },
|
|
@@ -14554,16 +14554,16 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14554
14554
|
itemContent: (Z, de) => {
|
|
14555
14555
|
var tt;
|
|
14556
14556
|
const Ee = Hc(de, Z), Ne = "type" in de && de.type === "default_message";
|
|
14557
|
-
let Le = [], Je = null, He = {}, Ve = {}, Ke = null,
|
|
14557
|
+
let Le = [], Je = null, He = {}, Ve = {}, Ke = null, Xe = null;
|
|
14558
14558
|
if (!Ne) {
|
|
14559
14559
|
const Nt = de, ht = Nt.checkpointId ?? null;
|
|
14560
14560
|
He = Nt.additionalKwargs ?? {}, Ve = Nt.responseMetadata ?? {};
|
|
14561
14561
|
const lt = ht && k ? k.get(ht) ?? null : null;
|
|
14562
14562
|
Ke = typeof He.step == "number" ? He.step : typeof Ve.step == "number" ? Ve.step : (lt == null ? void 0 : lt.step) ?? null;
|
|
14563
14563
|
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
|
-
|
|
14564
|
+
Xe = ce ? String(ce) : null;
|
|
14565
|
+
const fe = Ke !== null && Xe ? `${Ke}:${Xe}` : null;
|
|
14566
|
+
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
14567
|
}
|
|
14568
14568
|
const Ze = (() => {
|
|
14569
14569
|
if (typeof He.parentCheckpointId == "string")
|
|
@@ -14648,15 +14648,15 @@ function Ai({
|
|
|
14648
14648
|
checkpoints: I,
|
|
14649
14649
|
interrupt: P,
|
|
14650
14650
|
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,
|
|
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, pe = P, [Ie, Ae] = xe(!1);
|
|
14652
14652
|
kt(() => {
|
|
14653
|
-
|
|
14654
|
-
}, [
|
|
14653
|
+
pe || Ae(!1);
|
|
14654
|
+
}, [pe]);
|
|
14655
14655
|
const K = ke(() => {
|
|
14656
14656
|
Ae(!0);
|
|
14657
14657
|
}, []), ee = ke(() => {
|
|
14658
14658
|
Ae(!1);
|
|
14659
|
-
}, []), q = !!
|
|
14659
|
+
}, []), 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
14660
|
Uc.value = G, st(G);
|
|
14661
14661
|
}, []), [W, we] = xe(!1), ye = Qe(null), pt = ke((G) => {
|
|
14662
14662
|
if (!Array.isArray(G))
|
|
@@ -14664,7 +14664,7 @@ function Ai({
|
|
|
14664
14664
|
for (let re = G.length - 1; re >= 0; re--) {
|
|
14665
14665
|
const ie = G[re];
|
|
14666
14666
|
if (!ie || ie.role !== "user") continue;
|
|
14667
|
-
const Se = (ie.content ?? []).filter((
|
|
14667
|
+
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
14668
|
return {
|
|
14669
14669
|
text: Se.length ? Se.join(" ").trim() : null,
|
|
14670
14670
|
messageId: ie.id ?? null
|
|
@@ -14689,16 +14689,16 @@ function Ai({
|
|
|
14689
14689
|
const G = (Se) => {
|
|
14690
14690
|
if (!Array.isArray(Se) || Se.length === 0)
|
|
14691
14691
|
return null;
|
|
14692
|
-
const ut = Se.map((
|
|
14693
|
-
if (typeof
|
|
14694
|
-
return
|
|
14695
|
-
if (
|
|
14696
|
-
const nt =
|
|
14692
|
+
const ut = Se.map((Ye) => {
|
|
14693
|
+
if (typeof Ye == "string")
|
|
14694
|
+
return Ye.trim();
|
|
14695
|
+
if (Ye && typeof Ye == "object" && "type" in Ye) {
|
|
14696
|
+
const nt = Ye;
|
|
14697
14697
|
if (typeof nt.type == "string")
|
|
14698
14698
|
return nt.type;
|
|
14699
14699
|
}
|
|
14700
14700
|
return null;
|
|
14701
|
-
}).filter((
|
|
14701
|
+
}).filter((Ye) => !!(Ye && Ye.length));
|
|
14702
14702
|
return ut.length ? ut.join(", ") : null;
|
|
14703
14703
|
}, re = Array.isArray(I) ? I.map((Se) => {
|
|
14704
14704
|
const ut = G(Se.next);
|
|
@@ -14711,9 +14711,9 @@ function Ai({
|
|
|
14711
14711
|
} : Se;
|
|
14712
14712
|
}) : [];
|
|
14713
14713
|
return re.some((Se) => mt(Se.metadata, "step") !== null) && re.sort((Se, ut) => {
|
|
14714
|
-
const
|
|
14715
|
-
if (
|
|
14716
|
-
return (nt ?? Number.NEGATIVE_INFINITY) - (
|
|
14714
|
+
const Ye = mt(Se.metadata, "step"), nt = mt(ut.metadata, "step");
|
|
14715
|
+
if (Ye !== null || nt !== null)
|
|
14716
|
+
return (nt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
|
|
14717
14717
|
const Mt = Date.parse(Se.createdAt ?? ""), tn = Date.parse(ut.createdAt ?? "");
|
|
14718
14718
|
return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
|
|
14719
14719
|
}), re;
|
|
@@ -14722,27 +14722,27 @@ function Ai({
|
|
|
14722
14722
|
for (const ie of Pe) {
|
|
14723
14723
|
const Se = ie.checkpointId ?? null;
|
|
14724
14724
|
if (!Se) continue;
|
|
14725
|
-
const ut = mt(ie.metadata, "step"),
|
|
14725
|
+
const ut = mt(ie.metadata, "step"), Ye = St(ie.metadata, "source"), nt = {
|
|
14726
14726
|
id: Se,
|
|
14727
14727
|
step: ut,
|
|
14728
|
-
source:
|
|
14728
|
+
source: Ye,
|
|
14729
14729
|
createdAt: ie.createdAt ?? null,
|
|
14730
14730
|
namespace: ie.checkpointNs ?? null,
|
|
14731
14731
|
parentId: ie.parentId ?? null
|
|
14732
14732
|
};
|
|
14733
|
-
if (G.set(Se, nt), ut !== null &&
|
|
14734
|
-
const Mt = `${ut}:${
|
|
14733
|
+
if (G.set(Se, nt), ut !== null && Ye) {
|
|
14734
|
+
const Mt = `${ut}:${Ye}`, tn = re.get(Mt) ?? [];
|
|
14735
14735
|
tn.push(nt), re.set(Mt, tn);
|
|
14736
14736
|
}
|
|
14737
14737
|
}
|
|
14738
14738
|
for (const ie of re.values())
|
|
14739
14739
|
ie.sort((Se, ut) => {
|
|
14740
|
-
const
|
|
14741
|
-
return (ut.createdAt ?? "").localeCompare(
|
|
14740
|
+
const Ye = Se.createdAt ?? "";
|
|
14741
|
+
return (ut.createdAt ?? "").localeCompare(Ye);
|
|
14742
14742
|
});
|
|
14743
14743
|
return { checkpointMetaById: G, checkpointIndexByKey: re };
|
|
14744
14744
|
}, [Pe, mt, St]), Ct = at(() => {
|
|
14745
|
-
var
|
|
14745
|
+
var Ye;
|
|
14746
14746
|
if (!Pe.length) return [];
|
|
14747
14747
|
const G = [...Pe].reverse(), re = (nt, Mt) => {
|
|
14748
14748
|
const tn = nt.checkpointId ?? null;
|
|
@@ -14761,7 +14761,7 @@ function Ai({
|
|
|
14761
14761
|
};
|
|
14762
14762
|
}, ie = [], Se = /* @__PURE__ */ new Set();
|
|
14763
14763
|
for (const nt of G) {
|
|
14764
|
-
const Mt = ((
|
|
14764
|
+
const Mt = ((Ye = St(nt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
|
|
14765
14765
|
if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
|
|
14766
14766
|
const Zn = re(nt, "User input");
|
|
14767
14767
|
Zn && !Se.has(Zn.id) && (ie.push(Zn), Se.add(Zn.id));
|
|
@@ -14799,7 +14799,7 @@ function Ai({
|
|
|
14799
14799
|
};
|
|
14800
14800
|
return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
|
|
14801
14801
|
}, []), kt(() => {
|
|
14802
|
-
Fe(!1),
|
|
14802
|
+
Fe(!1), yt.current = !1;
|
|
14803
14803
|
}, [D]), kt(() => {
|
|
14804
14804
|
ze.current = At;
|
|
14805
14805
|
}, [At]), kt(() => {
|
|
@@ -14810,13 +14810,13 @@ function Ai({
|
|
|
14810
14810
|
Pt.current === null && (Pt.current = ze.current), jt(te ?? "");
|
|
14811
14811
|
}, [te, M, jt]);
|
|
14812
14812
|
const R = ke(async () => {
|
|
14813
|
-
if (!(!b || T || !
|
|
14813
|
+
if (!(!b || T || !qe))
|
|
14814
14814
|
try {
|
|
14815
14815
|
await S();
|
|
14816
14816
|
} catch (G) {
|
|
14817
14817
|
console.warn("loadOlder failed", G);
|
|
14818
14818
|
}
|
|
14819
|
-
}, [b,
|
|
14819
|
+
}, [b, qe, T, S]);
|
|
14820
14820
|
kt(() => {
|
|
14821
14821
|
(async () => {
|
|
14822
14822
|
if (!x.baseUrl) {
|
|
@@ -14882,7 +14882,7 @@ function Ai({
|
|
|
14882
14882
|
}));
|
|
14883
14883
|
},
|
|
14884
14884
|
[At, c, jt]
|
|
14885
|
-
),
|
|
14885
|
+
), Ge = z.useCallback(() => {
|
|
14886
14886
|
H(null), oe(""), Te(null), de(null), jt(Pt.current ?? At), Pt.current = null;
|
|
14887
14887
|
}, [At, jt]), it = ke(
|
|
14888
14888
|
(G, re, ie) => {
|
|
@@ -14892,7 +14892,7 @@ function Ai({
|
|
|
14892
14892
|
), Be = ke((G) => {
|
|
14893
14893
|
for (let re = G - 1; re >= 0; re--)
|
|
14894
14894
|
if (w[re].role === "user") {
|
|
14895
|
-
const ie = w[re].content || [], ut = ie.filter((
|
|
14895
|
+
const ie = w[re].content || [], ut = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
|
|
14896
14896
|
try {
|
|
14897
14897
|
return JSON.stringify(ie, null, 2);
|
|
14898
14898
|
} catch {
|
|
@@ -14916,10 +14916,10 @@ function Ai({
|
|
|
14916
14916
|
const ie = re.filter((Se, ut) => G !== ut);
|
|
14917
14917
|
return ie.length === 0 && Ln(), ie;
|
|
14918
14918
|
});
|
|
14919
|
-
},
|
|
14919
|
+
}, bt = async (G) => {
|
|
14920
14920
|
const re = (G.target.files || [])[0];
|
|
14921
14921
|
if (re) {
|
|
14922
|
-
tt(null), ht(null),
|
|
14922
|
+
tt(null), ht(null), Xe(!0);
|
|
14923
14923
|
try {
|
|
14924
14924
|
await A(
|
|
14925
14925
|
{ attachments: [re] },
|
|
@@ -14934,10 +14934,10 @@ function Ai({
|
|
|
14934
14934
|
const Se = ie instanceof Error ? ie.message : "Failed to upload Excel file";
|
|
14935
14935
|
console.error("Excel upload failed", ie), tt(Se), m == null || m(Se);
|
|
14936
14936
|
} finally {
|
|
14937
|
-
|
|
14937
|
+
Xe(!1), G.target.value = "", Ln();
|
|
14938
14938
|
}
|
|
14939
14939
|
}
|
|
14940
|
-
},
|
|
14940
|
+
}, vt = async (G) => {
|
|
14941
14941
|
if (y) {
|
|
14942
14942
|
we(!0);
|
|
14943
14943
|
try {
|
|
@@ -14959,9 +14959,9 @@ function Ai({
|
|
|
14959
14959
|
}
|
|
14960
14960
|
}, Kt = ke(
|
|
14961
14961
|
async (G) => {
|
|
14962
|
-
await
|
|
14962
|
+
await vt(G);
|
|
14963
14963
|
},
|
|
14964
|
-
[
|
|
14964
|
+
[vt]
|
|
14965
14965
|
), 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
14966
|
(G) => {
|
|
14967
14967
|
if (!G)
|
|
@@ -14997,7 +14997,7 @@ function Ai({
|
|
|
14997
14997
|
value: O ?? "",
|
|
14998
14998
|
onChange: (G) => {
|
|
14999
14999
|
const re = G.target.value || null;
|
|
15000
|
-
|
|
15000
|
+
vt(re);
|
|
15001
15001
|
},
|
|
15002
15002
|
children: [
|
|
15003
15003
|
/* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
|
|
@@ -15030,21 +15030,21 @@ function Ai({
|
|
|
15030
15030
|
enableMessageEditing: c,
|
|
15031
15031
|
editingMessageId: M,
|
|
15032
15032
|
onStartReached: () => {
|
|
15033
|
-
|
|
15033
|
+
qe && R();
|
|
15034
15034
|
},
|
|
15035
15035
|
onScrollAway: (G) => {
|
|
15036
|
-
if (!
|
|
15037
|
-
|
|
15036
|
+
if (!yt.current) {
|
|
15037
|
+
yt.current = !0;
|
|
15038
15038
|
return;
|
|
15039
15039
|
}
|
|
15040
15040
|
G && Fe(!0);
|
|
15041
15041
|
},
|
|
15042
15042
|
onEdit: it,
|
|
15043
15043
|
onRegenerate: Be,
|
|
15044
|
-
onCancelEdit:
|
|
15045
|
-
emptyMessage:
|
|
15044
|
+
onCancelEdit: Ge,
|
|
15045
|
+
emptyMessage: fe ?? void 0,
|
|
15046
15046
|
isNavigatingCheckpoint: W,
|
|
15047
|
-
activeInterrupt:
|
|
15047
|
+
activeInterrupt: pe,
|
|
15048
15048
|
disableInterruptActions: Ie,
|
|
15049
15049
|
onInterruptActionStart: K,
|
|
15050
15050
|
onInterruptActionEnd: ee,
|
|
@@ -15083,7 +15083,7 @@ function Ai({
|
|
|
15083
15083
|
{
|
|
15084
15084
|
variant: "ghost",
|
|
15085
15085
|
size: "sm",
|
|
15086
|
-
onClick:
|
|
15086
|
+
onClick: Ge,
|
|
15087
15087
|
className: "text-blue-600 hover:bg-blue-100",
|
|
15088
15088
|
children: /* @__PURE__ */ u.jsx(vr, { size: 16 })
|
|
15089
15089
|
}
|
|
@@ -15125,7 +15125,7 @@ function Ai({
|
|
|
15125
15125
|
ref: Jn,
|
|
15126
15126
|
type: "file",
|
|
15127
15127
|
accept: ".xls,.xlsx,.xlsm",
|
|
15128
|
-
onChange:
|
|
15128
|
+
onChange: bt,
|
|
15129
15129
|
className: "hidden"
|
|
15130
15130
|
},
|
|
15131
15131
|
He
|
|
@@ -15189,7 +15189,7 @@ function Ai({
|
|
|
15189
15189
|
disabled: q,
|
|
15190
15190
|
maxLength: Wo,
|
|
15191
15191
|
onSend: se,
|
|
15192
|
-
onCancelEdit:
|
|
15192
|
+
onCancelEdit: Ge,
|
|
15193
15193
|
onStop: B,
|
|
15194
15194
|
allowEmptySend: Ee.length > 0,
|
|
15195
15195
|
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 +15842,7 @@ function Kc({
|
|
|
15842
15842
|
I(null), L("");
|
|
15843
15843
|
}, X = (K, ee) => {
|
|
15844
15844
|
K.key === "Enter" ? O(ee) : K.key === "Escape" && J();
|
|
15845
|
-
},
|
|
15845
|
+
}, pe = (K) => {
|
|
15846
15846
|
if (!K) return "";
|
|
15847
15847
|
try {
|
|
15848
15848
|
const ee = new Date(K), M = (/* @__PURE__ */ new Date()).getTime() - ee.getTime(), H = Math.floor(M / (1e3 * 60 * 60 * 24));
|
|
@@ -15894,7 +15894,7 @@ function Kc({
|
|
|
15894
15894
|
/* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(K) }),
|
|
15895
15895
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
15896
15896
|
/* @__PURE__ */ u.jsx(Cm, { size: 10 }),
|
|
15897
|
-
/* @__PURE__ */ u.jsx("span", { children:
|
|
15897
|
+
/* @__PURE__ */ u.jsx("span", { children: pe(K.updatedAt || K.createdAt) })
|
|
15898
15898
|
] })
|
|
15899
15899
|
] }) }),
|
|
15900
15900
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
@@ -16455,7 +16455,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
|
|
|
16455
16455
|
const [J, X] = Lh((q) => {
|
|
16456
16456
|
const M = L().filter((oe) => !oe.disabled), H = M.find((oe) => oe.ref.current === document.activeElement), te = Fh(M, q, H);
|
|
16457
16457
|
te && setTimeout(() => te.ref.current.focus());
|
|
16458
|
-
}),
|
|
16458
|
+
}), pe = v.useCallback(
|
|
16459
16459
|
(q, M, H) => {
|
|
16460
16460
|
const te = !$.current && !H;
|
|
16461
16461
|
(w.value !== void 0 && w.value === M || te) && (E(q), te && ($.current = !0));
|
|
@@ -16486,7 +16486,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
|
|
|
16486
16486
|
content: b,
|
|
16487
16487
|
viewport: C,
|
|
16488
16488
|
onViewportChange: S,
|
|
16489
|
-
itemRefCallback:
|
|
16489
|
+
itemRefCallback: pe,
|
|
16490
16490
|
selectedItem: N,
|
|
16491
16491
|
onItemLeave: Ie,
|
|
16492
16492
|
itemTextRefCallback: Ae,
|
|
@@ -16580,7 +16580,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16580
16580
|
]);
|
|
16581
16581
|
a.style.minWidth = Z + "px", a.style.right = Ne + "px";
|
|
16582
16582
|
}
|
|
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),
|
|
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), 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
16584
|
if (M <= Ae) {
|
|
16585
16585
|
const oe = P.length > 0 && y === P[P.length - 1].ref.current;
|
|
16586
16586
|
a.style.bottom = "0px";
|
|
@@ -16596,7 +16596,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16596
16596
|
const Te = Math.max(
|
|
16597
16597
|
Ae,
|
|
16598
16598
|
$ + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
16599
|
-
(oe ?
|
|
16599
|
+
(oe ? pe : 0) + ee
|
|
16600
16600
|
) + H;
|
|
16601
16601
|
a.style.height = Te + "px", x.scrollTop = M - Ae + x.offsetTop;
|
|
16602
16602
|
}
|