teodor-new-chat-ui 4.1.1 → 4.1.2
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 +117 -118
- package/dist/index.umd.js +9 -9
- package/dist/types/api.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -324,7 +324,7 @@ function om() {
|
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var
|
|
327
|
+
var be = Object.prototype.hasOwnProperty, je = {}, Ye = x.ReactDebugCurrentFrame;
|
|
328
328
|
function Fe(T) {
|
|
329
329
|
if (T) {
|
|
330
330
|
var B = T._owner, Q = et(T.type, T._source, B ? B.type : null);
|
|
@@ -334,7 +334,7 @@ function om() {
|
|
|
334
334
|
}
|
|
335
335
|
function st(T, B, Q, Ce, Ve) {
|
|
336
336
|
{
|
|
337
|
-
var Je = Function.call.bind(
|
|
337
|
+
var Je = Function.call.bind(be);
|
|
338
338
|
for (var $e in T)
|
|
339
339
|
if (Je(T, $e)) {
|
|
340
340
|
var Pe = void 0;
|
|
@@ -371,7 +371,7 @@ function om() {
|
|
|
371
371
|
function Se(T) {
|
|
372
372
|
return "" + T;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function ve(T) {
|
|
375
375
|
if (pe(T))
|
|
376
376
|
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ae(T)), Se(T);
|
|
377
377
|
}
|
|
@@ -382,7 +382,7 @@ function om() {
|
|
|
382
382
|
__source: !0
|
|
383
383
|
}, Ue, lt;
|
|
384
384
|
function Et(T) {
|
|
385
|
-
if (
|
|
385
|
+
if (be.call(T, "ref")) {
|
|
386
386
|
var B = Object.getOwnPropertyDescriptor(T, "ref").get;
|
|
387
387
|
if (B && B.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,7 +390,7 @@ function om() {
|
|
|
390
390
|
return T.ref !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function yn(T) {
|
|
393
|
-
if (
|
|
393
|
+
if (be.call(T, "key")) {
|
|
394
394
|
var B = Object.getOwnPropertyDescriptor(T, "key").get;
|
|
395
395
|
if (B && B.isReactWarning)
|
|
396
396
|
return !1;
|
|
@@ -454,9 +454,9 @@ function om() {
|
|
|
454
454
|
function qe(T, B, Q, Ce, Ve) {
|
|
455
455
|
{
|
|
456
456
|
var Je, $e = {}, Pe = null, Ct = null;
|
|
457
|
-
Q !== void 0 && (
|
|
457
|
+
Q !== void 0 && (ve(Q), Pe = "" + Q), yn(B) && (ve(B.key), Pe = "" + B.key), Et(B) && (Ct = B.ref, G(B, Ve));
|
|
458
458
|
for (Je in B)
|
|
459
|
-
|
|
459
|
+
be.call(B, Je) && !Xe.hasOwnProperty(Je) && ($e[Je] = B[Je]);
|
|
460
460
|
if (T && T.defaultProps) {
|
|
461
461
|
var ct = T.defaultProps;
|
|
462
462
|
for (Je in ct)
|
|
@@ -607,7 +607,7 @@ Check the top-level render call using <` + Q + ">.");
|
|
|
607
607
|
else
|
|
608
608
|
he($t, T);
|
|
609
609
|
}
|
|
610
|
-
if (
|
|
610
|
+
if (be.call(B, "key")) {
|
|
611
611
|
var Fn = D(T), It = Object.keys(B).filter(function(kp) {
|
|
612
612
|
return kp !== "key";
|
|
613
613
|
}), Fs = It.length > 0 ? "{key: someKey, " + It.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -2957,13 +2957,13 @@ function Zg(e = {}) {
|
|
|
2957
2957
|
credentials: i
|
|
2958
2958
|
});
|
|
2959
2959
|
if (!fe.ok || !fe.body) {
|
|
2960
|
-
const
|
|
2960
|
+
const be = await fe.text().catch(() => "");
|
|
2961
2961
|
throw console.debug(
|
|
2962
2962
|
"[use-chat] non-OK response",
|
|
2963
2963
|
fe.status,
|
|
2964
|
-
|
|
2964
|
+
be == null ? void 0 : be.slice(0, 500)
|
|
2965
2965
|
), new Error(
|
|
2966
|
-
`stream ${fe.status}${
|
|
2966
|
+
`stream ${fe.status}${be ? ": " + be : ""}`
|
|
2967
2967
|
);
|
|
2968
2968
|
}
|
|
2969
2969
|
b(!0);
|
|
@@ -2973,8 +2973,8 @@ function Zg(e = {}) {
|
|
|
2973
2973
|
let V = 0, X = null;
|
|
2974
2974
|
const se = () => {
|
|
2975
2975
|
if (P.length) {
|
|
2976
|
-
const
|
|
2977
|
-
P = [], R.current && h((je) => je +
|
|
2976
|
+
const be = P.join("");
|
|
2977
|
+
P = [], R.current && h((je) => je + be);
|
|
2978
2978
|
}
|
|
2979
2979
|
X = null;
|
|
2980
2980
|
}, ne = () => {
|
|
@@ -2982,14 +2982,14 @@ function Zg(e = {}) {
|
|
|
2982
2982
|
};
|
|
2983
2983
|
let Le = Date.now();
|
|
2984
2984
|
const Ge = setInterval(() => {
|
|
2985
|
-
var
|
|
2986
|
-
if (Date.now() - Le >
|
|
2985
|
+
var be;
|
|
2986
|
+
if (Date.now() - Le > 6e4) {
|
|
2987
2987
|
const je = "Stream idle timeout";
|
|
2988
|
-
d(je), D.abort(), (
|
|
2988
|
+
d(je), D.abort(), (be = M == null ? void 0 : M.onError) == null || be.call(M, je);
|
|
2989
2989
|
}
|
|
2990
2990
|
}, 5e3), et = 1024 * 1024;
|
|
2991
2991
|
try {
|
|
2992
|
-
const
|
|
2992
|
+
const be = fe.headers.get("X-Thread-Id") || fe.headers.get("x-thread-id"), je = fe.headers.get("X-Thread-Created") || fe.headers.get("x-thread-created"), Ye = be ?? null, Fe = String(je ?? "").toLowerCase() === "true";
|
|
2993
2993
|
for ((L = M == null ? void 0 : M.onOpen) == null || L.call(M, { threadId: Ye, created: Fe }); ; ) {
|
|
2994
2994
|
const { value: st, done: at } = await Re.read();
|
|
2995
2995
|
if (at) break;
|
|
@@ -3009,29 +3009,28 @@ function Zg(e = {}) {
|
|
|
3009
3009
|
console.debug("[use-chat] malformed SSE:", pe.slice(0, 200));
|
|
3010
3010
|
continue;
|
|
3011
3011
|
}
|
|
3012
|
-
const
|
|
3012
|
+
const ve = Qg(Se) ? Se.data : Se;
|
|
3013
3013
|
Le = Date.now();
|
|
3014
|
-
const Ie =
|
|
3014
|
+
const Ie = ve.seq;
|
|
3015
3015
|
if (Ie !== void 0) {
|
|
3016
3016
|
if (Ie <= V) {
|
|
3017
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Ie, lastProcessedSeq: V, type:
|
|
3017
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Ie, lastProcessedSeq: V, type: ve.type });
|
|
3018
3018
|
continue;
|
|
3019
3019
|
}
|
|
3020
3020
|
V > 0 && Ie > V + 1 && ((k = M == null ? void 0 : M.onGap) == null || k.call(M, { from: V, to: Ie })), V = Ie, S.current = Ie, g(Ie);
|
|
3021
3021
|
}
|
|
3022
|
-
if (O == null || O(
|
|
3023
|
-
P.push(
|
|
3024
|
-
else if (
|
|
3025
|
-
const Xe =
|
|
3022
|
+
if (O == null || O(ve), ve.type === "token" && e.autoAppendAssistant !== !1)
|
|
3023
|
+
P.push(ve.content), ne();
|
|
3024
|
+
else if (ve.type === "message_delta") {
|
|
3025
|
+
const Xe = ve.delta.filter((Ue) => Ue.type === "text").map((Ue) => Ue.text).join("");
|
|
3026
3026
|
Xe && e.autoAppendAssistant !== !1 && (P.push(Xe), ne());
|
|
3027
|
-
} else
|
|
3028
|
-
X !== null && cancelAnimationFrame(X), se(), be.type === "checkpoint" ? w(be.checkpointId) : be.type === "error" && d(be.message);
|
|
3027
|
+
} else ve.type === "heartbeat" ? console.debug("[use-chat] heartbeat received") : (X !== null && cancelAnimationFrame(X), se(), ve.type === "checkpoint" ? w(ve.checkpointId) : ve.type === "error" && d(ve.message));
|
|
3029
3028
|
}
|
|
3030
3029
|
}
|
|
3031
3030
|
se();
|
|
3032
|
-
} catch (
|
|
3033
|
-
if (
|
|
3034
|
-
const je =
|
|
3031
|
+
} catch (be) {
|
|
3032
|
+
if (be.name !== "AbortError") {
|
|
3033
|
+
const je = be.message || String(be);
|
|
3035
3034
|
d(je), (U = M == null ? void 0 : M.onError) == null || U.call(M, je);
|
|
3036
3035
|
}
|
|
3037
3036
|
} finally {
|
|
@@ -3231,7 +3230,7 @@ function ox({
|
|
|
3231
3230
|
(We || Ee) && V();
|
|
3232
3231
|
},
|
|
3233
3232
|
[V, D.messages.length]
|
|
3234
|
-
), { startStream: Ge, stop: et, isStreaming:
|
|
3233
|
+
), { startStream: Ge, stop: et, isStreaming: be, error: je, setAuthToken: Ye } = tx({
|
|
3235
3234
|
baseUrl: d,
|
|
3236
3235
|
onThreadInfo: Le,
|
|
3237
3236
|
onMessageEvent: q,
|
|
@@ -3241,8 +3240,8 @@ function ox({
|
|
|
3241
3240
|
onSequenceGap: ne
|
|
3242
3241
|
});
|
|
3243
3242
|
gt(() => {
|
|
3244
|
-
P.current =
|
|
3245
|
-
}, [z,
|
|
3243
|
+
P.current = be, be || z();
|
|
3244
|
+
}, [z, be]), gt(() => {
|
|
3246
3245
|
var Ee;
|
|
3247
3246
|
const G = l.getAuthToken();
|
|
3248
3247
|
Ye(G);
|
|
@@ -3319,7 +3318,7 @@ function ox({
|
|
|
3319
3318
|
await Z(k.current, G, le ?? void 0, !0);
|
|
3320
3319
|
},
|
|
3321
3320
|
[Z]
|
|
3322
|
-
),
|
|
3321
|
+
), ve = ze(async () => {
|
|
3323
3322
|
if (!k.current) throw new Error("No active thread");
|
|
3324
3323
|
await Z(k.current, void 0, void 0, !0);
|
|
3325
3324
|
}, [Z]), Ie = ze(
|
|
@@ -3465,7 +3464,7 @@ function ox({
|
|
|
3465
3464
|
clearCurrentThread: ae,
|
|
3466
3465
|
listCheckpoints: pe,
|
|
3467
3466
|
navigateToCheckpoint: Se,
|
|
3468
|
-
returnToLatest:
|
|
3467
|
+
returnToLatest: ve
|
|
3469
3468
|
}),
|
|
3470
3469
|
[
|
|
3471
3470
|
ae,
|
|
@@ -3479,7 +3478,7 @@ function ox({
|
|
|
3479
3478
|
Se,
|
|
3480
3479
|
ue,
|
|
3481
3480
|
at,
|
|
3482
|
-
|
|
3481
|
+
ve,
|
|
3483
3482
|
f
|
|
3484
3483
|
]
|
|
3485
3484
|
), Et = pt(
|
|
@@ -3508,14 +3507,14 @@ function ox({
|
|
|
3508
3507
|
]
|
|
3509
3508
|
), yn = pt(
|
|
3510
3509
|
() => ({
|
|
3511
|
-
isStreaming:
|
|
3510
|
+
isStreaming: be,
|
|
3512
3511
|
error: je,
|
|
3513
3512
|
streamingAssistantId: D.assemblingId,
|
|
3514
3513
|
lastCheckpointId: D.lastCheckpointId ?? null,
|
|
3515
3514
|
lastCheckpointNs: D.lastCheckpointNs ?? null
|
|
3516
3515
|
}),
|
|
3517
3516
|
[
|
|
3518
|
-
|
|
3517
|
+
be,
|
|
3519
3518
|
D.assemblingId,
|
|
3520
3519
|
D.lastCheckpointId,
|
|
3521
3520
|
D.lastCheckpointNs,
|
|
@@ -3946,7 +3945,7 @@ function ht(...e) {
|
|
|
3946
3945
|
}
|
|
3947
3946
|
};
|
|
3948
3947
|
}
|
|
3949
|
-
function
|
|
3948
|
+
function we(e, t = su) {
|
|
3950
3949
|
return F(e, tt(t));
|
|
3951
3950
|
}
|
|
3952
3951
|
function bi(...e) {
|
|
@@ -4874,7 +4873,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
|
|
|
4874
4873
|
}, Fx = 0, ro = He(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
|
|
4875
4874
|
const i = K(!1), a = K(!0), l = De(), u = De(), d = K(4), f = K(Fx), h = St(
|
|
4876
4875
|
F(
|
|
4877
|
-
bi(F(
|
|
4876
|
+
bi(F(we(o), qn(1), rn(!0)), F(we(o), qn(1), rn(!1), xl(100))),
|
|
4878
4877
|
tt()
|
|
4879
4878
|
),
|
|
4880
4879
|
!1
|
|
@@ -4884,7 +4883,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
|
|
|
4884
4883
|
);
|
|
4885
4884
|
ce(
|
|
4886
4885
|
F(
|
|
4887
|
-
ht(
|
|
4886
|
+
ht(we(o), we(f)),
|
|
4888
4887
|
te(([b, y]) => b <= y),
|
|
4889
4888
|
tt()
|
|
4890
4889
|
),
|
|
@@ -4892,7 +4891,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
|
|
|
4892
4891
|
), ce(F(a, xn(50)), u);
|
|
4893
4892
|
const w = Dt(
|
|
4894
4893
|
F(
|
|
4895
|
-
ht(r,
|
|
4894
|
+
ht(r, we(s), we(t), we(e), we(d)),
|
|
4896
4895
|
sn((b, [{ scrollHeight: y, scrollTop: R }, S, C, E, I]) => {
|
|
4897
4896
|
const j = R + S - y > -I, N = {
|
|
4898
4897
|
scrollHeight: y,
|
|
@@ -5016,15 +5015,15 @@ const na = He(
|
|
|
5016
5015
|
const s = De(), i = K(0), a = K(0), l = K(0), u = St(
|
|
5017
5016
|
F(
|
|
5018
5017
|
ht(
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5018
|
+
we(r),
|
|
5019
|
+
we(o),
|
|
5020
|
+
we(n),
|
|
5021
|
+
we(s, Hr),
|
|
5022
|
+
we(l),
|
|
5023
|
+
we(i),
|
|
5024
|
+
we(t),
|
|
5025
|
+
we(e),
|
|
5026
|
+
we(a)
|
|
5028
5027
|
),
|
|
5029
5028
|
te(
|
|
5030
5029
|
([
|
|
@@ -5167,14 +5166,14 @@ const er = He(
|
|
|
5167
5166
|
ht(
|
|
5168
5167
|
p,
|
|
5169
5168
|
w,
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5169
|
+
we(l, Hr),
|
|
5170
|
+
we(o),
|
|
5171
|
+
we(r),
|
|
5172
|
+
we(u),
|
|
5174
5173
|
d,
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5174
|
+
we(v),
|
|
5175
|
+
we(t),
|
|
5176
|
+
we(n),
|
|
5178
5177
|
e
|
|
5179
5178
|
),
|
|
5180
5179
|
ye(([C, E, , I, , , , , , , j]) => {
|
|
@@ -5333,7 +5332,7 @@ const er = He(
|
|
|
5333
5332
|
),
|
|
5334
5333
|
0
|
|
5335
5334
|
);
|
|
5336
|
-
return ce(
|
|
5335
|
+
return ce(we(i), s), { totalListHeight: i, totalListHeightChanged: s };
|
|
5337
5336
|
},
|
|
5338
5337
|
nt(Tt, er),
|
|
5339
5338
|
{ singleton: !0 }
|
|
@@ -5428,8 +5427,8 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
|
|
|
5428
5427
|
}
|
|
5429
5428
|
Ke(
|
|
5430
5429
|
F(
|
|
5431
|
-
ht(F(
|
|
5432
|
-
_e(
|
|
5430
|
+
ht(F(we(t), qn(1)), l),
|
|
5431
|
+
_e(we(w), s, a, f),
|
|
5433
5432
|
te(([[S, C], E, I, j, N]) => {
|
|
5434
5433
|
let O = C && j, M = "auto";
|
|
5435
5434
|
return O && (M = Hx(E, I || N), O = O && !!M), { followOutputBehavior: M, shouldFollow: O, totalCount: S };
|
|
@@ -5452,7 +5451,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
|
|
|
5452
5451
|
}
|
|
5453
5452
|
Ke(
|
|
5454
5453
|
F(
|
|
5455
|
-
ht(
|
|
5454
|
+
ht(we(w), t, u),
|
|
5456
5455
|
ye(([S, , C]) => S && C),
|
|
5457
5456
|
sn(
|
|
5458
5457
|
({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
|
|
@@ -5466,26 +5465,26 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
|
|
|
5466
5465
|
}
|
|
5467
5466
|
), Ke(v, () => {
|
|
5468
5467
|
b(ut(w) !== !1);
|
|
5469
|
-
}), Ke(ht(
|
|
5468
|
+
}), Ke(ht(we(w), o), ([S, C]) => {
|
|
5470
5469
|
S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && x("auto");
|
|
5471
5470
|
});
|
|
5472
5471
|
const y = K(null), R = De();
|
|
5473
5472
|
return ce(
|
|
5474
5473
|
bi(
|
|
5475
5474
|
F(
|
|
5476
|
-
|
|
5475
|
+
we(r),
|
|
5477
5476
|
te((S) => {
|
|
5478
5477
|
var C;
|
|
5479
5478
|
return (C = S == null ? void 0 : S.length) != null ? C : 0;
|
|
5480
5479
|
})
|
|
5481
5480
|
),
|
|
5482
|
-
F(
|
|
5481
|
+
F(we(t))
|
|
5483
5482
|
),
|
|
5484
5483
|
R
|
|
5485
5484
|
), Ke(
|
|
5486
5485
|
F(
|
|
5487
5486
|
ht(F(R, qn(1)), l),
|
|
5488
|
-
_e(
|
|
5487
|
+
_e(we(y), a, f, h),
|
|
5489
5488
|
te(([[S, C], E, I, j, N]) => C && I && (E == null ? void 0 : E({ context: N, totalCount: S, scrollingInProgress: j }))),
|
|
5490
5489
|
ye((S) => !!S),
|
|
5491
5490
|
xn(0)
|
|
@@ -6451,10 +6450,10 @@ const Cv = /* @__PURE__ */ He(
|
|
|
6451
6450
|
), ce(
|
|
6452
6451
|
F(
|
|
6453
6452
|
ht(
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6453
|
+
we(j, ho),
|
|
6454
|
+
we(N, ho),
|
|
6455
|
+
we(W, (P, V) => P && P.column === V.column && P.row === V.row),
|
|
6456
|
+
we(u)
|
|
6458
6457
|
),
|
|
6459
6458
|
te(([P, V, X, se]) => ({
|
|
6460
6459
|
gap: X,
|
|
@@ -6467,16 +6466,16 @@ const Cv = /* @__PURE__ */ He(
|
|
|
6467
6466
|
), ce(
|
|
6468
6467
|
F(
|
|
6469
6468
|
ht(
|
|
6470
|
-
|
|
6469
|
+
we(C),
|
|
6471
6470
|
r,
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6471
|
+
we(W, Sv),
|
|
6472
|
+
we(N, ho),
|
|
6473
|
+
we(j, ho),
|
|
6474
|
+
we(_),
|
|
6475
|
+
we(E),
|
|
6476
|
+
we(L),
|
|
6477
|
+
we(U),
|
|
6478
|
+
we(k)
|
|
6480
6479
|
),
|
|
6481
6480
|
ye(([, , , , , , , P]) => !P),
|
|
6482
6481
|
te(
|
|
@@ -6489,7 +6488,7 @@ const Cv = /* @__PURE__ */ He(
|
|
|
6489
6488
|
Ge,
|
|
6490
6489
|
et,
|
|
6491
6490
|
,
|
|
6492
|
-
|
|
6491
|
+
be,
|
|
6493
6492
|
je
|
|
6494
6493
|
]) => {
|
|
6495
6494
|
const { column: Ye, row: Fe } = se, { height: st, width: at } = ne, { width: Z } = Le;
|
|
@@ -6501,9 +6500,9 @@ const Cv = /* @__PURE__ */ He(
|
|
|
6501
6500
|
}
|
|
6502
6501
|
const ae = Ou(Z, at, Ye);
|
|
6503
6502
|
let pe, Se;
|
|
6504
|
-
|
|
6505
|
-
const
|
|
6506
|
-
return { bottom: Ie, itemHeight: st, items:
|
|
6503
|
+
be ? V === 0 && X === 0 && et > 0 ? (pe = 0, Se = et - 1) : (pe = ae * Bo((V + Fe) / (st + Fe)), Se = ae * Nl((X + Fe) / (st + Fe)) - 1, Se = Xs(P - 1, Mr(Se, ae - 1)), pe = Xs(Se, Mr(0, pe))) : (pe = 0, Se = -1);
|
|
6504
|
+
const ve = jl(pe, Se, Ge), { bottom: Ie, top: Xe } = _l(Le, se, ne, ve), Ue = Nl(P / ae), lt = Ue * st + (Ue - 1) * Fe - Ie;
|
|
6505
|
+
return { bottom: Ie, itemHeight: st, items: ve, itemWidth: at, offsetBottom: lt, offsetTop: Xe, top: Xe };
|
|
6507
6506
|
}
|
|
6508
6507
|
)
|
|
6509
6508
|
),
|
|
@@ -6550,14 +6549,14 @@ const Cv = /* @__PURE__ */ He(
|
|
|
6550
6549
|
)
|
|
6551
6550
|
), Re = Dt(
|
|
6552
6551
|
F(
|
|
6553
|
-
|
|
6552
|
+
we(I),
|
|
6554
6553
|
ye(({ items: P }) => P.length > 0 && P[0].index === 0),
|
|
6555
6554
|
rn(0),
|
|
6556
6555
|
tt()
|
|
6557
6556
|
)
|
|
6558
6557
|
), ue = Dt(
|
|
6559
6558
|
F(
|
|
6560
|
-
|
|
6559
|
+
we(I),
|
|
6561
6560
|
_e(L),
|
|
6562
6561
|
ye(([{ items: P }, V]) => P.length > 0 && !V),
|
|
6563
6562
|
te(([{ items: P }]) => ({
|
|
@@ -6573,11 +6572,11 @@ const Cv = /* @__PURE__ */ He(
|
|
|
6573
6572
|
O,
|
|
6574
6573
|
_e(j, N, C, W),
|
|
6575
6574
|
te(([P, V, X, se, ne]) => {
|
|
6576
|
-
const Le = xu(P), { align: Ge, behavior: et, offset:
|
|
6575
|
+
const Le = xu(P), { align: Ge, behavior: et, offset: be } = Le;
|
|
6577
6576
|
let je = Le.index;
|
|
6578
6577
|
je === "LAST" && (je = se - 1), je = Mr(0, je, Xs(se - 1, je));
|
|
6579
6578
|
let Ye = Ri(V, ne, X, je);
|
|
6580
|
-
return Ge === "end" ? Ye = Al(Ye - V.height + X.height) : Ge === "center" && (Ye = Al(Ye - V.height / 2 + X.height / 2)),
|
|
6579
|
+
return Ge === "end" ? Ye = Al(Ye - V.height + X.height) : Ge === "center" && (Ye = Al(Ye - V.height / 2 + X.height / 2)), be && (Ye += be), { behavior: et, top: Ye };
|
|
6581
6580
|
})
|
|
6582
6581
|
),
|
|
6583
6582
|
l
|
|
@@ -6662,7 +6661,7 @@ const Tv = /* @__PURE__ */ He(() => {
|
|
|
6662
6661
|
),
|
|
6663
6662
|
h
|
|
6664
6663
|
), u = K(!1), d = K(!1);
|
|
6665
|
-
return ce(
|
|
6664
|
+
return ce(we(d), u), {
|
|
6666
6665
|
components: t,
|
|
6667
6666
|
computeItemKey: s,
|
|
6668
6667
|
context: n,
|
|
@@ -10391,13 +10390,13 @@ const Ub = $.memo(function({
|
|
|
10391
10390
|
const P = pt(() => z.length <= $n ? z : `${z.slice(0, $n)}
|
|
10392
10391
|
… [truncated ${z.length - $n} chars]`, [z]), V = $.useCallback(async (Z = "all") => {
|
|
10393
10392
|
const pe = Z === "visible" && k ? P : k ? z : de;
|
|
10394
|
-
async function Se(
|
|
10393
|
+
async function Se(ve) {
|
|
10395
10394
|
try {
|
|
10396
|
-
await navigator.clipboard.writeText(
|
|
10395
|
+
await navigator.clipboard.writeText(ve);
|
|
10397
10396
|
} catch {
|
|
10398
10397
|
try {
|
|
10399
10398
|
const Ie = document.createElement("textarea");
|
|
10400
|
-
Ie.value =
|
|
10399
|
+
Ie.value = ve, Ie.setAttribute("readonly", ""), Ie.style.position = "absolute", Ie.style.left = "-9999px", document.body.appendChild(Ie), Ie.select(), document.execCommand("copy"), document.body.removeChild(Ie);
|
|
10401
10400
|
} catch (Ie) {
|
|
10402
10401
|
throw console.error("Failed to copy:", Ie), Ie;
|
|
10403
10402
|
}
|
|
@@ -10405,8 +10404,8 @@ const Ub = $.memo(function({
|
|
|
10405
10404
|
}
|
|
10406
10405
|
try {
|
|
10407
10406
|
await Se(pe), y(!0), setTimeout(() => y(!1), 2e3), x == null || x(pe);
|
|
10408
|
-
} catch (
|
|
10409
|
-
console.error("Failed to copy:",
|
|
10407
|
+
} catch (ve) {
|
|
10408
|
+
console.error("Failed to copy:", ve);
|
|
10410
10409
|
}
|
|
10411
10410
|
}, [k, z, de, P, x]), X = $.useCallback(() => {
|
|
10412
10411
|
if (!w) return;
|
|
@@ -10424,10 +10423,10 @@ const Ub = $.memo(function({
|
|
|
10424
10423
|
return;
|
|
10425
10424
|
}
|
|
10426
10425
|
try {
|
|
10427
|
-
const Se = String(ae.url ?? ""),
|
|
10428
|
-
if (
|
|
10426
|
+
const Se = String(ae.url ?? ""), ve = Se.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
10427
|
+
if (ve) {
|
|
10429
10428
|
Z.preventDefault();
|
|
10430
|
-
const Ie =
|
|
10429
|
+
const Ie = ve[1], Xe = ae.name || `file_${Ie}`, Ue = ae.mimeType || "application/octet-stream";
|
|
10431
10430
|
H({ id: Ie, name: Xe, mimeType: Ue }), _(!0);
|
|
10432
10431
|
return;
|
|
10433
10432
|
}
|
|
@@ -10461,7 +10460,7 @@ const Ub = $.memo(function({
|
|
|
10461
10460
|
}
|
|
10462
10461
|
}
|
|
10463
10462
|
} catch (Se) {
|
|
10464
|
-
console.error("File click error:", Se), M((
|
|
10463
|
+
console.error("File click error:", Se), M((ve) => ({ ...ve, [pe]: !1 }));
|
|
10465
10464
|
}
|
|
10466
10465
|
}, [U, O, N, I]), Le = $.useCallback(() => {
|
|
10467
10466
|
const ae = J(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
|
|
@@ -10519,7 +10518,7 @@ const Ub = $.memo(function({
|
|
|
10519
10518
|
"border border-border/60 dark:border-border/40"
|
|
10520
10519
|
);
|
|
10521
10520
|
}
|
|
10522
|
-
}, [q, L]),
|
|
10521
|
+
}, [q, L]), be = $.useCallback(async (Z) => {
|
|
10523
10522
|
try {
|
|
10524
10523
|
const ae = Z.id || `interrupt-${Date.now()}`;
|
|
10525
10524
|
await j(ae, !0);
|
|
@@ -10535,8 +10534,8 @@ const Ub = $.memo(function({
|
|
|
10535
10534
|
}
|
|
10536
10535
|
}, [j]), Ye = $.useCallback(({ part: Z, i: ae }) => {
|
|
10537
10536
|
if (Z.type === "text") {
|
|
10538
|
-
const pe = Z.text ?? "", Se = pe.trim(),
|
|
10539
|
-
return
|
|
10537
|
+
const pe = Z.text ?? "", Se = pe.trim(), ve = oc(Se);
|
|
10538
|
+
return ve && L !== "tool" ? /* @__PURE__ */ c.jsx(Wb, { data: ve }, ae) : L === "user" && f && Se.length > h ? /* @__PURE__ */ c.jsxs(Ml, { open: C, onOpenChange: E, children: [
|
|
10540
10539
|
/* @__PURE__ */ c.jsx("div", { className: J("text-sm text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: C ? /* @__PURE__ */ c.jsx(Ul, { content: Se, allowHtml: !1 }) : /* @__PURE__ */ c.jsxs("pre", { className: J("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: [
|
|
10541
10540
|
Se.substring(0, h),
|
|
10542
10541
|
"..."
|
|
@@ -10578,7 +10577,7 @@ const Ub = $.memo(function({
|
|
|
10578
10577
|
"a",
|
|
10579
10578
|
{
|
|
10580
10579
|
href: pe.url,
|
|
10581
|
-
onClick: (
|
|
10580
|
+
onClick: (ve) => ne(ve, pe, ae),
|
|
10582
10581
|
className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
|
|
10583
10582
|
dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
|
|
10584
10583
|
children: [
|
|
@@ -10596,7 +10595,7 @@ const Ub = $.memo(function({
|
|
|
10596
10595
|
Kb,
|
|
10597
10596
|
{
|
|
10598
10597
|
interruptPart: Z,
|
|
10599
|
-
onApprove:
|
|
10598
|
+
onApprove: be,
|
|
10600
10599
|
onReject: je
|
|
10601
10600
|
},
|
|
10602
10601
|
ae
|
|
@@ -10604,7 +10603,7 @@ const Ub = $.memo(function({
|
|
|
10604
10603
|
}, [
|
|
10605
10604
|
ne,
|
|
10606
10605
|
O,
|
|
10607
|
-
|
|
10606
|
+
be,
|
|
10608
10607
|
je,
|
|
10609
10608
|
L,
|
|
10610
10609
|
f,
|
|
@@ -10624,15 +10623,15 @@ const Ub = $.memo(function({
|
|
|
10624
10623
|
return /* @__PURE__ */ c.jsx(qb, { data: pe });
|
|
10625
10624
|
}
|
|
10626
10625
|
if (k && oe.name === "get_issues") {
|
|
10627
|
-
const ae = t.content.find((
|
|
10626
|
+
const ae = t.content.find((ve) => ve.type === "tool_end"), pe = (ae == null ? void 0 : ae.output) ?? z, Se = jd(pe);
|
|
10628
10627
|
if (Se) return /* @__PURE__ */ c.jsx(Gb, { issues: Se });
|
|
10629
10628
|
}
|
|
10630
10629
|
if (k) {
|
|
10631
10630
|
const ae = Fb(t.content);
|
|
10632
10631
|
if (ae.length > 0)
|
|
10633
10632
|
return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((pe, Se) => {
|
|
10634
|
-
const
|
|
10635
|
-
… [truncated ${
|
|
10633
|
+
const ve = typeof pe.output == "string" ? pe.output : Ni(pe.output), Ie = ve.length > $n ? `${ve.slice(0, $n)}
|
|
10634
|
+
… [truncated ${ve.length - $n} chars]` : ve, Xe = R === "expanded";
|
|
10636
10635
|
return /* @__PURE__ */ c.jsxs(Ml, { open: Xe, onOpenChange: (Ue) => S(Ue ? "expanded" : "preview"), children: [
|
|
10637
10636
|
/* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Ei, { variant: "outline", children: (pe.name ?? "tool") + (pe.toolCallId ? ` • ${pe.toolCallId.slice(0, 8)}` : "") }) }),
|
|
10638
10637
|
/* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children: Xe ? Ie : Ie.slice(0, d) + (Ie.length > d ? "..." : "") }) }),
|
|
@@ -12575,9 +12574,9 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
|
|
|
12575
12574
|
l && s0({ ...D }),
|
|
12576
12575
|
i0({
|
|
12577
12576
|
...D,
|
|
12578
|
-
apply: ({ elements: Le, rects: Ge, availableWidth: et, availableHeight:
|
|
12577
|
+
apply: ({ elements: Le, rects: Ge, availableWidth: et, availableHeight: be }) => {
|
|
12579
12578
|
const { width: je, height: Ye } = Ge.reference, Fe = Le.floating.style;
|
|
12580
|
-
Fe.setProperty("--radix-popper-available-width", `${et}px`), Fe.setProperty("--radix-popper-available-height", `${
|
|
12579
|
+
Fe.setProperty("--radix-popper-available-width", `${et}px`), Fe.setProperty("--radix-popper-available-height", `${be}px`), Fe.setProperty("--radix-popper-anchor-width", `${je}px`), Fe.setProperty("--radix-popper-anchor-height", `${Ye}px`);
|
|
12581
12580
|
}
|
|
12582
12581
|
}),
|
|
12583
12582
|
R && l0({ element: R, padding: a }),
|
|
@@ -13771,8 +13770,8 @@ function ci({
|
|
|
13771
13770
|
streamingAssistantId: M,
|
|
13772
13771
|
lastCheckpointId: D,
|
|
13773
13772
|
lastCheckpointNs: _
|
|
13774
|
-
} = sx(), [W, H] = me(null), [q, L] = me(""), [k, U] = me(null), [Y, de] = me([]), [oe, fe] = me(0), [Re, ue] = me(0), [z, P] = me(!1), [V, X] = me(null), [se, ne] = me(null), [Le, Ge] = me(!1), [et,
|
|
13775
|
-
Se.current && (Se.current.value = ""),
|
|
13773
|
+
} = sx(), [W, H] = me(null), [q, L] = me(""), [k, U] = me(null), [Y, de] = me([]), [oe, fe] = me(0), [Re, ue] = me(0), [z, P] = me(!1), [V, X] = me(null), [se, ne] = me(null), [Le, Ge] = me(!1), [et, be] = me(null), [je, Ye] = me([]), [Fe, st] = me(null), [at, Z] = me(null), [ae, pe] = me(!1), Se = it(null), ve = it(null), Ie = it(null), Xe = ze(() => {
|
|
13774
|
+
Se.current && (Se.current.value = ""), ve.current && (ve.current.value = ""), fe((ee) => ee + 1), ue((ee) => ee + 1);
|
|
13776
13775
|
}, []), Ue = it(!1);
|
|
13777
13776
|
gt(() => {
|
|
13778
13777
|
Ue.current && !N && (de([]), Xe()), Ue.current = N;
|
|
@@ -13827,14 +13826,14 @@ function ci({
|
|
|
13827
13826
|
gt(() => {
|
|
13828
13827
|
(async () => {
|
|
13829
13828
|
if (!w.baseUrl) {
|
|
13830
|
-
|
|
13829
|
+
be(null);
|
|
13831
13830
|
return;
|
|
13832
13831
|
}
|
|
13833
13832
|
try {
|
|
13834
13833
|
const he = await w.getAgent("default");
|
|
13835
|
-
|
|
13834
|
+
be(he.uiDefaultMessage || null);
|
|
13836
13835
|
} catch (he) {
|
|
13837
|
-
console.warn("Failed to fetch default message:", he),
|
|
13836
|
+
console.warn("Failed to fetch default message:", he), be(null);
|
|
13838
13837
|
}
|
|
13839
13838
|
})();
|
|
13840
13839
|
}, [w]), gt(() => {
|
|
@@ -14063,7 +14062,7 @@ function ci({
|
|
|
14063
14062
|
/* @__PURE__ */ c.jsx(
|
|
14064
14063
|
"input",
|
|
14065
14064
|
{
|
|
14066
|
-
ref:
|
|
14065
|
+
ref: ve,
|
|
14067
14066
|
type: "file",
|
|
14068
14067
|
accept: ".xls,.xlsx,.xlsm",
|
|
14069
14068
|
onChange: Mn,
|
|
@@ -14107,7 +14106,7 @@ function ci({
|
|
|
14107
14106
|
{
|
|
14108
14107
|
onClick: () => {
|
|
14109
14108
|
var ee;
|
|
14110
|
-
z || (ee =
|
|
14109
|
+
z || (ee = ve.current) == null || ee.click();
|
|
14111
14110
|
},
|
|
14112
14111
|
className: `cursor-pointer ${z ? "opacity-60 pointer-events-none" : ""}`,
|
|
14113
14112
|
children: [
|
|
@@ -15477,20 +15476,20 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
|
|
|
15477
15476
|
if (s.trigger && s.valueNode && a && u && v && g && x) {
|
|
15478
15477
|
const E = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), j = s.valueNode.getBoundingClientRect(), N = x.getBoundingClientRect();
|
|
15479
15478
|
if (s.dir !== "rtl") {
|
|
15480
|
-
const se = N.left - I.left, ne = j.left - se, Le = E.left - ne, Ge = E.width + Le, et = Math.max(Ge, I.width),
|
|
15479
|
+
const se = N.left - I.left, ne = j.left - se, Le = E.left - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(ne, [
|
|
15481
15480
|
Gt,
|
|
15482
15481
|
// Prevents the content from going off the starting edge of the
|
|
15483
15482
|
// viewport. It may still go off the ending edge, but this can be
|
|
15484
15483
|
// controlled by the user since they may want to manage overflow in a
|
|
15485
15484
|
// specific way.
|
|
15486
15485
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
15487
|
-
Math.max(Gt,
|
|
15486
|
+
Math.max(Gt, be - et)
|
|
15488
15487
|
]);
|
|
15489
15488
|
a.style.minWidth = Ge + "px", a.style.left = je + "px";
|
|
15490
15489
|
} else {
|
|
15491
|
-
const se = I.right - N.right, ne = window.innerWidth - j.right - se, Le = window.innerWidth - E.right - ne, Ge = E.width + Le, et = Math.max(Ge, I.width),
|
|
15490
|
+
const se = I.right - N.right, ne = window.innerWidth - j.right - se, Le = window.innerWidth - E.right - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(ne, [
|
|
15492
15491
|
Gt,
|
|
15493
|
-
Math.max(Gt,
|
|
15492
|
+
Math.max(Gt, be - et)
|
|
15494
15493
|
]);
|
|
15495
15494
|
a.style.minWidth = Ge + "px", a.style.right = je + "px";
|
|
15496
15495
|
}
|