@fencyai/react 0.1.138 → 0.1.139
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/agent-task/AgentTaskProgressSimple.d.ts.map +1 -1
- package/dist/agent-task/AgentTaskProgressVerbose.d.ts.map +1 -1
- package/dist/agent-task/data-types/MemoryChatCompletionChunkResult.d.ts +12 -0
- package/dist/agent-task/data-types/MemoryChatCompletionChunkResult.d.ts.map +1 -0
- package/dist/agent-task/translations.d.ts +4 -0
- package/dist/agent-task/translations.d.ts.map +1 -1
- package/dist/index.js +485 -357
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createStream as G, isStreamTimeoutEvent as J, isStreamNotFoundEvent as V, isAgentTaskProgressItemUpdatedEvent as X, createAgentTask as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { useInView as Z, motion as
|
|
1
|
+
import { jsxs as v, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createStream as G, isStreamTimeoutEvent as J, isStreamNotFoundEvent as V, isAgentTaskProgressItemUpdatedEvent as X, createAgentTask as Y } from "@fencyai/js";
|
|
3
|
+
import { createContext as q, useState as C, useRef as A, useEffect as w, useCallback as _, useContext as Q, useMemo as $ } from "react";
|
|
4
|
+
import { useInView as Z, motion as T, AnimatePresence as W } from "motion/react";
|
|
5
5
|
import ee from "react-markdown";
|
|
6
6
|
import { Prism as j } from "react-syntax-highlighter";
|
|
7
7
|
import te from "remark-gfm";
|
|
8
|
-
import './assets/index.css';const
|
|
8
|
+
import './assets/index.css';const H = q(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
|
-
async function
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
t(
|
|
11
|
+
async function ne(e, t) {
|
|
12
|
+
const n = e.getReader();
|
|
13
|
+
let r;
|
|
14
|
+
for (; !(r = await n.read()).done; )
|
|
15
|
+
t(r.value);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let t,
|
|
17
|
+
function re(e) {
|
|
18
|
+
let t, n, r, s = !1;
|
|
19
19
|
return function(o) {
|
|
20
|
-
t === void 0 ? (t = o,
|
|
20
|
+
t === void 0 ? (t = o, n = 0, r = -1) : t = ae(t, o);
|
|
21
21
|
const l = t.length;
|
|
22
|
-
let
|
|
23
|
-
for (;
|
|
24
|
-
s && (t[
|
|
22
|
+
let u = 0;
|
|
23
|
+
for (; n < l; ) {
|
|
24
|
+
s && (t[n] === 10 && (u = ++n), s = !1);
|
|
25
25
|
let a = -1;
|
|
26
|
-
for (;
|
|
27
|
-
switch (t[
|
|
26
|
+
for (; n < l && a === -1; ++n)
|
|
27
|
+
switch (t[n]) {
|
|
28
28
|
case 58:
|
|
29
|
-
|
|
29
|
+
r === -1 && (r = n - u);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
32
|
s = !0;
|
|
33
33
|
case 10:
|
|
34
|
-
a =
|
|
34
|
+
a = n;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
if (a === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(t.subarray(
|
|
39
|
+
e(t.subarray(u, a), r), u = n, r = -1;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
u === l ? t = void 0 : u !== 0 && (t = t.subarray(u), n -= u);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function oe(e, t,
|
|
45
|
-
let
|
|
44
|
+
function oe(e, t, n) {
|
|
45
|
+
let r = O();
|
|
46
46
|
const s = new TextDecoder();
|
|
47
47
|
return function(o, l) {
|
|
48
48
|
if (o.length === 0)
|
|
49
|
-
|
|
49
|
+
n == null || n(r), r = O();
|
|
50
50
|
else if (l > 0) {
|
|
51
|
-
const
|
|
52
|
-
switch (
|
|
51
|
+
const u = s.decode(o.subarray(0, l)), a = l + (o[l + 1] === 32 ? 2 : 1), c = s.decode(o.subarray(a));
|
|
52
|
+
switch (u) {
|
|
53
53
|
case "data":
|
|
54
|
-
|
|
54
|
+
r.data = r.data ? r.data + `
|
|
55
55
|
` + c : c;
|
|
56
56
|
break;
|
|
57
57
|
case "event":
|
|
58
|
-
|
|
58
|
+
r.event = c;
|
|
59
59
|
break;
|
|
60
60
|
case "id":
|
|
61
|
-
e(
|
|
61
|
+
e(r.id = c);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
64
|
+
const g = parseInt(c, 10);
|
|
65
|
+
isNaN(g) || t(r.retry = g);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function ae(e, t) {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
72
|
+
const n = new Uint8Array(e.length + t.length);
|
|
73
|
+
return n.set(e), n.set(t, e.length), n;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function O() {
|
|
76
76
|
return {
|
|
77
77
|
data: "",
|
|
78
78
|
event: "",
|
|
@@ -80,66 +80,66 @@ function F() {
|
|
|
80
80
|
retry: void 0
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
for (var
|
|
83
|
+
var ie = function(e, t) {
|
|
84
|
+
var n = {};
|
|
85
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
86
86
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
87
|
-
for (var s = 0,
|
|
88
|
-
t.indexOf(
|
|
89
|
-
return
|
|
87
|
+
for (var s = 0, r = Object.getOwnPropertySymbols(e); s < r.length; s++)
|
|
88
|
+
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
|
|
89
|
+
return n;
|
|
90
90
|
};
|
|
91
|
-
const
|
|
91
|
+
const F = "text/event-stream", se = 1e3, L = "last-event-id";
|
|
92
92
|
function le(e, t) {
|
|
93
|
-
var { signal:
|
|
94
|
-
return new Promise((
|
|
95
|
-
const f = Object.assign({},
|
|
96
|
-
f.accept || (f.accept =
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
|
|
93
|
+
var { signal: n, headers: r, onopen: s, onmessage: d, onclose: o, onerror: l, openWhenHidden: u, fetch: a } = t, c = ie(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((g, m) => {
|
|
95
|
+
const f = Object.assign({}, r);
|
|
96
|
+
f.accept || (f.accept = F);
|
|
97
|
+
let y;
|
|
98
|
+
function p() {
|
|
99
|
+
y.abort(), document.hidden || E();
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange",
|
|
101
|
+
u || document.addEventListener("visibilitychange", p);
|
|
102
|
+
let h = se, S = 0;
|
|
103
|
+
function k() {
|
|
104
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), y.abort();
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
n == null || n.addEventListener("abort", () => {
|
|
107
|
+
k(), g();
|
|
108
108
|
});
|
|
109
|
-
const P = a ?? window.fetch,
|
|
110
|
-
async function
|
|
111
|
-
var
|
|
112
|
-
|
|
109
|
+
const P = a ?? window.fetch, M = s ?? ce;
|
|
110
|
+
async function E() {
|
|
111
|
+
var D;
|
|
112
|
+
y = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const
|
|
115
|
-
await I
|
|
116
|
-
b ? f[
|
|
114
|
+
const I = await P(e, Object.assign(Object.assign({}, c), { headers: f, signal: y.signal }));
|
|
115
|
+
await M(I), await ne(I.body, re(oe((b) => {
|
|
116
|
+
b ? f[L] = b : delete f[L];
|
|
117
117
|
}, (b) => {
|
|
118
|
-
|
|
119
|
-
}, d))), o == null || o(),
|
|
120
|
-
} catch (
|
|
121
|
-
if (!
|
|
118
|
+
h = b;
|
|
119
|
+
}, d))), o == null || o(), k(), g();
|
|
120
|
+
} catch (I) {
|
|
121
|
+
if (!y.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const b = (
|
|
124
|
-
window.clearTimeout(S), S = window.setTimeout(
|
|
123
|
+
const b = (D = l == null ? void 0 : l(I)) !== null && D !== void 0 ? D : h;
|
|
124
|
+
window.clearTimeout(S), S = window.setTimeout(E, b);
|
|
125
125
|
} catch (b) {
|
|
126
|
-
|
|
126
|
+
k(), m(b);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
E();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
function ce(e) {
|
|
134
134
|
const t = e.headers.get("content-type");
|
|
135
|
-
if (!(t != null && t.startsWith(
|
|
136
|
-
throw new Error(`Expected content-type to be ${
|
|
135
|
+
if (!(t != null && t.startsWith(F)))
|
|
136
|
+
throw new Error(`Expected content-type to be ${F}, Actual: ${t}`);
|
|
137
137
|
}
|
|
138
138
|
function de(e) {
|
|
139
|
-
const t = atob(e),
|
|
140
|
-
for (let
|
|
141
|
-
r
|
|
142
|
-
return new TextDecoder("utf-8").decode(
|
|
139
|
+
const t = atob(e), n = new Uint8Array(t.length);
|
|
140
|
+
for (let r = 0; r < t.length; r++)
|
|
141
|
+
n[r] = t.charCodeAt(r);
|
|
142
|
+
return new TextDecoder("utf-8").decode(n);
|
|
143
143
|
}
|
|
144
144
|
class ue {
|
|
145
145
|
constructor(t) {
|
|
@@ -150,25 +150,25 @@ class ue {
|
|
|
150
150
|
* Creates new connections and removes old ones.
|
|
151
151
|
*/
|
|
152
152
|
updateStreams(t) {
|
|
153
|
-
t.forEach((
|
|
154
|
-
const s =
|
|
155
|
-
this.eventSources.has(s) || this.connectStream(
|
|
153
|
+
t.forEach((r) => {
|
|
154
|
+
const s = r.stream.id;
|
|
155
|
+
this.eventSources.has(s) || this.connectStream(r);
|
|
156
156
|
});
|
|
157
|
-
const
|
|
158
|
-
this.eventSources.forEach((
|
|
159
|
-
|
|
157
|
+
const n = new Set(t.map((r) => r.stream.id));
|
|
158
|
+
this.eventSources.forEach((r, s) => {
|
|
159
|
+
n.has(s) || (r.abort(), this.eventSources.delete(s));
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
connectStream(t) {
|
|
163
|
-
const
|
|
164
|
-
this.eventSources.set(
|
|
165
|
-
const s = `${this.fency.baseUrl}/sse/streams/${
|
|
163
|
+
const n = t.stream.id, r = new AbortController();
|
|
164
|
+
this.eventSources.set(n, r);
|
|
165
|
+
const s = `${this.fency.baseUrl}/sse/streams/${n}`, d = {
|
|
166
166
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
167
167
|
"X-Fency-Stream-Token": t.stream.token
|
|
168
168
|
};
|
|
169
169
|
le(s, {
|
|
170
170
|
headers: d,
|
|
171
|
-
signal:
|
|
171
|
+
signal: r.signal,
|
|
172
172
|
async onopen(o) {
|
|
173
173
|
if (!o.ok && o.status >= 400 && o.status < 500 && o.status !== 429)
|
|
174
174
|
throw new Error(`Client error ${o.status}`);
|
|
@@ -176,11 +176,11 @@ class ue {
|
|
|
176
176
|
onmessage: (o) => {
|
|
177
177
|
if (o.data) {
|
|
178
178
|
const l = de(o.data);
|
|
179
|
-
this.broadcast(l,
|
|
179
|
+
this.broadcast(l, n);
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
onerror: (o) => {
|
|
183
|
-
throw console.error("EventSource error for stream",
|
|
183
|
+
throw console.error("EventSource error for stream", n, ":", o), this.broadcastError(n), o;
|
|
184
184
|
},
|
|
185
185
|
onclose() {
|
|
186
186
|
}
|
|
@@ -190,19 +190,19 @@ class ue {
|
|
|
190
190
|
* Subscribe to events from all active streams.
|
|
191
191
|
* Returns an unsubscribe function.
|
|
192
192
|
*/
|
|
193
|
-
subscribe(t,
|
|
194
|
-
return this.subscribers.set(t,
|
|
193
|
+
subscribe(t, n) {
|
|
194
|
+
return this.subscribers.set(t, n), () => {
|
|
195
195
|
this.subscribers.delete(t);
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
broadcast(t,
|
|
199
|
-
this.subscribers.forEach((
|
|
200
|
-
|
|
198
|
+
broadcast(t, n) {
|
|
199
|
+
this.subscribers.forEach((r) => {
|
|
200
|
+
r.onMessage(t, n);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
broadcastError(t) {
|
|
204
|
-
this.subscribers.forEach((
|
|
205
|
-
|
|
204
|
+
this.subscribers.forEach((n) => {
|
|
205
|
+
n.onError(t);
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -214,77 +214,77 @@ class ue {
|
|
|
214
214
|
}
|
|
215
215
|
const me = 12e4, ge = (e) => {
|
|
216
216
|
const t = Date.now();
|
|
217
|
-
return e.filter((
|
|
217
|
+
return e.filter((n) => t - n.createdAt < me);
|
|
218
218
|
};
|
|
219
|
-
function
|
|
220
|
-
const [
|
|
219
|
+
function Ge({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
|
|
220
|
+
const [r, s] = C(
|
|
221
221
|
null
|
|
222
|
-
), [d, o] =
|
|
223
|
-
|
|
224
|
-
e.then((
|
|
225
|
-
s(
|
|
226
|
-
}).catch((
|
|
227
|
-
|
|
222
|
+
), [d, o] = C(!0), [l, u] = C(null), [a, c] = C([]), g = A(null), m = A(null);
|
|
223
|
+
w(() => {
|
|
224
|
+
e.then((h) => {
|
|
225
|
+
s(h), o(!1);
|
|
226
|
+
}).catch((h) => {
|
|
227
|
+
u(h), o(!1);
|
|
228
228
|
});
|
|
229
|
-
}, [e]),
|
|
230
|
-
|
|
231
|
-
}, [
|
|
232
|
-
|
|
233
|
-
}, [a]),
|
|
234
|
-
var
|
|
235
|
-
(
|
|
229
|
+
}, [e]), w(() => {
|
|
230
|
+
r && !m.current && (m.current = new ue(r));
|
|
231
|
+
}, [r]), w(() => {
|
|
232
|
+
m.current && m.current.updateStreams(a);
|
|
233
|
+
}, [a]), w(() => () => {
|
|
234
|
+
var h;
|
|
235
|
+
(h = m.current) == null || h.cleanup();
|
|
236
236
|
}, []);
|
|
237
237
|
const f = _(
|
|
238
|
-
async (
|
|
239
|
-
if (
|
|
240
|
-
return
|
|
241
|
-
const S = Date.now(),
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
238
|
+
async (h = 3e4) => {
|
|
239
|
+
if (g.current)
|
|
240
|
+
return g.current;
|
|
241
|
+
const S = Date.now(), k = a.length > 0 ? a[a.length - 1] : null;
|
|
242
|
+
if (k && S - k.createdAt < h)
|
|
243
|
+
return k.stream;
|
|
244
244
|
const P = (async () => {
|
|
245
|
-
if (!
|
|
245
|
+
if (!r)
|
|
246
246
|
throw new Error("Fency instance not initialized");
|
|
247
|
-
const
|
|
248
|
-
pk:
|
|
249
|
-
baseUrl:
|
|
250
|
-
clientToken: (
|
|
247
|
+
const M = await t(), E = await G({
|
|
248
|
+
pk: r.publishableKey,
|
|
249
|
+
baseUrl: r.baseUrl,
|
|
250
|
+
clientToken: (M == null ? void 0 : M.clientToken) ?? ""
|
|
251
251
|
});
|
|
252
|
-
if (
|
|
253
|
-
const
|
|
254
|
-
stream:
|
|
252
|
+
if (E.type === "success") {
|
|
253
|
+
const D = {
|
|
254
|
+
stream: E.stream,
|
|
255
255
|
createdAt: Date.now()
|
|
256
256
|
};
|
|
257
|
-
return c((
|
|
258
|
-
const b = [...
|
|
257
|
+
return c((I) => {
|
|
258
|
+
const b = [...I, D];
|
|
259
259
|
return ge(b);
|
|
260
|
-
}),
|
|
260
|
+
}), g.current = null, E.stream;
|
|
261
261
|
} else
|
|
262
|
-
throw
|
|
262
|
+
throw g.current = null, new Error("Failed to create stream");
|
|
263
263
|
})();
|
|
264
|
-
return
|
|
264
|
+
return g.current = P, P;
|
|
265
265
|
},
|
|
266
|
-
[
|
|
266
|
+
[r, a]
|
|
267
267
|
);
|
|
268
268
|
if (l)
|
|
269
|
-
return /* @__PURE__ */
|
|
269
|
+
return /* @__PURE__ */ v("div", { children: [
|
|
270
270
|
"Fency error: ",
|
|
271
271
|
l.message
|
|
272
272
|
] });
|
|
273
|
-
if (!
|
|
273
|
+
if (!r)
|
|
274
274
|
return null;
|
|
275
|
-
const
|
|
276
|
-
fency:
|
|
275
|
+
const y = a.length > 0 ? a[a.length - 1] : null, p = {
|
|
276
|
+
fency: r,
|
|
277
277
|
loading: d,
|
|
278
278
|
error: l,
|
|
279
279
|
activeStreams: a,
|
|
280
|
-
latestStream:
|
|
281
|
-
eventManager:
|
|
280
|
+
latestStream: y,
|
|
281
|
+
eventManager: m.current,
|
|
282
282
|
getOrCreateStream: f
|
|
283
283
|
};
|
|
284
|
-
return /* @__PURE__ */ i(
|
|
284
|
+
return /* @__PURE__ */ i(H.Provider, { value: p, children: n });
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
const e = Q(
|
|
286
|
+
function N() {
|
|
287
|
+
const e = Q(H);
|
|
288
288
|
if (e === void 0)
|
|
289
289
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
290
290
|
return e;
|
|
@@ -296,11 +296,11 @@ const ye = (e) => {
|
|
|
296
296
|
} catch (t) {
|
|
297
297
|
return console.error("Error parsing message:", t), null;
|
|
298
298
|
}
|
|
299
|
-
}, fe = (e) => J(e) ?
|
|
299
|
+
}, fe = (e) => J(e) ? he(e) : V(e) ? pe(e) : X(e) ? Se(e) : null, he = (e) => ({
|
|
300
300
|
type: "STREAM_TIMEOUT",
|
|
301
301
|
streamId: e.streamId,
|
|
302
302
|
timestamp: e.timestamp
|
|
303
|
-
}),
|
|
303
|
+
}), pe = (e) => ({
|
|
304
304
|
type: "STREAM_NOT_FOUND",
|
|
305
305
|
streamId: e.streamId,
|
|
306
306
|
timestamp: e.timestamp
|
|
@@ -312,31 +312,31 @@ const ye = (e) => {
|
|
|
312
312
|
timestamp: e.timestamp,
|
|
313
313
|
createdAt: e.createdAt,
|
|
314
314
|
data: JSON.parse(e.data)
|
|
315
|
-
}),
|
|
316
|
-
const t =
|
|
317
|
-
return
|
|
315
|
+
}), ke = (e) => {
|
|
316
|
+
const t = N(), [n, r] = C(null), s = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
317
|
+
return w(() => {
|
|
318
318
|
if (!t.eventManager) return;
|
|
319
319
|
const o = {
|
|
320
|
-
onMessage: (
|
|
321
|
-
var
|
|
322
|
-
const c = ye(
|
|
320
|
+
onMessage: (u, a) => {
|
|
321
|
+
var g, m, f;
|
|
322
|
+
const c = ye(u);
|
|
323
323
|
if (c)
|
|
324
324
|
switch (c.type) {
|
|
325
325
|
case "STREAM_TIMEOUT":
|
|
326
|
-
(
|
|
326
|
+
(g = e == null ? void 0 : e.onStreamTimeout) == null || g.call(e, c);
|
|
327
327
|
break;
|
|
328
328
|
case "STREAM_NOT_FOUND":
|
|
329
|
-
(
|
|
329
|
+
(m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, c);
|
|
330
330
|
break;
|
|
331
331
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
332
332
|
(f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, c);
|
|
333
333
|
break;
|
|
334
334
|
}
|
|
335
335
|
},
|
|
336
|
-
onError: (
|
|
336
|
+
onError: (u) => {
|
|
337
337
|
var a;
|
|
338
338
|
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
|
|
339
|
-
streamId:
|
|
339
|
+
streamId: u,
|
|
340
340
|
error: {
|
|
341
341
|
code: "UnknownError",
|
|
342
342
|
message: "Unknown error in useStream"
|
|
@@ -352,7 +352,7 @@ const ye = (e) => {
|
|
|
352
352
|
createStream: async () => {
|
|
353
353
|
try {
|
|
354
354
|
const o = await t.getOrCreateStream(3e4);
|
|
355
|
-
return
|
|
355
|
+
return r(o), {
|
|
356
356
|
type: "success",
|
|
357
357
|
stream: o
|
|
358
358
|
};
|
|
@@ -366,12 +366,12 @@ const ye = (e) => {
|
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
368
|
},
|
|
369
|
-
stream:
|
|
369
|
+
stream: n
|
|
370
370
|
};
|
|
371
|
-
},
|
|
372
|
-
const t =
|
|
371
|
+
}, Je = (e) => {
|
|
372
|
+
const t = N(), [n, r] = C([]), s = A(/* @__PURE__ */ new Set()), d = A(/* @__PURE__ */ new Map()), { createStream: o } = ke({
|
|
373
373
|
onAgentTaskProgressItemUpdated: (a) => {
|
|
374
|
-
var
|
|
374
|
+
var m;
|
|
375
375
|
if (!s.current.has(a.agentTaskId)) return;
|
|
376
376
|
const c = a.data;
|
|
377
377
|
if (c.taskType === "StreamingChatCompletion" && c.eventType === "Completed" || c.taskType === "StructuredChatCompletion" && c.eventType === "Completed" || c.taskType === "MemoryChatCompletion" && c.eventType === "Completed") {
|
|
@@ -381,32 +381,32 @@ const ye = (e) => {
|
|
|
381
381
|
f && (d.current.delete(a.agentTaskId), f(c));
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
(
|
|
385
|
-
(f) => f.map((
|
|
384
|
+
(m = e.onAgentTaskProgressItemUpdated) == null || m.call(e, a), r(
|
|
385
|
+
(f) => f.map((y) => {
|
|
386
386
|
var S;
|
|
387
|
-
if (((S =
|
|
388
|
-
return
|
|
389
|
-
const
|
|
390
|
-
(
|
|
391
|
-
) ?
|
|
392
|
-
(
|
|
393
|
-
) : [...
|
|
394
|
-
return { ...
|
|
387
|
+
if (((S = y.confirmedData) == null ? void 0 : S.taskId) !== a.agentTaskId)
|
|
388
|
+
return y;
|
|
389
|
+
const h = y.progressItems.some(
|
|
390
|
+
(k) => k.progressItemId === a.progressItemId
|
|
391
|
+
) ? y.progressItems.map(
|
|
392
|
+
(k) => k.progressItemId === a.progressItemId ? a : k
|
|
393
|
+
) : [...y.progressItems, a];
|
|
394
|
+
return { ...y, progressItems: h };
|
|
395
395
|
})
|
|
396
396
|
);
|
|
397
397
|
},
|
|
398
398
|
onStreamError: (a) => {
|
|
399
399
|
var c;
|
|
400
|
-
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a),
|
|
401
|
-
const
|
|
402
|
-
return
|
|
403
|
-
...
|
|
400
|
+
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a), r((g) => {
|
|
401
|
+
const m = g.find((f) => f.streamId === a.streamId);
|
|
402
|
+
return m ? [
|
|
403
|
+
...g.filter((f) => f.streamId !== a.streamId),
|
|
404
404
|
{
|
|
405
|
-
...
|
|
405
|
+
...m,
|
|
406
406
|
loading: !1,
|
|
407
407
|
error: a.error
|
|
408
408
|
}
|
|
409
|
-
] :
|
|
409
|
+
] : g;
|
|
410
410
|
});
|
|
411
411
|
},
|
|
412
412
|
onStreamNotFound: (a) => {
|
|
@@ -419,13 +419,13 @@ const ye = (e) => {
|
|
|
419
419
|
}
|
|
420
420
|
}), l = _(
|
|
421
421
|
async (a, c) => {
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
|
|
425
|
-
...
|
|
422
|
+
const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, m = await o();
|
|
423
|
+
if (m.type === "success") {
|
|
424
|
+
r([
|
|
425
|
+
...n,
|
|
426
426
|
{
|
|
427
|
-
taskKey:
|
|
428
|
-
streamId:
|
|
427
|
+
taskKey: g,
|
|
428
|
+
streamId: m.stream.id,
|
|
429
429
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
430
430
|
confirmedData: null,
|
|
431
431
|
error: null,
|
|
@@ -435,11 +435,11 @@ const ye = (e) => {
|
|
|
435
435
|
loadingText: c == null ? void 0 : c.loadingText
|
|
436
436
|
}
|
|
437
437
|
]);
|
|
438
|
-
const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(a.type),
|
|
438
|
+
const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(a.type), y = await Y({
|
|
439
439
|
pk: t.fency.publishableKey,
|
|
440
440
|
baseUrl: t.fency.baseUrl,
|
|
441
441
|
clientToken: f,
|
|
442
|
-
streamToken:
|
|
442
|
+
streamToken: m.stream.token,
|
|
443
443
|
request: {
|
|
444
444
|
streamingChatCompletionTask: a.type === "StreamingChatCompletion" ? {
|
|
445
445
|
messages: a.messages,
|
|
@@ -459,50 +459,50 @@ const ye = (e) => {
|
|
|
459
459
|
} : void 0
|
|
460
460
|
}
|
|
461
461
|
});
|
|
462
|
-
if (
|
|
462
|
+
if (y.type === "success" && y.agentTask) {
|
|
463
463
|
s.current.add(
|
|
464
|
-
|
|
465
|
-
),
|
|
466
|
-
...
|
|
464
|
+
y.agentTask.id
|
|
465
|
+
), r((h) => [
|
|
466
|
+
...h.filter((S) => S.taskKey !== g),
|
|
467
467
|
{
|
|
468
|
-
taskKey:
|
|
469
|
-
streamId:
|
|
468
|
+
taskKey: g,
|
|
469
|
+
streamId: m.stream.id,
|
|
470
470
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
|
-
taskId:
|
|
472
|
-
createdAt:
|
|
471
|
+
taskId: y.agentTask.id,
|
|
472
|
+
createdAt: y.agentTask.createdAt,
|
|
473
473
|
error: null,
|
|
474
474
|
params: a,
|
|
475
475
|
progressItems: [],
|
|
476
476
|
loading: !0,
|
|
477
477
|
loadingText: c == null ? void 0 : c.loadingText,
|
|
478
478
|
confirmedData: {
|
|
479
|
-
taskId:
|
|
480
|
-
createdAt:
|
|
479
|
+
taskId: y.agentTask.id,
|
|
480
|
+
createdAt: y.agentTask.createdAt
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
]);
|
|
484
|
-
const
|
|
484
|
+
const p = await new Promise((h) => {
|
|
485
485
|
d.current.set(
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
y.agentTask.id,
|
|
487
|
+
h
|
|
488
488
|
);
|
|
489
489
|
});
|
|
490
490
|
return {
|
|
491
491
|
type: "success",
|
|
492
|
-
streamId:
|
|
493
|
-
agentTaskId:
|
|
494
|
-
response:
|
|
492
|
+
streamId: m.stream.id,
|
|
493
|
+
agentTaskId: y.agentTask.id,
|
|
494
|
+
response: p
|
|
495
495
|
};
|
|
496
496
|
} else {
|
|
497
|
-
if (
|
|
498
|
-
return
|
|
499
|
-
...
|
|
497
|
+
if (y.type === "error")
|
|
498
|
+
return r((p) => [
|
|
499
|
+
...p.filter((h) => h.taskKey !== g),
|
|
500
500
|
{
|
|
501
|
-
taskKey:
|
|
501
|
+
taskKey: g,
|
|
502
502
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
503
|
-
streamId:
|
|
503
|
+
streamId: m.stream.id,
|
|
504
504
|
params: a,
|
|
505
|
-
error:
|
|
505
|
+
error: y.error,
|
|
506
506
|
progressItems: [],
|
|
507
507
|
loading: !1,
|
|
508
508
|
loadingText: c == null ? void 0 : c.loadingText,
|
|
@@ -510,20 +510,20 @@ const ye = (e) => {
|
|
|
510
510
|
}
|
|
511
511
|
]), {
|
|
512
512
|
type: "error",
|
|
513
|
-
error:
|
|
513
|
+
error: y.error
|
|
514
514
|
};
|
|
515
515
|
{
|
|
516
|
-
const
|
|
516
|
+
const p = {
|
|
517
517
|
message: "No response received",
|
|
518
518
|
code: "UnknownError"
|
|
519
519
|
};
|
|
520
|
-
return
|
|
521
|
-
...
|
|
520
|
+
return r((h) => [
|
|
521
|
+
...h.filter((S) => S.taskKey !== g),
|
|
522
522
|
{
|
|
523
|
-
taskKey:
|
|
523
|
+
taskKey: g,
|
|
524
524
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
525
|
-
streamId:
|
|
526
|
-
error:
|
|
525
|
+
streamId: m.stream.id,
|
|
526
|
+
error: p,
|
|
527
527
|
params: a,
|
|
528
528
|
progressItems: [],
|
|
529
529
|
loading: !1,
|
|
@@ -532,60 +532,60 @@ const ye = (e) => {
|
|
|
532
532
|
}
|
|
533
533
|
]), {
|
|
534
534
|
type: "error",
|
|
535
|
-
error:
|
|
535
|
+
error: p
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
} else
|
|
540
|
-
return console.error(
|
|
540
|
+
return console.error(m.error), m;
|
|
541
541
|
},
|
|
542
|
-
[t,
|
|
543
|
-
),
|
|
544
|
-
if (
|
|
545
|
-
return [...
|
|
546
|
-
}, [
|
|
547
|
-
return
|
|
542
|
+
[t, n, o]
|
|
543
|
+
), u = $(() => {
|
|
544
|
+
if (n.length !== 0)
|
|
545
|
+
return [...n].sort((a, c) => new Date(c.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
|
|
546
|
+
}, [n]);
|
|
547
|
+
return w(() => () => {
|
|
548
548
|
s.current.clear(), d.current.clear();
|
|
549
549
|
}, []), {
|
|
550
|
-
agentTasks:
|
|
550
|
+
agentTasks: n,
|
|
551
551
|
createAgentTask: l,
|
|
552
|
-
latest:
|
|
552
|
+
latest: u
|
|
553
553
|
};
|
|
554
554
|
};
|
|
555
|
-
function
|
|
556
|
-
return e.progressItems.map((t,
|
|
557
|
-
const
|
|
555
|
+
function Te(e) {
|
|
556
|
+
return e.progressItems.map((t, n) => {
|
|
557
|
+
const r = e.progressItems[n + 1], s = r != null;
|
|
558
558
|
let d;
|
|
559
|
-
if (
|
|
560
|
-
const o = new Date(t.createdAt).getTime(), l = new Date(
|
|
559
|
+
if (r != null && r.createdAt) {
|
|
560
|
+
const o = new Date(t.createdAt).getTime(), l = new Date(r.createdAt).getTime();
|
|
561
561
|
d = Math.round((l - o) / 1e3);
|
|
562
562
|
}
|
|
563
563
|
return {
|
|
564
564
|
item: t,
|
|
565
565
|
completed: s,
|
|
566
|
-
isLatest:
|
|
566
|
+
isLatest: n === e.progressItems.length - 1,
|
|
567
567
|
durationSeconds: d
|
|
568
568
|
};
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function R({
|
|
572
572
|
text: e,
|
|
573
573
|
duration: t = 2,
|
|
574
|
-
delay:
|
|
575
|
-
repeat:
|
|
574
|
+
delay: n = 0,
|
|
575
|
+
repeat: r = !0,
|
|
576
576
|
repeatDelay: s = 0.5,
|
|
577
577
|
className: d,
|
|
578
578
|
startOnView: o = !1,
|
|
579
579
|
once: l = !1,
|
|
580
|
-
inViewMargin:
|
|
580
|
+
inViewMargin: u,
|
|
581
581
|
spread: a = 2,
|
|
582
582
|
color: c = "#999",
|
|
583
|
-
shimmerColor:
|
|
584
|
-
direction:
|
|
583
|
+
shimmerColor: g = "#000",
|
|
584
|
+
direction: m = "fromBottom"
|
|
585
585
|
}) {
|
|
586
|
-
const f =
|
|
586
|
+
const f = A(null), y = Z(f, { once: l, margin: u }), p = $(() => e.length * a, [e, a]), h = !o || y, S = m === "fromBottom" ? "100% center" : "-100% center", k = m === "fromBottom" ? "0% center" : "200% center";
|
|
587
587
|
return /* @__PURE__ */ i(
|
|
588
|
-
|
|
588
|
+
T.span,
|
|
589
589
|
{
|
|
590
590
|
ref: f,
|
|
591
591
|
className: d,
|
|
@@ -598,9 +598,9 @@ function O({
|
|
|
598
598
|
color: "transparent",
|
|
599
599
|
WebkitTextFillColor: "transparent",
|
|
600
600
|
backgroundRepeat: "no-repeat, padding-box",
|
|
601
|
-
"--spread": `${
|
|
601
|
+
"--spread": `${p}px`,
|
|
602
602
|
"--base-color": c,
|
|
603
|
-
"--shimmer-color":
|
|
603
|
+
"--shimmer-color": g,
|
|
604
604
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
605
605
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
606
606
|
},
|
|
@@ -608,41 +608,41 @@ function O({
|
|
|
608
608
|
backgroundPosition: S,
|
|
609
609
|
opacity: 0
|
|
610
610
|
},
|
|
611
|
-
animate:
|
|
612
|
-
backgroundPosition:
|
|
611
|
+
animate: h ? {
|
|
612
|
+
backgroundPosition: k,
|
|
613
613
|
opacity: 1
|
|
614
614
|
} : {},
|
|
615
615
|
transition: {
|
|
616
616
|
backgroundPosition: {
|
|
617
|
-
repeat:
|
|
617
|
+
repeat: r ? 1 / 0 : 0,
|
|
618
618
|
duration: t,
|
|
619
|
-
delay:
|
|
619
|
+
delay: n,
|
|
620
620
|
repeatDelay: s,
|
|
621
621
|
ease: "linear"
|
|
622
622
|
},
|
|
623
623
|
opacity: {
|
|
624
624
|
duration: 0.3,
|
|
625
|
-
delay:
|
|
625
|
+
delay: n
|
|
626
626
|
}
|
|
627
627
|
},
|
|
628
628
|
children: e
|
|
629
629
|
}
|
|
630
630
|
);
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
632
|
+
function ve(e, t) {
|
|
633
|
+
const n = e.item.data;
|
|
634
|
+
if (n.eventType === "Error" && "message" in n)
|
|
635
635
|
return t.error;
|
|
636
|
-
if (
|
|
637
|
-
if (
|
|
638
|
-
if (
|
|
636
|
+
if (n.taskType === "StreamingChatCompletion") {
|
|
637
|
+
if (n.eventType === "Text") return t.streaming;
|
|
638
|
+
if (n.eventType === "Completed") return t.completed;
|
|
639
639
|
}
|
|
640
|
-
if (
|
|
641
|
-
if (
|
|
642
|
-
if (
|
|
640
|
+
if (n.taskType === "StructuredChatCompletion") {
|
|
641
|
+
if (n.eventType === "Json") return t.generating;
|
|
642
|
+
if (n.eventType === "Completed") return t.completed;
|
|
643
643
|
}
|
|
644
|
-
if (
|
|
645
|
-
switch (
|
|
644
|
+
if (n.taskType === "MemoryChatCompletion")
|
|
645
|
+
switch (n.eventType) {
|
|
646
646
|
case "Text":
|
|
647
647
|
return t.streaming;
|
|
648
648
|
case "Search":
|
|
@@ -657,33 +657,35 @@ function be(e, t) {
|
|
|
657
657
|
return t.memoryExplored;
|
|
658
658
|
case "ExploreMemoryError":
|
|
659
659
|
return t.memoryExplorationFailed;
|
|
660
|
+
case "ChunkResult":
|
|
661
|
+
return t.chunksRetrieved;
|
|
660
662
|
case "Completed":
|
|
661
663
|
return t.completed;
|
|
662
664
|
}
|
|
663
665
|
return t.processing;
|
|
664
666
|
}
|
|
665
|
-
const
|
|
666
|
-
const
|
|
667
|
-
if (!
|
|
668
|
-
const
|
|
669
|
-
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(
|
|
670
|
-
|
|
667
|
+
const be = ({ progressViewItems: e, t }) => {
|
|
668
|
+
const n = e[e.length - 1];
|
|
669
|
+
if (!n) return null;
|
|
670
|
+
const r = ve(n, t);
|
|
671
|
+
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(W, { mode: "wait", children: /* @__PURE__ */ i(
|
|
672
|
+
T.div,
|
|
671
673
|
{
|
|
672
674
|
initial: { opacity: 0, y: 10 },
|
|
673
675
|
animate: { opacity: 1, y: 0 },
|
|
674
676
|
exit: { opacity: 0, y: -10 },
|
|
675
677
|
transition: { duration: 0.3 },
|
|
676
|
-
children:
|
|
678
|
+
children: n.completed ? /* @__PURE__ */ i(
|
|
677
679
|
"div",
|
|
678
680
|
{
|
|
679
681
|
className: "simple-mode-title",
|
|
680
682
|
style: { color: "#666" },
|
|
681
|
-
children:
|
|
683
|
+
children: r
|
|
682
684
|
}
|
|
683
685
|
) : /* @__PURE__ */ i(
|
|
684
|
-
|
|
686
|
+
R,
|
|
685
687
|
{
|
|
686
|
-
text:
|
|
688
|
+
text: r,
|
|
687
689
|
className: "simple-mode-title",
|
|
688
690
|
duration: 2.5,
|
|
689
691
|
repeat: !0,
|
|
@@ -692,7 +694,7 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
692
694
|
}
|
|
693
695
|
)
|
|
694
696
|
},
|
|
695
|
-
|
|
697
|
+
n.item.progressItemId
|
|
696
698
|
) }) });
|
|
697
699
|
}, K = {
|
|
698
700
|
'code[class*="language-"]': {
|
|
@@ -845,10 +847,10 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
845
847
|
italic: {
|
|
846
848
|
fontStyle: "italic"
|
|
847
849
|
}
|
|
848
|
-
},
|
|
850
|
+
}, B = ({
|
|
849
851
|
text: e
|
|
850
852
|
}) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
851
|
-
|
|
853
|
+
T.div,
|
|
852
854
|
{
|
|
853
855
|
className: "fency-markdown-body-raw",
|
|
854
856
|
initial: { opacity: 0, y: -10 },
|
|
@@ -860,7 +862,7 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
860
862
|
remarkPlugins: [te],
|
|
861
863
|
components: {
|
|
862
864
|
code(t) {
|
|
863
|
-
const { children:
|
|
865
|
+
const { children: n, className: r, node: s, ref: d, ...o } = t, l = /language-(\w+)/.exec(r || "");
|
|
864
866
|
return l ? (
|
|
865
867
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
866
868
|
/* @__PURE__ */ i(
|
|
@@ -868,12 +870,12 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
868
870
|
{
|
|
869
871
|
...o,
|
|
870
872
|
PreTag: "div",
|
|
871
|
-
children: String(
|
|
873
|
+
children: String(n).replace(/\n$/, ""),
|
|
872
874
|
language: l[1],
|
|
873
875
|
style: K
|
|
874
876
|
}
|
|
875
877
|
)
|
|
876
|
-
) : /* @__PURE__ */ i("code", { ...o, className:
|
|
878
|
+
) : /* @__PURE__ */ i("code", { ...o, className: r, children: String(n) });
|
|
877
879
|
}
|
|
878
880
|
},
|
|
879
881
|
children: e
|
|
@@ -883,7 +885,7 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
883
885
|
) }), xe = ({ data: e }) => {
|
|
884
886
|
const t = JSON.stringify(e.json, null, 2);
|
|
885
887
|
return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
|
|
886
|
-
|
|
888
|
+
T.div,
|
|
887
889
|
{
|
|
888
890
|
initial: { opacity: 0, y: -10 },
|
|
889
891
|
animate: { opacity: 1, y: 0 },
|
|
@@ -913,7 +915,11 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
913
915
|
pageTwo: "pages {a} and {b}",
|
|
914
916
|
pageMultiple: "pages {list} and {n}",
|
|
915
917
|
clickToCollapse: "Click to collapse",
|
|
916
|
-
clickToExpand: "Click to expand"
|
|
918
|
+
clickToExpand: "Click to expand",
|
|
919
|
+
chunkFound: "1 chunk found",
|
|
920
|
+
chunksFound: "{n} chunks found",
|
|
921
|
+
chunksRetrieved: "Chunks retrieved",
|
|
922
|
+
scoreLabel: "score: {n}"
|
|
917
923
|
},
|
|
918
924
|
no: {
|
|
919
925
|
error: "Feil",
|
|
@@ -936,23 +942,27 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
936
942
|
pageTwo: "side {a} og {b}",
|
|
937
943
|
pageMultiple: "side {list} og {n}",
|
|
938
944
|
clickToCollapse: "Klikk for å skjule",
|
|
939
|
-
clickToExpand: "Klikk for å utvide"
|
|
945
|
+
clickToExpand: "Klikk for å utvide",
|
|
946
|
+
chunkFound: "1 del funnet",
|
|
947
|
+
chunksFound: "{n} deler funnet",
|
|
948
|
+
chunksRetrieved: "Deler hentet",
|
|
949
|
+
scoreLabel: "poeng: {n}"
|
|
940
950
|
}
|
|
941
951
|
};
|
|
942
952
|
function Ee(e) {
|
|
943
953
|
return Ce[e];
|
|
944
954
|
}
|
|
945
|
-
function
|
|
955
|
+
function x(e, t) {
|
|
946
956
|
return Object.entries(t).reduce(
|
|
947
|
-
(
|
|
957
|
+
(n, [r, s]) => n.replace(`{${r}}`, String(s)),
|
|
948
958
|
e
|
|
949
959
|
);
|
|
950
960
|
}
|
|
951
|
-
const we = ({ data: e, isLatest: t = !1, durationSeconds:
|
|
952
|
-
const s = `${
|
|
953
|
-
return /* @__PURE__ */
|
|
961
|
+
const we = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
|
|
962
|
+
const s = `${r.searchingPrefix}${e.queryDescription}`;
|
|
963
|
+
return /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
|
|
954
964
|
/* @__PURE__ */ i(
|
|
955
|
-
|
|
965
|
+
T.div,
|
|
956
966
|
{
|
|
957
967
|
style: {
|
|
958
968
|
display: "flex",
|
|
@@ -963,8 +973,8 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
963
973
|
initial: { opacity: 0, y: -10 },
|
|
964
974
|
animate: { opacity: 1, y: 0 },
|
|
965
975
|
transition: { duration: 0.3, delay: 0 },
|
|
966
|
-
children: t && !
|
|
967
|
-
|
|
976
|
+
children: t && !n ? /* @__PURE__ */ i(
|
|
977
|
+
R,
|
|
968
978
|
{
|
|
969
979
|
text: s,
|
|
970
980
|
duration: 2.5,
|
|
@@ -975,7 +985,7 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
975
985
|
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: s })
|
|
976
986
|
}
|
|
977
987
|
),
|
|
978
|
-
|
|
988
|
+
n !== void 0 && /* @__PURE__ */ i(
|
|
979
989
|
"div",
|
|
980
990
|
{
|
|
981
991
|
style: {
|
|
@@ -984,15 +994,15 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
984
994
|
marginTop: "4px",
|
|
985
995
|
fontStyle: "italic"
|
|
986
996
|
},
|
|
987
|
-
children:
|
|
997
|
+
children: x(r.tookSeconds, { n })
|
|
988
998
|
}
|
|
989
999
|
)
|
|
990
1000
|
] });
|
|
991
|
-
}, Ae = ({ isLatest: e = !1, durationSeconds: t, t:
|
|
992
|
-
const
|
|
993
|
-
return /* @__PURE__ */
|
|
1001
|
+
}, Ae = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
|
|
1002
|
+
const r = n.addingSources;
|
|
1003
|
+
return /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
|
|
994
1004
|
/* @__PURE__ */ i(
|
|
995
|
-
|
|
1005
|
+
T.div,
|
|
996
1006
|
{
|
|
997
1007
|
style: {
|
|
998
1008
|
display: "flex",
|
|
@@ -1004,15 +1014,15 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
1004
1014
|
animate: { opacity: 1, y: 0 },
|
|
1005
1015
|
transition: { duration: 0.3, delay: 0 },
|
|
1006
1016
|
children: e && !t ? /* @__PURE__ */ i(
|
|
1007
|
-
|
|
1017
|
+
R,
|
|
1008
1018
|
{
|
|
1009
|
-
text:
|
|
1019
|
+
text: r,
|
|
1010
1020
|
duration: 2.5,
|
|
1011
1021
|
repeat: !0,
|
|
1012
1022
|
color: "#999",
|
|
1013
1023
|
shimmerColor: "#000"
|
|
1014
1024
|
}
|
|
1015
|
-
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1025
|
+
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: r })
|
|
1016
1026
|
}
|
|
1017
1027
|
),
|
|
1018
1028
|
t !== void 0 && /* @__PURE__ */ i(
|
|
@@ -1024,7 +1034,7 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
1024
1034
|
marginTop: "4px",
|
|
1025
1035
|
fontStyle: "italic"
|
|
1026
1036
|
},
|
|
1027
|
-
children:
|
|
1037
|
+
children: x(n.tookSeconds, { n: t })
|
|
1028
1038
|
}
|
|
1029
1039
|
)
|
|
1030
1040
|
] });
|
|
@@ -1032,18 +1042,18 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
1032
1042
|
function Ie(e, t) {
|
|
1033
1043
|
if (e.length === 0) return "";
|
|
1034
1044
|
if (e.length === 1)
|
|
1035
|
-
return
|
|
1045
|
+
return x(t.pageSingle, { n: e[0] });
|
|
1036
1046
|
if (e.length === 2)
|
|
1037
|
-
return
|
|
1047
|
+
return x(t.pageTwo, {
|
|
1038
1048
|
a: e[0],
|
|
1039
1049
|
b: e[1]
|
|
1040
1050
|
});
|
|
1041
|
-
const
|
|
1042
|
-
return
|
|
1051
|
+
const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
|
|
1052
|
+
return x(t.pageMultiple, { list: r, n });
|
|
1043
1053
|
}
|
|
1044
|
-
const Me = ({ data: e, onSourceClick: t, t:
|
|
1054
|
+
const Me = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
|
|
1045
1055
|
/* @__PURE__ */ i(
|
|
1046
|
-
|
|
1056
|
+
T.div,
|
|
1047
1057
|
{
|
|
1048
1058
|
style: {
|
|
1049
1059
|
marginBottom: "10px",
|
|
@@ -1056,33 +1066,33 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1056
1066
|
initial: { opacity: 0, y: -10 },
|
|
1057
1067
|
animate: { opacity: 1, y: 0 },
|
|
1058
1068
|
transition: { duration: 0.3, delay: 0 },
|
|
1059
|
-
children:
|
|
1069
|
+
children: n.sources
|
|
1060
1070
|
}
|
|
1061
1071
|
),
|
|
1062
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children:
|
|
1072
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((r, s) => /* @__PURE__ */ i(
|
|
1063
1073
|
De,
|
|
1064
1074
|
{
|
|
1065
|
-
source:
|
|
1075
|
+
source: r,
|
|
1066
1076
|
index: s,
|
|
1067
1077
|
onSourceClick: t,
|
|
1068
|
-
t:
|
|
1078
|
+
t: n
|
|
1069
1079
|
},
|
|
1070
|
-
|
|
1080
|
+
r.memoryId
|
|
1071
1081
|
)) })
|
|
1072
1082
|
] }), De = ({
|
|
1073
1083
|
source: e,
|
|
1074
1084
|
index: t,
|
|
1075
|
-
onSourceClick:
|
|
1076
|
-
t:
|
|
1085
|
+
onSourceClick: n,
|
|
1086
|
+
t: r
|
|
1077
1087
|
}) => {
|
|
1078
|
-
const [s, d] =
|
|
1079
|
-
return /* @__PURE__ */
|
|
1080
|
-
|
|
1088
|
+
const [s, d] = C(!1), o = !!n, l = e.pageNumbers ?? [], u = Ie(l, r);
|
|
1089
|
+
return /* @__PURE__ */ v(
|
|
1090
|
+
T.div,
|
|
1081
1091
|
{
|
|
1082
1092
|
initial: { opacity: 0, scale: 0.9 },
|
|
1083
1093
|
animate: { opacity: 1, scale: 1 },
|
|
1084
1094
|
transition: { duration: 0.25, delay: t * 0.05 },
|
|
1085
|
-
onClick: o ? () =>
|
|
1095
|
+
onClick: o ? () => n(e.memoryId) : void 0,
|
|
1086
1096
|
onMouseEnter: o ? () => d(!0) : void 0,
|
|
1087
1097
|
onMouseLeave: o ? () => d(!1) : void 0,
|
|
1088
1098
|
style: {
|
|
@@ -1099,16 +1109,16 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1099
1109
|
},
|
|
1100
1110
|
children: [
|
|
1101
1111
|
/* @__PURE__ */ i("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1102
|
-
|
|
1112
|
+
u && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: u })
|
|
1103
1113
|
]
|
|
1104
1114
|
}
|
|
1105
1115
|
);
|
|
1106
1116
|
}, U = ({
|
|
1107
1117
|
color: e = "#78b13f",
|
|
1108
1118
|
size: t = 24,
|
|
1109
|
-
borderWidth:
|
|
1119
|
+
borderWidth: n = 7
|
|
1110
1120
|
}) => {
|
|
1111
|
-
const
|
|
1121
|
+
const r = t * 0.5;
|
|
1112
1122
|
return /* @__PURE__ */ i(
|
|
1113
1123
|
"span",
|
|
1114
1124
|
{
|
|
@@ -1116,26 +1126,26 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1116
1126
|
display: "inline-block",
|
|
1117
1127
|
transform: "rotate(45deg)",
|
|
1118
1128
|
height: t,
|
|
1119
|
-
width:
|
|
1120
|
-
borderBottom: `${
|
|
1121
|
-
borderRight: `${
|
|
1129
|
+
width: r,
|
|
1130
|
+
borderBottom: `${n}px solid ${e}`,
|
|
1131
|
+
borderRight: `${n}px solid ${e}`
|
|
1122
1132
|
}
|
|
1123
1133
|
}
|
|
1124
1134
|
);
|
|
1125
1135
|
}, Pe = ({
|
|
1126
1136
|
color: e = "#333",
|
|
1127
1137
|
size: t = 32,
|
|
1128
|
-
lineWidth:
|
|
1138
|
+
lineWidth: n = 2
|
|
1129
1139
|
}) => {
|
|
1130
|
-
const
|
|
1140
|
+
const r = t + 1, s = (t - n) / 2, d = (t - r) / 2, o = {
|
|
1131
1141
|
position: "absolute",
|
|
1132
1142
|
left: s,
|
|
1133
1143
|
top: d,
|
|
1134
|
-
width:
|
|
1135
|
-
height:
|
|
1144
|
+
width: n,
|
|
1145
|
+
height: r,
|
|
1136
1146
|
backgroundColor: e
|
|
1137
1147
|
};
|
|
1138
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ v(
|
|
1139
1149
|
"span",
|
|
1140
1150
|
{
|
|
1141
1151
|
style: {
|
|
@@ -1167,16 +1177,16 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1167
1177
|
}
|
|
1168
1178
|
);
|
|
1169
1179
|
};
|
|
1170
|
-
function
|
|
1180
|
+
function Re({
|
|
1171
1181
|
eventType: e,
|
|
1172
1182
|
completed: t
|
|
1173
1183
|
}) {
|
|
1174
1184
|
return e === "ExploreMemoryError" ? /* @__PURE__ */ i(Pe, { color: "#c62828", size: 15, lineWidth: 2 }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ i(U, { color: "#999", size: 15, borderWidth: 2 }) : e === "ExploreMemoryStart" ? t ? /* @__PURE__ */ i(U, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : null;
|
|
1175
1185
|
}
|
|
1176
|
-
const
|
|
1177
|
-
const [s, d] =
|
|
1178
|
-
return /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: /* @__PURE__ */
|
|
1179
|
-
|
|
1186
|
+
const z = 80, Fe = ({ data: e, completed: t, isLatest: n = !1, t: r }) => {
|
|
1187
|
+
const [s, d] = C(!1), o = e.eventType === "ExploreMemoryResult" ? e.result : void 0, l = o != null && o.length > z, u = o != null ? s || !l ? o : `${o.slice(0, z)}...` : void 0, a = l;
|
|
1188
|
+
return /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: /* @__PURE__ */ v(
|
|
1189
|
+
T.div,
|
|
1180
1190
|
{
|
|
1181
1191
|
initial: { opacity: 0 },
|
|
1182
1192
|
animate: { opacity: 1 },
|
|
@@ -1204,7 +1214,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1204
1214
|
width: 32
|
|
1205
1215
|
},
|
|
1206
1216
|
children: /* @__PURE__ */ i(
|
|
1207
|
-
|
|
1217
|
+
Re,
|
|
1208
1218
|
{
|
|
1209
1219
|
eventType: e.eventType,
|
|
1210
1220
|
completed: t
|
|
@@ -1212,7 +1222,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1212
1222
|
)
|
|
1213
1223
|
}
|
|
1214
1224
|
),
|
|
1215
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ v(
|
|
1216
1226
|
"div",
|
|
1217
1227
|
{
|
|
1218
1228
|
style: {
|
|
@@ -1229,7 +1239,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1229
1239
|
children: e.memoryTitle
|
|
1230
1240
|
}
|
|
1231
1241
|
),
|
|
1232
|
-
|
|
1242
|
+
u != null && /* @__PURE__ */ i(
|
|
1233
1243
|
"span",
|
|
1234
1244
|
{
|
|
1235
1245
|
style: {
|
|
@@ -1238,7 +1248,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1238
1248
|
lineHeight: 1.4,
|
|
1239
1249
|
whiteSpace: s ? "pre-wrap" : void 0
|
|
1240
1250
|
},
|
|
1241
|
-
children:
|
|
1251
|
+
children: u
|
|
1242
1252
|
}
|
|
1243
1253
|
),
|
|
1244
1254
|
a && /* @__PURE__ */ i(
|
|
@@ -1249,7 +1259,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1249
1259
|
color: "#999",
|
|
1250
1260
|
marginTop: 2
|
|
1251
1261
|
},
|
|
1252
|
-
children: s ?
|
|
1262
|
+
children: s ? r.clickToCollapse : r.clickToExpand
|
|
1253
1263
|
}
|
|
1254
1264
|
)
|
|
1255
1265
|
]
|
|
@@ -1258,8 +1268,124 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1258
1268
|
]
|
|
1259
1269
|
}
|
|
1260
1270
|
) });
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1271
|
+
};
|
|
1272
|
+
function Oe(e, t) {
|
|
1273
|
+
if (e.length === 0) return "";
|
|
1274
|
+
if (e.length === 1)
|
|
1275
|
+
return x(t.pageSingle, { n: e[0] });
|
|
1276
|
+
if (e.length === 2)
|
|
1277
|
+
return x(t.pageTwo, {
|
|
1278
|
+
a: e[0],
|
|
1279
|
+
b: e[1]
|
|
1280
|
+
});
|
|
1281
|
+
const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
|
|
1282
|
+
return x(t.pageMultiple, { list: r, n });
|
|
1283
|
+
}
|
|
1284
|
+
function Le(e, t) {
|
|
1285
|
+
return e === 1 ? t.chunkFound : x(t.chunksFound, { n: e });
|
|
1286
|
+
}
|
|
1287
|
+
const Be = ({ data: e, t }) => {
|
|
1288
|
+
const [n, r] = C(!1), s = e.chunks.length, d = s > 0;
|
|
1289
|
+
return /* @__PURE__ */ v("div", { style: { padding: "10px" }, children: [
|
|
1290
|
+
/* @__PURE__ */ v(
|
|
1291
|
+
T.div,
|
|
1292
|
+
{
|
|
1293
|
+
initial: { opacity: 0 },
|
|
1294
|
+
animate: { opacity: 1 },
|
|
1295
|
+
transition: { duration: 0.25 },
|
|
1296
|
+
onClick: d ? () => r((o) => !o) : void 0,
|
|
1297
|
+
style: {
|
|
1298
|
+
paddingBottom: n ? "12px" : 0,
|
|
1299
|
+
borderBottom: n ? "1px solid #eee" : void 0,
|
|
1300
|
+
display: "flex",
|
|
1301
|
+
flexDirection: "column",
|
|
1302
|
+
gap: "4px",
|
|
1303
|
+
minWidth: 0,
|
|
1304
|
+
cursor: d ? "pointer" : "default"
|
|
1305
|
+
},
|
|
1306
|
+
children: [
|
|
1307
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1308
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Le(s, t) }),
|
|
1309
|
+
d && /* @__PURE__ */ i(
|
|
1310
|
+
"span",
|
|
1311
|
+
{
|
|
1312
|
+
style: {
|
|
1313
|
+
fontSize: 11,
|
|
1314
|
+
color: "#999",
|
|
1315
|
+
marginTop: 2
|
|
1316
|
+
},
|
|
1317
|
+
children: n ? t.clickToCollapse : t.clickToExpand
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
]
|
|
1321
|
+
}
|
|
1322
|
+
),
|
|
1323
|
+
n && d && /* @__PURE__ */ i(
|
|
1324
|
+
T.div,
|
|
1325
|
+
{
|
|
1326
|
+
initial: { opacity: 0, height: 0 },
|
|
1327
|
+
animate: { opacity: 1, height: "auto" },
|
|
1328
|
+
transition: { duration: 0.2 },
|
|
1329
|
+
style: {
|
|
1330
|
+
maxHeight: 220,
|
|
1331
|
+
overflowY: "auto",
|
|
1332
|
+
marginTop: 12,
|
|
1333
|
+
display: "flex",
|
|
1334
|
+
flexDirection: "column",
|
|
1335
|
+
gap: 8
|
|
1336
|
+
},
|
|
1337
|
+
children: e.chunks.map((o, l) => {
|
|
1338
|
+
const u = o.pageNumbers ?? [], a = Oe(u, t);
|
|
1339
|
+
return /* @__PURE__ */ v(
|
|
1340
|
+
"div",
|
|
1341
|
+
{
|
|
1342
|
+
style: {
|
|
1343
|
+
padding: "8px 12px",
|
|
1344
|
+
borderRadius: 6,
|
|
1345
|
+
border: "1px solid #e0e0e0",
|
|
1346
|
+
backgroundColor: "#fafafa"
|
|
1347
|
+
},
|
|
1348
|
+
children: [
|
|
1349
|
+
/* @__PURE__ */ i(
|
|
1350
|
+
"span",
|
|
1351
|
+
{
|
|
1352
|
+
style: {
|
|
1353
|
+
fontSize: 12,
|
|
1354
|
+
color: "#333",
|
|
1355
|
+
lineHeight: 1.4,
|
|
1356
|
+
display: "block",
|
|
1357
|
+
marginBottom: 4
|
|
1358
|
+
},
|
|
1359
|
+
children: o.content
|
|
1360
|
+
}
|
|
1361
|
+
),
|
|
1362
|
+
/* @__PURE__ */ v(
|
|
1363
|
+
"div",
|
|
1364
|
+
{
|
|
1365
|
+
style: {
|
|
1366
|
+
display: "flex",
|
|
1367
|
+
gap: 8,
|
|
1368
|
+
fontSize: 11,
|
|
1369
|
+
color: "#666"
|
|
1370
|
+
},
|
|
1371
|
+
children: [
|
|
1372
|
+
a && /* @__PURE__ */ i("span", { children: a }),
|
|
1373
|
+
/* @__PURE__ */ i("span", { children: x(t.scoreLabel, {
|
|
1374
|
+
n: o.score
|
|
1375
|
+
}) })
|
|
1376
|
+
]
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
]
|
|
1380
|
+
},
|
|
1381
|
+
l
|
|
1382
|
+
);
|
|
1383
|
+
})
|
|
1384
|
+
}
|
|
1385
|
+
)
|
|
1386
|
+
] });
|
|
1387
|
+
}, Ue = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
1388
|
+
T.div,
|
|
1263
1389
|
{
|
|
1264
1390
|
initial: { opacity: 0, y: -10 },
|
|
1265
1391
|
animate: { opacity: 1, y: 0 },
|
|
@@ -1281,26 +1407,26 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1281
1407
|
}
|
|
1282
1408
|
)
|
|
1283
1409
|
}
|
|
1284
|
-
) }),
|
|
1410
|
+
) }), ze = ({
|
|
1285
1411
|
progressViewItems: e,
|
|
1286
1412
|
loadingText: t,
|
|
1287
|
-
t:
|
|
1288
|
-
onSourceClick:
|
|
1413
|
+
t: n,
|
|
1414
|
+
onSourceClick: r
|
|
1289
1415
|
}) => {
|
|
1290
|
-
const s =
|
|
1291
|
-
|
|
1416
|
+
const s = A(null);
|
|
1417
|
+
w(() => {
|
|
1292
1418
|
s.current && (s.current.scrollTop = s.current.scrollHeight);
|
|
1293
1419
|
}, [e.length]);
|
|
1294
1420
|
const d = (o) => {
|
|
1295
1421
|
const l = o.item.data;
|
|
1296
1422
|
if (l.taskType === "StreamingChatCompletion" && l.eventType === "Text")
|
|
1297
|
-
return /* @__PURE__ */ i(
|
|
1423
|
+
return /* @__PURE__ */ i(B, { text: l.text });
|
|
1298
1424
|
if (l.taskType === "StructuredChatCompletion" && l.eventType === "Json")
|
|
1299
1425
|
return /* @__PURE__ */ i(xe, { data: l });
|
|
1300
1426
|
if (l.taskType === "MemoryChatCompletion")
|
|
1301
1427
|
switch (l.eventType) {
|
|
1302
1428
|
case "Text":
|
|
1303
|
-
return /* @__PURE__ */ i(
|
|
1429
|
+
return /* @__PURE__ */ i(B, { text: l.text });
|
|
1304
1430
|
case "Search":
|
|
1305
1431
|
return /* @__PURE__ */ i(
|
|
1306
1432
|
we,
|
|
@@ -1308,7 +1434,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1308
1434
|
data: l,
|
|
1309
1435
|
isLatest: o.isLatest,
|
|
1310
1436
|
durationSeconds: o.durationSeconds,
|
|
1311
|
-
t:
|
|
1437
|
+
t: n
|
|
1312
1438
|
}
|
|
1313
1439
|
);
|
|
1314
1440
|
case "FindSources":
|
|
@@ -1318,7 +1444,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1318
1444
|
data: l,
|
|
1319
1445
|
isLatest: o.isLatest,
|
|
1320
1446
|
durationSeconds: o.durationSeconds,
|
|
1321
|
-
t:
|
|
1447
|
+
t: n
|
|
1322
1448
|
}
|
|
1323
1449
|
);
|
|
1324
1450
|
case "SourcesResult":
|
|
@@ -1326,39 +1452,41 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1326
1452
|
Me,
|
|
1327
1453
|
{
|
|
1328
1454
|
data: l,
|
|
1329
|
-
onSourceClick:
|
|
1330
|
-
t:
|
|
1455
|
+
onSourceClick: r,
|
|
1456
|
+
t: n
|
|
1331
1457
|
}
|
|
1332
1458
|
);
|
|
1333
1459
|
case "ExploreMemoryStart":
|
|
1334
1460
|
case "ExploreMemoryResult":
|
|
1335
1461
|
case "ExploreMemoryError":
|
|
1336
1462
|
return /* @__PURE__ */ i(
|
|
1337
|
-
|
|
1463
|
+
Fe,
|
|
1338
1464
|
{
|
|
1339
1465
|
data: l,
|
|
1340
1466
|
completed: o.completed,
|
|
1341
1467
|
isLatest: o.isLatest,
|
|
1342
|
-
t:
|
|
1468
|
+
t: n
|
|
1343
1469
|
}
|
|
1344
1470
|
);
|
|
1471
|
+
case "ChunkResult":
|
|
1472
|
+
return /* @__PURE__ */ i(Be, { data: l, t: n });
|
|
1345
1473
|
case "Completed":
|
|
1346
1474
|
return null;
|
|
1347
1475
|
}
|
|
1348
|
-
return l.taskType === "StreamingChatCompletion" && l.eventType === "Completed" || l.taskType === "StructuredChatCompletion" && l.eventType === "Completed" ? null : l.eventType === "Error" && "message" in l ? /* @__PURE__ */ i(
|
|
1476
|
+
return l.taskType === "StreamingChatCompletion" && l.eventType === "Completed" || l.taskType === "StructuredChatCompletion" && l.eventType === "Completed" ? null : l.eventType === "Error" && "message" in l ? /* @__PURE__ */ i(Ue, { message: l.message }) : null;
|
|
1349
1477
|
};
|
|
1350
1478
|
return e.length === 0 ? /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
|
|
1351
|
-
|
|
1479
|
+
R,
|
|
1352
1480
|
{
|
|
1353
|
-
text: t ??
|
|
1481
|
+
text: t ?? n.processingYourTask,
|
|
1354
1482
|
duration: 1.5,
|
|
1355
1483
|
repeat: !0,
|
|
1356
1484
|
repeatDelay: 0,
|
|
1357
1485
|
color: "#999",
|
|
1358
1486
|
shimmerColor: "#000"
|
|
1359
1487
|
}
|
|
1360
|
-
) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(
|
|
1361
|
-
|
|
1488
|
+
) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(W, { children: e.map((o, l) => /* @__PURE__ */ i(
|
|
1489
|
+
T.div,
|
|
1362
1490
|
{
|
|
1363
1491
|
id: `agent-task-progress-item-${o.item.progressItemId}`,
|
|
1364
1492
|
initial: { opacity: 0, y: -20 },
|
|
@@ -1372,33 +1500,33 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1372
1500
|
},
|
|
1373
1501
|
o.item.progressItemId
|
|
1374
1502
|
)) }) });
|
|
1375
|
-
},
|
|
1503
|
+
}, Ve = ({
|
|
1376
1504
|
agentTask: e,
|
|
1377
1505
|
mode: t = "verbose",
|
|
1378
|
-
language:
|
|
1379
|
-
onSourceClick:
|
|
1506
|
+
language: n,
|
|
1507
|
+
onSourceClick: r
|
|
1380
1508
|
}) => {
|
|
1381
|
-
const s =
|
|
1509
|
+
const s = Te(e), d = e.params.type === "MemoryChatCompletion" && "language" in e.params ? e.params.language ?? "en" : n ?? "en", o = Ee(d);
|
|
1382
1510
|
return t === "simple" ? /* @__PURE__ */ i(
|
|
1383
|
-
|
|
1511
|
+
be,
|
|
1384
1512
|
{
|
|
1385
1513
|
progressViewItems: s,
|
|
1386
1514
|
t: o
|
|
1387
1515
|
}
|
|
1388
1516
|
) : /* @__PURE__ */ i(
|
|
1389
|
-
|
|
1517
|
+
ze,
|
|
1390
1518
|
{
|
|
1391
1519
|
progressViewItems: s,
|
|
1392
1520
|
loadingText: e.loadingText,
|
|
1393
1521
|
t: o,
|
|
1394
|
-
onSourceClick:
|
|
1522
|
+
onSourceClick: r
|
|
1395
1523
|
}
|
|
1396
1524
|
);
|
|
1397
1525
|
};
|
|
1398
1526
|
export {
|
|
1399
|
-
|
|
1527
|
+
Ve as AgentTaskProgress,
|
|
1400
1528
|
U as Checkmark,
|
|
1401
|
-
|
|
1529
|
+
Ge as FencyProvider,
|
|
1402
1530
|
Pe as XMark,
|
|
1403
|
-
|
|
1531
|
+
Je as useAgentTasks
|
|
1404
1532
|
};
|