@teodorruskvi/chat-core 0.1.19 → 0.1.22
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 +99 -101
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,8 +3,8 @@ var Rn = (e, t, n) => t in e ? Pn(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var Ft = (e, t, n) => Rn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as ke } from "react/jsx-runtime";
|
|
5
5
|
import * as jt from "react";
|
|
6
|
-
import { createContext as We, useContext as ot, useState as D, useRef as V, useEffect as ne, useCallback as P, useMemo as ue, useReducer as
|
|
7
|
-
import
|
|
6
|
+
import { createContext as We, useContext as ot, useState as D, useRef as V, useEffect as ne, useCallback as P, useMemo as ue, useReducer as Nn } from "react";
|
|
7
|
+
import _n, { isCancel as Ot } from "axios";
|
|
8
8
|
function Zt(e) {
|
|
9
9
|
var t, n, r = "";
|
|
10
10
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
@@ -197,8 +197,8 @@ const Rt = "-", Un = (e) => {
|
|
|
197
197
|
s.push(x);
|
|
198
198
|
const M = o(g, w);
|
|
199
199
|
for (let R = 0; R < M.length; ++R) {
|
|
200
|
-
const
|
|
201
|
-
s.push(I +
|
|
200
|
+
const N = M[R];
|
|
201
|
+
s.push(I + N);
|
|
202
202
|
}
|
|
203
203
|
i = l + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
@@ -247,7 +247,7 @@ const Q = (e) => {
|
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
248
|
Qn.test(e) && !Yn.test(e)
|
|
249
249
|
), on = () => !1, lr = (e) => Zn.test(e), ur = (e) => er.test(e), dr = () => {
|
|
250
|
-
const e = Q("colors"), t = Q("spacing"), n = Q("blur"), r = Q("brightness"), o = Q("borderColor"), s = Q("borderRadius"), a = Q("borderSpacing"), i = Q("borderWidth"), f = Q("contrast"), l = Q("grayscale"), c = Q("hueRotate"), d = Q("invert"), m = Q("gap"), y = Q("gradientColorStops"), w = Q("gradientColorStopPositions"), g = Q("inset"), b = Q("margin"), I = Q("opacity"), x = Q("padding"), M = Q("saturate"), R = Q("scale"),
|
|
250
|
+
const e = Q("colors"), t = Q("spacing"), n = Q("blur"), r = Q("brightness"), o = Q("borderColor"), s = Q("borderRadius"), a = Q("borderSpacing"), i = Q("borderWidth"), f = Q("contrast"), l = Q("grayscale"), c = Q("hueRotate"), d = Q("invert"), m = Q("gap"), y = Q("gradientColorStops"), w = Q("gradientColorStopPositions"), g = Q("inset"), b = Q("margin"), I = Q("opacity"), x = Q("padding"), M = Q("saturate"), R = Q("scale"), N = Q("sepia"), v = Q("skew"), k = Q("space"), L = Q("translate"), F = () => ["auto", "contain", "none"], j = () => ["auto", "hidden", "clip", "visible", "scroll"], O = () => ["auto", z, t], E = () => [z, t], W = () => ["", Pe, Ue], K = () => ["auto", Ge, z], q = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], Y = () => ["solid", "dashed", "dotted", "double", "none"], Z = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], T = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], U = () => ["", "0", z], H = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], $ = () => [Ge, z];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
@@ -1720,7 +1720,7 @@ const Q = (e) => {
|
|
|
1720
1720
|
* @see https://tailwindcss.com/docs/sepia
|
|
1721
1721
|
*/
|
|
1722
1722
|
sepia: [{
|
|
1723
|
-
sepia: [
|
|
1723
|
+
sepia: [N]
|
|
1724
1724
|
}],
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Backdrop Filter
|
|
@@ -1791,7 +1791,7 @@ const Q = (e) => {
|
|
|
1791
1791
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
1792
1792
|
*/
|
|
1793
1793
|
"backdrop-sepia": [{
|
|
1794
|
-
"backdrop-sepia": [
|
|
1794
|
+
"backdrop-sepia": [N]
|
|
1795
1795
|
}],
|
|
1796
1796
|
// Tables
|
|
1797
1797
|
/**
|
|
@@ -2294,7 +2294,7 @@ function pr(e) {
|
|
|
2294
2294
|
}
|
|
2295
2295
|
return n.replace(/\bTrue\b/g, "true").replace(/\bFalse\b/g, "false").replace(/\bNone\b/g, "null");
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function Nt(e) {
|
|
2298
2298
|
const t = e == null ? void 0 : e.trim();
|
|
2299
2299
|
if (!t || !(t.startsWith("{") || t.startsWith("["))) return null;
|
|
2300
2300
|
try {
|
|
@@ -2421,7 +2421,7 @@ function Se(e) {
|
|
|
2421
2421
|
if (typeof e == "string") {
|
|
2422
2422
|
const t = e.trim();
|
|
2423
2423
|
if (t.startsWith("{") || t.startsWith("[")) {
|
|
2424
|
-
const n =
|
|
2424
|
+
const n = Nt(t);
|
|
2425
2425
|
if (n !== null)
|
|
2426
2426
|
return Se(n);
|
|
2427
2427
|
}
|
|
@@ -2448,12 +2448,12 @@ function Ce(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function ht(e) {
|
|
2451
|
-
var b, I, x, M, R,
|
|
2451
|
+
var b, I, x, M, R, N;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = Ce(e), n = xr(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(
|
|
2456
|
+
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(_t) : void 0, o = Tr(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((b = t.additionalKwargs) == null ? void 0 : b.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((I = t.additionalKwargs) == null ? void 0 : I.agentName) ?? void 0, f = t.model ?? ((x = t.additionalKwargs) == null ? void 0 : x.model) ?? void 0, l = t.toolCallId ?? void 0, c = t.additionalKwargs ?? void 0, d = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((M = t.additionalKwargs) == null ? void 0 : M.checkpointId) ?? void 0, y = t.checkpointNs ?? ((R = t.additionalKwargs) == null ? void 0 : R.checkpointNs) ?? void 0, w = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((N = t.additionalKwargs) != null && N.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: s,
|
|
@@ -2481,7 +2481,7 @@ function Ar(e) {
|
|
|
2481
2481
|
}
|
|
2482
2482
|
return t;
|
|
2483
2483
|
}
|
|
2484
|
-
function
|
|
2484
|
+
function _t(e) {
|
|
2485
2485
|
const t = Ce(e), n = t.content ?? t.output ?? void 0;
|
|
2486
2486
|
return {
|
|
2487
2487
|
...t,
|
|
@@ -2493,7 +2493,7 @@ function Nt(e) {
|
|
|
2493
2493
|
};
|
|
2494
2494
|
}
|
|
2495
2495
|
function Tr(e, t) {
|
|
2496
|
-
return Array.isArray(e) ? e.map((n) => n.type === "tool_call" || n.type === "tool" ? t ? null :
|
|
2496
|
+
return Array.isArray(e) ? e.map((n) => n.type === "tool_call" || n.type === "tool" ? t ? null : _t(Ce(n)) : n).filter(
|
|
2497
2497
|
(n) => !!(n && typeof n == "object" && typeof n.type == "string")
|
|
2498
2498
|
) : [];
|
|
2499
2499
|
}
|
|
@@ -2510,7 +2510,7 @@ function Dt(e) {
|
|
|
2510
2510
|
return t === "running" || t === "pending" ? "pending" : t === "completed" || t === "success" ? "completed" : t === "error" || t === "failed" || t === "failure" ? "error" : null;
|
|
2511
2511
|
}
|
|
2512
2512
|
function Vt(e) {
|
|
2513
|
-
return (Array.isArray(e.toolCalls) ? e.toolCalls : sn(e)).map(
|
|
2513
|
+
return (Array.isArray(e.toolCalls) ? e.toolCalls : sn(e)).map(_t);
|
|
2514
2514
|
}
|
|
2515
2515
|
function Tt(e, t) {
|
|
2516
2516
|
return t.find(
|
|
@@ -2596,7 +2596,7 @@ function Ve(e) {
|
|
|
2596
2596
|
function un(e) {
|
|
2597
2597
|
return Pt.add(e), () => Pt.delete(e);
|
|
2598
2598
|
}
|
|
2599
|
-
const Mr = 3e4, Er = 9e4, me =
|
|
2599
|
+
const Mr = 3e4, Er = 9e4, me = _n.create({
|
|
2600
2600
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2601
2601
|
timeout: Mr,
|
|
2602
2602
|
withCredentials: !0
|
|
@@ -2710,7 +2710,6 @@ class Rr {
|
|
|
2710
2710
|
async getState(t) {
|
|
2711
2711
|
const n = await he(`/threads/${t.threadId}/state`, {
|
|
2712
2712
|
params: {
|
|
2713
|
-
thread_id: t.threadId,
|
|
2714
2713
|
checkpoint_id: t.checkpointId,
|
|
2715
2714
|
checkpoint_ns: t.checkpointNs
|
|
2716
2715
|
}
|
|
@@ -2720,7 +2719,6 @@ class Rr {
|
|
|
2720
2719
|
async getStateHistory(t) {
|
|
2721
2720
|
const n = await he(`/threads/${t.threadId}/state`, {
|
|
2722
2721
|
params: {
|
|
2723
|
-
thread_id: t.threadId,
|
|
2724
2722
|
checkpoint_id: t.checkpointId,
|
|
2725
2723
|
checkpoint_ns: t.checkpointNs
|
|
2726
2724
|
},
|
|
@@ -2744,7 +2742,7 @@ class Rr {
|
|
|
2744
2742
|
}
|
|
2745
2743
|
}
|
|
2746
2744
|
const dn = new Rr();
|
|
2747
|
-
class
|
|
2745
|
+
class Nr {
|
|
2748
2746
|
// Config logic could go here if files ever need a distinct base URL from chat
|
|
2749
2747
|
// For now, it shares the chatBaseUrl via the shared httpClient
|
|
2750
2748
|
async fetchFileBlob(t, n) {
|
|
@@ -2806,8 +2804,8 @@ class _r {
|
|
|
2806
2804
|
});
|
|
2807
2805
|
}
|
|
2808
2806
|
}
|
|
2809
|
-
const fn = new
|
|
2810
|
-
class
|
|
2807
|
+
const fn = new Nr();
|
|
2808
|
+
class _r {
|
|
2811
2809
|
constructor() {
|
|
2812
2810
|
// ---- Configuration ----
|
|
2813
2811
|
Ft(this, "_authBaseUrl", "");
|
|
@@ -2840,7 +2838,7 @@ class Nr {
|
|
|
2840
2838
|
return (t == null ? void 0 : t.users) ?? [];
|
|
2841
2839
|
}
|
|
2842
2840
|
}
|
|
2843
|
-
const Lr = new
|
|
2841
|
+
const Lr = new _r(), pn = We(null);
|
|
2844
2842
|
function Ur({ children: e, apiConfig: t }) {
|
|
2845
2843
|
const n = dn, r = Lr;
|
|
2846
2844
|
if (t) {
|
|
@@ -3032,9 +3030,9 @@ function Ze(e) {
|
|
|
3032
3030
|
};
|
|
3033
3031
|
}
|
|
3034
3032
|
function Dr(e, t) {
|
|
3035
|
-
var
|
|
3033
|
+
var N, v;
|
|
3036
3034
|
if (!e) return null;
|
|
3037
|
-
const n = ((
|
|
3035
|
+
const n = ((N = e.values) == null ? void 0 : N.activeAgent) ?? null, r = (v = e.values) == null ? void 0 : v.messages, s = (Array.isArray(r) ? r : []).map((k) => Vr(k, n)).filter((k) => !!k), a = tt(e.metadata) ?? {}, i = Gt(e.config), f = tt(e.parentConfig), l = Gt(f), c = lt(i, ["checkpointId"]), d = lt(i, ["checkpointNs"]), m = lt(l, ["checkpointId"]), y = tt(e.config), w = Array.isArray(e.tasks) ? e.tasks.map((k) => ({ ...k })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, b = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), I = {
|
|
3038
3036
|
...a,
|
|
3039
3037
|
step: Br(a, ["step"]) ?? 0,
|
|
3040
3038
|
source: lt(a, ["source"]) ?? null
|
|
@@ -3096,7 +3094,7 @@ function Hr(e = {}) {
|
|
|
3096
3094
|
i.current = e;
|
|
3097
3095
|
}, [e]);
|
|
3098
3096
|
const f = P((p) => {
|
|
3099
|
-
var S,
|
|
3097
|
+
var S, _, G, J, B, ae, re, de, X, se;
|
|
3100
3098
|
const h = i.current;
|
|
3101
3099
|
if (!h) return;
|
|
3102
3100
|
if (p.type === "thread_info") {
|
|
@@ -3104,7 +3102,7 @@ function Hr(e = {}) {
|
|
|
3104
3102
|
return;
|
|
3105
3103
|
}
|
|
3106
3104
|
if (p.type === "values" && Array.isArray(p.checkpoints)) {
|
|
3107
|
-
(
|
|
3105
|
+
(_ = h.handleValuesEvent) == null || _.call(h, p);
|
|
3108
3106
|
return;
|
|
3109
3107
|
}
|
|
3110
3108
|
if (p.type === "metadata") {
|
|
@@ -3116,7 +3114,7 @@ function Hr(e = {}) {
|
|
|
3116
3114
|
return;
|
|
3117
3115
|
}
|
|
3118
3116
|
(B = h.onEvent) == null || B.call(h, p), p.type === "updates" && ((ae = h.onUpdateEvent) == null || ae.call(h, p)), p.type === "tool.end" ? (re = h.onToolEnd) == null || re.call(h, p) : p.type === "tool.start" && ((de = h.onToolStart) == null || de.call(h, p)), p.type === "heartbeat" && ((X = h.onHeartbeat) == null || X.call(h, p)), p.type === "token" && ((se = h.onToken) == null || se.call(h, p.token));
|
|
3119
|
-
}, []), [l, c] = D(!1), [d, m] = D(null), [y, w] = D(""), [g, b] = D(null), [I, x] = D(0), [M, R] = D(!1), [
|
|
3117
|
+
}, []), [l, c] = D(!1), [d, m] = D(null), [y, w] = D(""), [g, b] = D(null), [I, x] = D(0), [M, R] = D(!1), [N, v] = D({}), [k, L] = D(null), [F, j] = D({}), O = V(null), E = V(!0), W = V(0), K = V(null), q = V(null), Y = V(null), Z = V(null), T = V({
|
|
3120
3118
|
messageId: null,
|
|
3121
3119
|
lastSeq: null,
|
|
3122
3120
|
lastText: ""
|
|
@@ -3132,11 +3130,11 @@ function Hr(e = {}) {
|
|
|
3132
3130
|
var S;
|
|
3133
3131
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3134
3132
|
const p = (S = K.current) == null ? void 0 : S.threadId, h = () => {
|
|
3135
|
-
var
|
|
3136
|
-
(
|
|
3133
|
+
var _;
|
|
3134
|
+
(_ = O.current) == null || _.abort(), O.current = null, K.current = null, c(!1), R(!1), W.current = 0, x(0);
|
|
3137
3135
|
};
|
|
3138
|
-
(p ? dn.cancelRun(p).catch((
|
|
3139
|
-
console.warn("[use-chat] cancel run failed:",
|
|
3136
|
+
(p ? dn.cancelRun(p).catch((_) => {
|
|
3137
|
+
console.warn("[use-chat] cancel run failed:", _);
|
|
3140
3138
|
}) : Promise.resolve()).finally(h);
|
|
3141
3139
|
}, []), u = P(
|
|
3142
3140
|
(p) => {
|
|
@@ -3159,13 +3157,13 @@ function Hr(e = {}) {
|
|
|
3159
3157
|
};
|
|
3160
3158
|
const A = new AbortController();
|
|
3161
3159
|
O.current = A;
|
|
3162
|
-
let S = null,
|
|
3160
|
+
let S = null, _ = !1;
|
|
3163
3161
|
return K.current = {
|
|
3164
3162
|
threadId: h.threadId ?? null,
|
|
3165
3163
|
headers: {},
|
|
3166
3164
|
isStreaming: !0
|
|
3167
3165
|
}, (async () => {
|
|
3168
|
-
var G, J, B, ae, re, de, X, se,
|
|
3166
|
+
var G, J, B, ae, re, de, X, se, _e, Le, ce, Ae;
|
|
3169
3167
|
try {
|
|
3170
3168
|
let ye = {};
|
|
3171
3169
|
try {
|
|
@@ -3407,7 +3405,7 @@ function Hr(e = {}) {
|
|
|
3407
3405
|
b(ie.checkpointId ?? null);
|
|
3408
3406
|
else if (ve === "error") {
|
|
3409
3407
|
const C = ie;
|
|
3410
|
-
if (m(C.message), S = "error", C.error_type === "auth_error" || C.code === "TOKEN_EXPIRED" || ((de = C.message) == null ? void 0 : de.includes("token")) || ((X = C.message) == null ? void 0 : X.includes("401")) || ((se = C.message) == null ? void 0 : se.includes("unauthorized")) || ((
|
|
3408
|
+
if (m(C.message), S = "error", C.error_type === "auth_error" || C.code === "TOKEN_EXPIRED" || ((de = C.message) == null ? void 0 : de.includes("token")) || ((X = C.message) == null ? void 0 : X.includes("401")) || ((se = C.message) == null ? void 0 : se.includes("unauthorized")) || ((_e = C.message) == null ? void 0 : _e.includes("Unauthorized"))) {
|
|
3411
3409
|
console.error("[use-chat] Auth error detected:", C.message);
|
|
3412
3410
|
try {
|
|
3413
3411
|
(Le = e.onAuthError) == null || Le.call(e, C.message);
|
|
@@ -3442,7 +3440,7 @@ function Hr(e = {}) {
|
|
|
3442
3440
|
S = S ?? "aborted";
|
|
3443
3441
|
else {
|
|
3444
3442
|
const be = ye.message || String(ye);
|
|
3445
|
-
S = "error", m(be),
|
|
3443
|
+
S = "error", m(be), _ || (_ = !0, (Ae = e.onConnectionError) == null || Ae.call(e, be));
|
|
3446
3444
|
}
|
|
3447
3445
|
} finally {
|
|
3448
3446
|
const ye = W.current, be = q.current, Fe = Y.current, Je = Z.current;
|
|
@@ -3473,7 +3471,7 @@ function Hr(e = {}) {
|
|
|
3473
3471
|
error: d,
|
|
3474
3472
|
assistantText: y,
|
|
3475
3473
|
activeMessageId: k,
|
|
3476
|
-
streamedMessages:
|
|
3474
|
+
streamedMessages: N,
|
|
3477
3475
|
lastCheckpointId: g,
|
|
3478
3476
|
lastSeq: I,
|
|
3479
3477
|
connected: M,
|
|
@@ -3541,7 +3539,7 @@ function Jr({
|
|
|
3541
3539
|
onThreadChange: r,
|
|
3542
3540
|
onCurrentThreadDeleted: o
|
|
3543
3541
|
}) {
|
|
3544
|
-
const [s, a] = D([]), [i, f] = D(t), [l, c] = D(!1), [d, m] = D(null), [y, w] = D([]), [g, b] = D(!1), [, I] = D(null), [x, M] = D(null), [R,
|
|
3542
|
+
const [s, a] = D([]), [i, f] = D(t), [l, c] = D(!1), [d, m] = D(null), [y, w] = D([]), [g, b] = D(!1), [, I] = D(null), [x, M] = D(null), [R, N] = D(!1), v = V(i), k = V(/* @__PURE__ */ new Map());
|
|
3545
3543
|
ne(() => {
|
|
3546
3544
|
v.current = i;
|
|
3547
3545
|
}, [i]), ne(() => {
|
|
@@ -3616,14 +3614,14 @@ function Jr({
|
|
|
3616
3614
|
[e, n, L]
|
|
3617
3615
|
), W = P(
|
|
3618
3616
|
async (T, U) => {
|
|
3619
|
-
|
|
3617
|
+
N(!0), M("Sharing thread…");
|
|
3620
3618
|
try {
|
|
3621
3619
|
await e.shareThread(T, U), await F(), M("Shared successfully");
|
|
3622
3620
|
} catch (H) {
|
|
3623
3621
|
const $ = qr(H);
|
|
3624
3622
|
throw n == null || n($), M(`Failed to share: ${$}`), new Error($);
|
|
3625
3623
|
} finally {
|
|
3626
|
-
|
|
3624
|
+
N(!1);
|
|
3627
3625
|
}
|
|
3628
3626
|
},
|
|
3629
3627
|
[e, n, F]
|
|
@@ -3878,7 +3876,7 @@ function no(e, t) {
|
|
|
3878
3876
|
}
|
|
3879
3877
|
}
|
|
3880
3878
|
function ro(e = []) {
|
|
3881
|
-
const [t, n] =
|
|
3879
|
+
const [t, n] = Nn(no, { ...to, messages: e }), r = V([]), o = V(null), s = V(null), a = P(() => {
|
|
3882
3880
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
|
|
3883
3881
|
const c = r.current;
|
|
3884
3882
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
@@ -4117,7 +4115,7 @@ function po(e) {
|
|
|
4117
4115
|
const x = Array.isArray(c.messages) ? c.messages : [];
|
|
4118
4116
|
for (const v of x)
|
|
4119
4117
|
v.role === "user" && (I || (I = v), v.id && (b = v.id));
|
|
4120
|
-
const M = c.next && c.next.length > 0 ? String(c.next[0]) : null, R = c.parentConfig ?? null,
|
|
4118
|
+
const M = c.next && c.next.length > 0 ? String(c.next[0]) : null, R = c.parentConfig ?? null, N = {
|
|
4121
4119
|
id: m,
|
|
4122
4120
|
step: w,
|
|
4123
4121
|
source: g,
|
|
@@ -4128,7 +4126,7 @@ function po(e) {
|
|
|
4128
4126
|
parentConfig: R,
|
|
4129
4127
|
userMessageId: b
|
|
4130
4128
|
};
|
|
4131
|
-
if (o.push(
|
|
4129
|
+
if (o.push(N), d && t.set(d, N), d && I) {
|
|
4132
4130
|
const v = fo(I);
|
|
4133
4131
|
v && r.set(d, v);
|
|
4134
4132
|
}
|
|
@@ -4225,16 +4223,16 @@ function bn({
|
|
|
4225
4223
|
const [d, m] = D(null), w = ue(
|
|
4226
4224
|
() => Ze(d),
|
|
4227
4225
|
[d]
|
|
4228
|
-
).checkpoints, g = go(w), b = g.timeline, [I, x] = D(!1), [M, R] = D(!1), [
|
|
4226
|
+
).checkpoints, g = go(w), b = g.timeline, [I, x] = D(!1), [M, R] = D(!1), [N, v] = D(null), k = V(o), L = V(null), F = V(null), j = V(null), O = V(null), E = V(null), W = V(/* @__PURE__ */ new Map()), K = V(null);
|
|
4229
4227
|
ne(() => {
|
|
4230
4228
|
k.current = o;
|
|
4231
4229
|
}, [o]);
|
|
4232
4230
|
const q = P(
|
|
4233
4231
|
async (A) => {
|
|
4234
|
-
var
|
|
4232
|
+
var _, G;
|
|
4235
4233
|
if (!A.threadId) return;
|
|
4236
4234
|
const S = A.threadId;
|
|
4237
|
-
(
|
|
4235
|
+
(_ = A.onStart) == null || _.call(A), A.setLoading(!0);
|
|
4238
4236
|
try {
|
|
4239
4237
|
await A.action(S);
|
|
4240
4238
|
} catch (J) {
|
|
@@ -4252,7 +4250,7 @@ function bn({
|
|
|
4252
4250
|
async (A, S) => {
|
|
4253
4251
|
var ae;
|
|
4254
4252
|
if (!A) return;
|
|
4255
|
-
const
|
|
4253
|
+
const _ = `${A}:${S ?? "latest"}`, G = W.current.get(_);
|
|
4256
4254
|
if (G)
|
|
4257
4255
|
return G;
|
|
4258
4256
|
(ae = K.current) == null || ae.abort();
|
|
@@ -4274,7 +4272,7 @@ function bn({
|
|
|
4274
4272
|
);
|
|
4275
4273
|
return;
|
|
4276
4274
|
}
|
|
4277
|
-
const { checkpoints:
|
|
4275
|
+
const { checkpoints: _e, latest: Le } = Ze(se), ce = S ? _e.find((Ae) => Ae.checkpointId === S) ?? Le : Le;
|
|
4278
4276
|
n((ce == null ? void 0 : ce.messages) ?? [], {
|
|
4279
4277
|
checkpointId: (ce == null ? void 0 : ce.checkpointId) ?? null,
|
|
4280
4278
|
checkpointNs: (ce == null ? void 0 : ce.checkpointNs) ?? null,
|
|
@@ -4282,13 +4280,13 @@ function bn({
|
|
|
4282
4280
|
}), m(se);
|
|
4283
4281
|
}
|
|
4284
4282
|
});
|
|
4285
|
-
W.current.set(
|
|
4283
|
+
W.current.set(_, B);
|
|
4286
4284
|
try {
|
|
4287
4285
|
await B;
|
|
4288
4286
|
} finally {
|
|
4289
|
-
W.current.delete(
|
|
4287
|
+
W.current.delete(_), K.current === J && (K.current = null);
|
|
4290
4288
|
}
|
|
4291
|
-
return k.current === A && (E.current =
|
|
4289
|
+
return k.current === A && (E.current = _), B;
|
|
4292
4290
|
},
|
|
4293
4291
|
[e, n, q, t]
|
|
4294
4292
|
), Z = P(
|
|
@@ -4296,9 +4294,9 @@ function bn({
|
|
|
4296
4294
|
O.current = A;
|
|
4297
4295
|
try {
|
|
4298
4296
|
await Y(A, S);
|
|
4299
|
-
} catch (
|
|
4300
|
-
if (!Ot(
|
|
4301
|
-
throw
|
|
4297
|
+
} catch (_) {
|
|
4298
|
+
if (!Ot(_))
|
|
4299
|
+
throw _;
|
|
4302
4300
|
} finally {
|
|
4303
4301
|
O.current === A && (O.current = null);
|
|
4304
4302
|
}
|
|
@@ -4313,7 +4311,7 @@ function bn({
|
|
|
4313
4311
|
const S = A.threadId ?? k.current;
|
|
4314
4312
|
if (!S || k.current && k.current !== S && j.current !== S)
|
|
4315
4313
|
return;
|
|
4316
|
-
const
|
|
4314
|
+
const _ = t ? await St(A, t) : A, { checkpoints: G, latest: J } = Ze(_);
|
|
4317
4315
|
if (!G.length)
|
|
4318
4316
|
return;
|
|
4319
4317
|
const B = J;
|
|
@@ -4322,14 +4320,14 @@ function bn({
|
|
|
4322
4320
|
checkpointNs: (B == null ? void 0 : B.checkpointNs) ?? null,
|
|
4323
4321
|
pendingInterrupt: (B == null ? void 0 : B.interrupt) ?? null,
|
|
4324
4322
|
values: B == null ? void 0 : B.values
|
|
4325
|
-
}), m(
|
|
4323
|
+
}), m(_), E.current = `${S}:latest`, F.current = null, j.current === S && (j.current = null);
|
|
4326
4324
|
},
|
|
4327
4325
|
[n, l, t]
|
|
4328
4326
|
), $ = P(
|
|
4329
4327
|
async (A, S) => {
|
|
4330
|
-
const
|
|
4328
|
+
const _ = k.current;
|
|
4331
4329
|
await q({
|
|
4332
|
-
threadId:
|
|
4330
|
+
threadId: _,
|
|
4333
4331
|
setLoading: R,
|
|
4334
4332
|
action: async (G) => {
|
|
4335
4333
|
const J = await e.getState({
|
|
@@ -4406,7 +4404,7 @@ function bn({
|
|
|
4406
4404
|
checkpointIndex: g,
|
|
4407
4405
|
isLoadingThread: I,
|
|
4408
4406
|
isLoadingCheckpoint: M,
|
|
4409
|
-
threadStateError:
|
|
4407
|
+
threadStateError: N,
|
|
4410
4408
|
loadThread: Z,
|
|
4411
4409
|
navigateToCheckpoint: $,
|
|
4412
4410
|
setCurrentCheckpointId: u,
|
|
@@ -4447,7 +4445,7 @@ function ho({
|
|
|
4447
4445
|
isLoadingCheckpoint: x,
|
|
4448
4446
|
threadStateError: M,
|
|
4449
4447
|
loadThread: R,
|
|
4450
|
-
navigateToCheckpoint:
|
|
4448
|
+
navigateToCheckpoint: N,
|
|
4451
4449
|
setCurrentCheckpointId: v,
|
|
4452
4450
|
returnToLatest: k,
|
|
4453
4451
|
handleValuesEvent: L,
|
|
@@ -4523,7 +4521,7 @@ function ho({
|
|
|
4523
4521
|
});
|
|
4524
4522
|
},
|
|
4525
4523
|
clearState: T,
|
|
4526
|
-
navigateToCheckpoint:
|
|
4524
|
+
navigateToCheckpoint: N,
|
|
4527
4525
|
setCurrentCheckpointId: v,
|
|
4528
4526
|
returnToLatest: k,
|
|
4529
4527
|
loadThread: async (u, p, h) => {
|
|
@@ -4558,7 +4556,7 @@ function ho({
|
|
|
4558
4556
|
M,
|
|
4559
4557
|
d,
|
|
4560
4558
|
T,
|
|
4561
|
-
|
|
4559
|
+
N,
|
|
4562
4560
|
v,
|
|
4563
4561
|
k,
|
|
4564
4562
|
R,
|
|
@@ -4591,7 +4589,7 @@ function bo({
|
|
|
4591
4589
|
onFinish: f,
|
|
4592
4590
|
onStreamingChange: l
|
|
4593
4591
|
}) {
|
|
4594
|
-
const { chatApi: c, baseUrl: d } = He(), m = d, y = Re(t), w = Re(n), g = Re(r), b = Re(o), I = Re(s), x = Re(a), M = Re(i), R = Re(f),
|
|
4592
|
+
const { chatApi: c, baseUrl: d } = He(), m = d, y = Re(t), w = Re(n), g = Re(r), b = Re(o), I = Re(s), x = Re(a), M = Re(i), R = Re(f), N = Re(l), v = ue(
|
|
4595
4593
|
() => ({
|
|
4596
4594
|
onError: y,
|
|
4597
4595
|
onAuthError: w,
|
|
@@ -4619,7 +4617,7 @@ function bo({
|
|
|
4619
4617
|
api: c,
|
|
4620
4618
|
streamBaseUrl: m,
|
|
4621
4619
|
handlers: v,
|
|
4622
|
-
onStreamingChange:
|
|
4620
|
+
onStreamingChange: N,
|
|
4623
4621
|
children: e
|
|
4624
4622
|
}
|
|
4625
4623
|
) });
|
|
@@ -4642,7 +4640,7 @@ function wo({
|
|
|
4642
4640
|
pushUser: b,
|
|
4643
4641
|
onEvent: I,
|
|
4644
4642
|
messages: x
|
|
4645
|
-
} = In(), { registerClearThread: M, registerRespondToInterrupt: R } = mo(),
|
|
4643
|
+
} = In(), { registerClearThread: M, registerRespondToInterrupt: R } = mo(), N = P(
|
|
4646
4644
|
(u) => {
|
|
4647
4645
|
i(u), w(u.threadId), a.current !== u.threadId && ((u.created ?? !a.current) && y(u.threadId), s(u.threadId));
|
|
4648
4646
|
},
|
|
@@ -4657,7 +4655,7 @@ function wo({
|
|
|
4657
4655
|
onAuthError: r.onAuthError,
|
|
4658
4656
|
onConnectionError: r.onConnectionError,
|
|
4659
4657
|
onFinish: r.onFinish,
|
|
4660
|
-
onThreadInfo:
|
|
4658
|
+
onThreadInfo: N,
|
|
4661
4659
|
onMetadataEvent: r.onMetadataEvent,
|
|
4662
4660
|
onCustomEvent: r.onCustomEvent,
|
|
4663
4661
|
onUpdateEvent: r.onUpdateEvent,
|
|
@@ -4685,10 +4683,10 @@ function wo({
|
|
|
4685
4683
|
const A = a.current;
|
|
4686
4684
|
if (!A)
|
|
4687
4685
|
throw new Error("No active thread to handle interrupt");
|
|
4688
|
-
const S = u ? p ?? !0 : !1,
|
|
4686
|
+
const S = u ? p ?? !0 : !1, _ = Y.current, G = {
|
|
4689
4687
|
threadId: A,
|
|
4690
|
-
checkpointId:
|
|
4691
|
-
checkpointNs:
|
|
4688
|
+
checkpointId: _.id ?? void 0,
|
|
4689
|
+
checkpointNs: _.namespace ?? void 0,
|
|
4692
4690
|
command: { kind: "resume", value: S },
|
|
4693
4691
|
payload: h == null ? void 0 : h.payload
|
|
4694
4692
|
};
|
|
@@ -4709,10 +4707,10 @@ function wo({
|
|
|
4709
4707
|
async (u, p) => {
|
|
4710
4708
|
j && L();
|
|
4711
4709
|
let h = a.current;
|
|
4712
|
-
const A = (u == null ? void 0 : u.text) ?? "", S = (u == null ? void 0 : u.attachments) ?? [],
|
|
4710
|
+
const A = (u == null ? void 0 : u.text) ?? "", S = (u == null ? void 0 : u.attachments) ?? [], _ = (A == null ? void 0 : A.trim()) ?? "", G = { ...(u == null ? void 0 : u.payload) ?? {} }, J = Array.isArray(G.messages) ? G.messages : void 0;
|
|
4713
4711
|
J && delete G.messages;
|
|
4714
4712
|
const B = !!(J && J.length), ae = !!(u.contentParts && u.contentParts.length > 0);
|
|
4715
|
-
if (!h && !
|
|
4713
|
+
if (!h && !_ && S.length === 0 && !B && !ae) return;
|
|
4716
4714
|
if (!h) {
|
|
4717
4715
|
const fe = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), je = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4718
4716
|
h = `${fe}${je}`, y(h), s(h);
|
|
@@ -4720,17 +4718,17 @@ function wo({
|
|
|
4720
4718
|
let re = null;
|
|
4721
4719
|
u.contentParts && u.contentParts.length > 0 && (re = u.contentParts);
|
|
4722
4720
|
const { contentParts: de, filesInfo: X } = re ? { contentParts: re, filesInfo: [] } : await Fr(S), se = [...de];
|
|
4723
|
-
|
|
4724
|
-
const
|
|
4721
|
+
_ && se.push({ type: "text", text: A });
|
|
4722
|
+
const _e = u == null ? void 0 : u.originalMessageId, Le = !!(u != null && u.edit && _e), ce = !B && se.length > 0;
|
|
4725
4723
|
let Ae = null;
|
|
4726
4724
|
if (ce) {
|
|
4727
|
-
const fe = Le ?
|
|
4725
|
+
const fe = Le ? _e : `msg-${Date.now()}`;
|
|
4728
4726
|
Ae = gn({
|
|
4729
4727
|
id: fe,
|
|
4730
4728
|
role: "user",
|
|
4731
4729
|
content: se,
|
|
4732
4730
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4733
|
-
}, "user"), Le ? b(Ae, { editingMessageId:
|
|
4731
|
+
}, "user"), Le ? b(Ae, { editingMessageId: _e }) : b(Ae);
|
|
4734
4732
|
}
|
|
4735
4733
|
const ye = B ? J : Ae ? [Ae] : [], be = {
|
|
4736
4734
|
...G,
|
|
@@ -4843,7 +4841,7 @@ function Ho({
|
|
|
4843
4841
|
onMetadataEvent: y,
|
|
4844
4842
|
onFinish: w
|
|
4845
4843
|
}) {
|
|
4846
|
-
const g = ko(t), [b, I] = D(!1), x =
|
|
4844
|
+
const g = ko(t), [b, I] = D(!1), x = Ne(i), M = Ne(f), R = Ne(a), N = Ne(l), v = Ne(c), k = Ne(d), L = Ne(m), F = Ne(y), j = Ne(w), O = ue(
|
|
4847
4845
|
() => ({
|
|
4848
4846
|
onError: x,
|
|
4849
4847
|
onAuthError: M,
|
|
@@ -4870,7 +4868,7 @@ function Ho({
|
|
|
4870
4868
|
{
|
|
4871
4869
|
initialThreadId: n,
|
|
4872
4870
|
onError: x,
|
|
4873
|
-
onThreadChange:
|
|
4871
|
+
onThreadChange: N,
|
|
4874
4872
|
children: /* @__PURE__ */ ke(
|
|
4875
4873
|
ho,
|
|
4876
4874
|
{
|
|
@@ -4893,7 +4891,7 @@ function Ho({
|
|
|
4893
4891
|
}
|
|
4894
4892
|
) });
|
|
4895
4893
|
}
|
|
4896
|
-
function
|
|
4894
|
+
function Ne(e) {
|
|
4897
4895
|
const t = V(e);
|
|
4898
4896
|
return t.current = e, P((...n) => {
|
|
4899
4897
|
const r = t.current;
|
|
@@ -5012,13 +5010,13 @@ function Wo(e) {
|
|
|
5012
5010
|
const M = String(g.url ?? ""), R = M.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
5013
5011
|
if (R) {
|
|
5014
5012
|
w.preventDefault();
|
|
5015
|
-
const
|
|
5016
|
-
m({ id:
|
|
5013
|
+
const N = R[1], v = g.name || `file_${N}`, k = g.mimeType || "application/octet-stream";
|
|
5014
|
+
m({ id: N, name: v, mimeType: k });
|
|
5017
5015
|
return;
|
|
5018
5016
|
}
|
|
5019
5017
|
if (M.startsWith("data:")) {
|
|
5020
5018
|
w.preventDefault(), a((v) => ({ ...v, [b]: !0 }));
|
|
5021
|
-
const
|
|
5019
|
+
const N = o({ title: "Fetching file...", description: "", open: !0 });
|
|
5022
5020
|
try {
|
|
5023
5021
|
const v = await r.listFiles(n ?? void 0);
|
|
5024
5022
|
if (!v || !Array.isArray(v))
|
|
@@ -5032,8 +5030,8 @@ function Wo(e) {
|
|
|
5032
5030
|
id: k.id,
|
|
5033
5031
|
name: g.name || k.filename || `file_${k.id}`,
|
|
5034
5032
|
mimeType: g.mimeType || k.mime_type || "application/octet-stream"
|
|
5035
|
-
}), (I =
|
|
5036
|
-
id:
|
|
5033
|
+
}), (I = N.update) == null || I.call(N, {
|
|
5034
|
+
id: N.id,
|
|
5037
5035
|
title: "Success",
|
|
5038
5036
|
description: `Opened ${g.name}`,
|
|
5039
5037
|
open: !0
|
|
@@ -5041,7 +5039,7 @@ function Wo(e) {
|
|
|
5041
5039
|
} catch (v) {
|
|
5042
5040
|
console.error("Failed to fetch server file:", v);
|
|
5043
5041
|
const k = v instanceof Error ? v.message : "Unknown error occurred";
|
|
5044
|
-
(x =
|
|
5042
|
+
(x = N.update) == null || x.call(N, { id: N.id, title: "Failed", description: k }), o({
|
|
5045
5043
|
title: "Failed to fetch file",
|
|
5046
5044
|
description: k,
|
|
5047
5045
|
open: !0
|
|
@@ -5090,7 +5088,7 @@ function Po(e) {
|
|
|
5090
5088
|
const s = o.slice(Yt.length).trim();
|
|
5091
5089
|
if (!s || s.toLowerCase() === "[done]")
|
|
5092
5090
|
continue;
|
|
5093
|
-
const a =
|
|
5091
|
+
const a = Nt(s);
|
|
5094
5092
|
a && typeof a == "object" && t.push(a);
|
|
5095
5093
|
}
|
|
5096
5094
|
return t;
|
|
@@ -5115,7 +5113,7 @@ function Jo(e) {
|
|
|
5115
5113
|
);
|
|
5116
5114
|
if (!r.length) {
|
|
5117
5115
|
const f = t.map((c) => c.text ?? "").join(`
|
|
5118
|
-
`), l =
|
|
5116
|
+
`), l = Nt(f);
|
|
5119
5117
|
l && typeof l == "object" && (r = [l]);
|
|
5120
5118
|
}
|
|
5121
5119
|
if (!r.length)
|
|
@@ -5136,10 +5134,10 @@ function Jo(e) {
|
|
|
5136
5134
|
};
|
|
5137
5135
|
}, [e]);
|
|
5138
5136
|
}
|
|
5139
|
-
function
|
|
5137
|
+
function No(e) {
|
|
5140
5138
|
var R;
|
|
5141
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, { currentThreadId: n, setCurrentThreadId: r, actions: o } = nt(), s = In({ optional: !0 }), a = vo(), i = !!t && t !== n, [f, l] = D([]), c = P((
|
|
5142
|
-
l(
|
|
5139
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, { currentThreadId: n, setCurrentThreadId: r, actions: o } = nt(), s = In({ optional: !0 }), a = vo(), i = !!t && t !== n, [f, l] = D([]), c = P((N) => {
|
|
5140
|
+
l(N);
|
|
5143
5141
|
}, []), {
|
|
5144
5142
|
isLoadingThread: d,
|
|
5145
5143
|
threadStateError: m,
|
|
@@ -5154,8 +5152,8 @@ function _o(e) {
|
|
|
5154
5152
|
getMessages: () => f,
|
|
5155
5153
|
autoLoadInitial: !0
|
|
5156
5154
|
}), w = ue(() => {
|
|
5157
|
-
var
|
|
5158
|
-
return ((
|
|
5155
|
+
var N;
|
|
5156
|
+
return ((N = y[0]) == null ? void 0 : N.values) || {};
|
|
5159
5157
|
}, [y]), g = t || n, b = i ? f : (a == null ? void 0 : a.messages) || [], I = i ? d : (s == null ? void 0 : s.isLoading) || !1, x = i ? w : (s == null ? void 0 : s.values) || {}, M = i ? m : (a == null ? void 0 : a.error) || (s == null ? void 0 : s.error) || null;
|
|
5160
5158
|
return {
|
|
5161
5159
|
// UNIFIED: Single thread ID concept
|
|
@@ -5216,7 +5214,7 @@ function Xo({
|
|
|
5216
5214
|
threadId: m,
|
|
5217
5215
|
clearComposerOnSend: y = !0
|
|
5218
5216
|
}) {
|
|
5219
|
-
const { messages: w } =
|
|
5217
|
+
const { messages: w } = No(), [g, b] = D(null), [I, x] = D(""), [M, R] = D(null), [N, v] = D(null), [k, L] = D(!1), [F, j] = D(""), O = V(F), E = V(null);
|
|
5220
5218
|
ne(() => {
|
|
5221
5219
|
if (!g)
|
|
5222
5220
|
if (m) {
|
|
@@ -5243,8 +5241,8 @@ function Xo({
|
|
|
5243
5241
|
},
|
|
5244
5242
|
[W]
|
|
5245
5243
|
), q = async (u, p) => {
|
|
5246
|
-
const h = Array.isArray(p) ? { files: p } : p ?? {}, A = h.files ?? [], S = h.contentParts ?? [],
|
|
5247
|
-
if (!(!
|
|
5244
|
+
const h = Array.isArray(p) ? { files: p } : p ?? {}, A = h.files ?? [], S = h.contentParts ?? [], _ = u.trim();
|
|
5245
|
+
if (!(!_ && A.length === 0 && S.length === 0))
|
|
5248
5246
|
try {
|
|
5249
5247
|
const G = A.map(async (X) => {
|
|
5250
5248
|
try {
|
|
@@ -5268,7 +5266,7 @@ function Xo({
|
|
|
5268
5266
|
}), ae = [...S, ...B], re = g ? (M == null ? void 0 : M.checkpointId) ?? n ?? void 0 : n ?? void 0, de = g ? (M == null ? void 0 : M.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5269
5267
|
await e(
|
|
5270
5268
|
{
|
|
5271
|
-
text:
|
|
5269
|
+
text: _ || "",
|
|
5272
5270
|
contentParts: ae,
|
|
5273
5271
|
attachments: A,
|
|
5274
5272
|
payload: t.payload,
|
|
@@ -5280,7 +5278,7 @@ function Xo({
|
|
|
5280
5278
|
config: t.config
|
|
5281
5279
|
},
|
|
5282
5280
|
d ? { onEvent: d } : void 0
|
|
5283
|
-
), o == null || o(
|
|
5281
|
+
), o == null || o(_), l(!0), y && (m && localStorage.removeItem(xt(m)), W("")), v(null), b(null), x(""), R(null);
|
|
5284
5282
|
} catch (G) {
|
|
5285
5283
|
const J = (G == null ? void 0 : G.message) || "Failed to send message";
|
|
5286
5284
|
v(J), a == null || a(J), l(!1);
|
|
@@ -5316,13 +5314,13 @@ function Xo({
|
|
|
5316
5314
|
u !== null && j(u), E.current = null;
|
|
5317
5315
|
}, []), H = P((u) => {
|
|
5318
5316
|
let p = null;
|
|
5319
|
-
for (let
|
|
5320
|
-
if (f[
|
|
5321
|
-
p = f[
|
|
5317
|
+
for (let _ = u - 1; _ >= 0; _--)
|
|
5318
|
+
if (f[_].role === "user") {
|
|
5319
|
+
p = f[_];
|
|
5322
5320
|
break;
|
|
5323
5321
|
}
|
|
5324
5322
|
if (!p) return;
|
|
5325
|
-
const h = Array.isArray(p.content) ? p.content : [], S = h.filter((
|
|
5323
|
+
const h = Array.isArray(p.content) ? p.content : [], S = h.filter((_) => (_ == null ? void 0 : _.type) === "text").map((_) => _.text).join("") || (() => {
|
|
5326
5324
|
try {
|
|
5327
5325
|
return JSON.stringify(h, null, 2);
|
|
5328
5326
|
} catch {
|
|
@@ -5345,7 +5343,7 @@ function Xo({
|
|
|
5345
5343
|
return {
|
|
5346
5344
|
editingMessageId: g,
|
|
5347
5345
|
editingInitialValue: I,
|
|
5348
|
-
inputError:
|
|
5346
|
+
inputError: N,
|
|
5349
5347
|
setInputError: v,
|
|
5350
5348
|
dismissError: k,
|
|
5351
5349
|
setDismissError: L,
|
|
@@ -5415,7 +5413,7 @@ export {
|
|
|
5415
5413
|
Vo as messageSignature,
|
|
5416
5414
|
Bo as normalizeInterruptId,
|
|
5417
5415
|
un as onChatTokenChanged,
|
|
5418
|
-
|
|
5416
|
+
Nt as parseJsonSafe,
|
|
5419
5417
|
cn as pretty,
|
|
5420
5418
|
St as refreshHistoryFileUrls,
|
|
5421
5419
|
mt as sanitizeForDisplay,
|
|
@@ -5423,7 +5421,7 @@ export {
|
|
|
5423
5421
|
Ir as stringifyTool,
|
|
5424
5422
|
He as useApi,
|
|
5425
5423
|
Xo as useChatController,
|
|
5426
|
-
|
|
5424
|
+
No as useChatSession,
|
|
5427
5425
|
Wo as useFilePreview,
|
|
5428
5426
|
Qo as useMessageContent,
|
|
5429
5427
|
qo as useParsedMessageContent,
|