@fencyai/react 0.1.138 → 0.1.140
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/hooks/useAgentTasks/index.d.ts.map +1 -1
- package/dist/index.js +500 -364
- 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 m = 0;
|
|
23
|
+
for (; n < l; ) {
|
|
24
|
+
s && (t[n] === 10 && (m = ++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 - m);
|
|
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(m, a), r), m = n, r = -1;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
m === l ? t = void 0 : m !== 0 && (t = t.subarray(m), n -= m);
|
|
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 m = s.decode(o.subarray(0, l)), a = l + (o[l + 1] === 32 ? 2 : 1), c = s.decode(o.subarray(a));
|
|
52
|
+
switch (m) {
|
|
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 y = parseInt(c, 10);
|
|
65
|
+
isNaN(y) || t(r.retry = y);
|
|
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
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
|
|
93
|
+
var { signal: n, headers: r, onopen: s, onmessage: d, onclose: o, onerror: l, openWhenHidden: m, fetch: a } = t, c = ie(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((y, g) => {
|
|
95
|
+
const h = Object.assign({}, r);
|
|
96
|
+
h.accept || (h.accept = F);
|
|
97
|
+
let u;
|
|
98
|
+
function p() {
|
|
99
|
+
u.abort(), document.hidden || E();
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange",
|
|
101
|
+
m || document.addEventListener("visibilitychange", p);
|
|
102
|
+
let f = se, S = 0;
|
|
103
|
+
function k() {
|
|
104
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), u.abort();
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
n == null || n.addEventListener("abort", () => {
|
|
107
|
+
k(), y();
|
|
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
|
+
u = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const
|
|
115
|
-
await I
|
|
116
|
-
b ?
|
|
114
|
+
const I = await P(e, Object.assign(Object.assign({}, c), { headers: h, signal: u.signal }));
|
|
115
|
+
await M(I), await ne(I.body, re(oe((b) => {
|
|
116
|
+
b ? h[L] = b : delete h[L];
|
|
117
117
|
}, (b) => {
|
|
118
|
-
|
|
119
|
-
}, d))), o == null || o(),
|
|
120
|
-
} catch (
|
|
121
|
-
if (!
|
|
118
|
+
f = b;
|
|
119
|
+
}, d))), o == null || o(), k(), y();
|
|
120
|
+
} catch (I) {
|
|
121
|
+
if (!u.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 : f;
|
|
124
|
+
window.clearTimeout(S), S = window.setTimeout(E, b);
|
|
125
125
|
} catch (b) {
|
|
126
|
-
|
|
126
|
+
k(), g(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, m] = C(null), [a, c] = C([]), y = A(null), g = A(null);
|
|
223
|
+
w(() => {
|
|
224
|
+
e.then((f) => {
|
|
225
|
+
s(f), o(!1);
|
|
226
|
+
}).catch((f) => {
|
|
227
|
+
m(f), o(!1);
|
|
228
228
|
});
|
|
229
|
-
}, [e]),
|
|
230
|
-
|
|
231
|
-
}, [
|
|
232
|
-
|
|
233
|
-
}, [a]),
|
|
234
|
-
var
|
|
235
|
-
(
|
|
229
|
+
}, [e]), w(() => {
|
|
230
|
+
r && !g.current && (g.current = new ue(r));
|
|
231
|
+
}, [r]), w(() => {
|
|
232
|
+
g.current && g.current.updateStreams(a);
|
|
233
|
+
}, [a]), w(() => () => {
|
|
234
|
+
var f;
|
|
235
|
+
(f = g.current) == null || f.cleanup();
|
|
236
236
|
}, []);
|
|
237
|
-
const
|
|
238
|
-
async (
|
|
239
|
-
if (
|
|
240
|
-
return
|
|
241
|
-
const S = Date.now(),
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
237
|
+
const h = _(
|
|
238
|
+
async (f = 3e4) => {
|
|
239
|
+
if (y.current)
|
|
240
|
+
return y.current;
|
|
241
|
+
const S = Date.now(), k = a.length > 0 ? a[a.length - 1] : null;
|
|
242
|
+
if (k && S - k.createdAt < f)
|
|
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
|
+
}), y.current = null, E.stream;
|
|
261
261
|
} else
|
|
262
|
-
throw
|
|
262
|
+
throw y.current = null, new Error("Failed to create stream");
|
|
263
263
|
})();
|
|
264
|
-
return
|
|
264
|
+
return y.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 u = 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:
|
|
282
|
-
getOrCreateStream:
|
|
280
|
+
latestStream: u,
|
|
281
|
+
eventManager: g.current,
|
|
282
|
+
getOrCreateStream: h
|
|
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: (m, a) => {
|
|
321
|
+
var y, g, h;
|
|
322
|
+
const c = ye(m);
|
|
323
323
|
if (c)
|
|
324
324
|
switch (c.type) {
|
|
325
325
|
case "STREAM_TIMEOUT":
|
|
326
|
-
(
|
|
326
|
+
(y = e == null ? void 0 : e.onStreamTimeout) == null || y.call(e, c);
|
|
327
327
|
break;
|
|
328
328
|
case "STREAM_NOT_FOUND":
|
|
329
|
-
(
|
|
329
|
+
(g = e == null ? void 0 : e.onStreamNotFound) == null || g.call(e, c);
|
|
330
330
|
break;
|
|
331
331
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
332
|
-
(
|
|
332
|
+
(h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, c);
|
|
333
333
|
break;
|
|
334
334
|
}
|
|
335
335
|
},
|
|
336
|
-
onError: (
|
|
336
|
+
onError: (m) => {
|
|
337
337
|
var a;
|
|
338
338
|
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
|
|
339
|
-
streamId:
|
|
339
|
+
streamId: m,
|
|
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,47 +366,55 @@ 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 g;
|
|
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") {
|
|
378
|
-
|
|
378
|
+
r(
|
|
379
|
+
(u) => u.map(
|
|
380
|
+
(p) => {
|
|
381
|
+
var f;
|
|
382
|
+
return ((f = p.confirmedData) == null ? void 0 : f.taskId) === a.agentTaskId ? { ...p, loading: !1 } : p;
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
);
|
|
386
|
+
const h = d.current.get(
|
|
379
387
|
a.agentTaskId
|
|
380
388
|
);
|
|
381
|
-
|
|
389
|
+
h && (d.current.delete(a.agentTaskId), h(c));
|
|
382
390
|
return;
|
|
383
391
|
}
|
|
384
|
-
(
|
|
385
|
-
(
|
|
392
|
+
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, a), r(
|
|
393
|
+
(h) => h.map((u) => {
|
|
386
394
|
var S;
|
|
387
|
-
if (((S =
|
|
388
|
-
return
|
|
389
|
-
const
|
|
390
|
-
(
|
|
391
|
-
) ?
|
|
392
|
-
(
|
|
393
|
-
) : [...
|
|
394
|
-
return { ...
|
|
395
|
+
if (((S = u.confirmedData) == null ? void 0 : S.taskId) !== a.agentTaskId)
|
|
396
|
+
return u;
|
|
397
|
+
const f = u.progressItems.some(
|
|
398
|
+
(k) => k.progressItemId === a.progressItemId
|
|
399
|
+
) ? u.progressItems.map(
|
|
400
|
+
(k) => k.progressItemId === a.progressItemId ? a : k
|
|
401
|
+
) : [...u.progressItems, a];
|
|
402
|
+
return { ...u, progressItems: f };
|
|
395
403
|
})
|
|
396
404
|
);
|
|
397
405
|
},
|
|
398
406
|
onStreamError: (a) => {
|
|
399
407
|
var c;
|
|
400
|
-
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a),
|
|
401
|
-
const
|
|
402
|
-
return
|
|
403
|
-
...
|
|
408
|
+
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a), r((y) => {
|
|
409
|
+
const g = y.find((h) => h.streamId === a.streamId);
|
|
410
|
+
return g ? [
|
|
411
|
+
...y.filter((h) => h.streamId !== a.streamId),
|
|
404
412
|
{
|
|
405
|
-
...
|
|
413
|
+
...g,
|
|
406
414
|
loading: !1,
|
|
407
415
|
error: a.error
|
|
408
416
|
}
|
|
409
|
-
] :
|
|
417
|
+
] : y;
|
|
410
418
|
});
|
|
411
419
|
},
|
|
412
420
|
onStreamNotFound: (a) => {
|
|
@@ -419,13 +427,13 @@ const ye = (e) => {
|
|
|
419
427
|
}
|
|
420
428
|
}), l = _(
|
|
421
429
|
async (a, c) => {
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
|
|
425
|
-
...
|
|
430
|
+
const y = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = await o();
|
|
431
|
+
if (g.type === "success") {
|
|
432
|
+
r([
|
|
433
|
+
...n,
|
|
426
434
|
{
|
|
427
|
-
taskKey:
|
|
428
|
-
streamId:
|
|
435
|
+
taskKey: y,
|
|
436
|
+
streamId: g.stream.id,
|
|
429
437
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
430
438
|
confirmedData: null,
|
|
431
439
|
error: null,
|
|
@@ -435,11 +443,11 @@ const ye = (e) => {
|
|
|
435
443
|
loadingText: c == null ? void 0 : c.loadingText
|
|
436
444
|
}
|
|
437
445
|
]);
|
|
438
|
-
const { clientToken:
|
|
446
|
+
const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(a.type), u = await Y({
|
|
439
447
|
pk: t.fency.publishableKey,
|
|
440
448
|
baseUrl: t.fency.baseUrl,
|
|
441
|
-
clientToken:
|
|
442
|
-
streamToken:
|
|
449
|
+
clientToken: h,
|
|
450
|
+
streamToken: g.stream.token,
|
|
443
451
|
request: {
|
|
444
452
|
streamingChatCompletionTask: a.type === "StreamingChatCompletion" ? {
|
|
445
453
|
messages: a.messages,
|
|
@@ -459,50 +467,50 @@ const ye = (e) => {
|
|
|
459
467
|
} : void 0
|
|
460
468
|
}
|
|
461
469
|
});
|
|
462
|
-
if (
|
|
470
|
+
if (u.type === "success" && u.agentTask) {
|
|
463
471
|
s.current.add(
|
|
464
|
-
|
|
465
|
-
),
|
|
466
|
-
...
|
|
472
|
+
u.agentTask.id
|
|
473
|
+
), r((f) => [
|
|
474
|
+
...f.filter((S) => S.taskKey !== y),
|
|
467
475
|
{
|
|
468
|
-
taskKey:
|
|
469
|
-
streamId:
|
|
476
|
+
taskKey: y,
|
|
477
|
+
streamId: g.stream.id,
|
|
470
478
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
|
-
taskId:
|
|
472
|
-
createdAt:
|
|
479
|
+
taskId: u.agentTask.id,
|
|
480
|
+
createdAt: u.agentTask.createdAt,
|
|
473
481
|
error: null,
|
|
474
482
|
params: a,
|
|
475
483
|
progressItems: [],
|
|
476
484
|
loading: !0,
|
|
477
485
|
loadingText: c == null ? void 0 : c.loadingText,
|
|
478
486
|
confirmedData: {
|
|
479
|
-
taskId:
|
|
480
|
-
createdAt:
|
|
487
|
+
taskId: u.agentTask.id,
|
|
488
|
+
createdAt: u.agentTask.createdAt
|
|
481
489
|
}
|
|
482
490
|
}
|
|
483
491
|
]);
|
|
484
|
-
const
|
|
492
|
+
const p = await new Promise((f) => {
|
|
485
493
|
d.current.set(
|
|
486
|
-
|
|
487
|
-
|
|
494
|
+
u.agentTask.id,
|
|
495
|
+
f
|
|
488
496
|
);
|
|
489
497
|
});
|
|
490
498
|
return {
|
|
491
499
|
type: "success",
|
|
492
|
-
streamId:
|
|
493
|
-
agentTaskId:
|
|
494
|
-
response:
|
|
500
|
+
streamId: g.stream.id,
|
|
501
|
+
agentTaskId: u.agentTask.id,
|
|
502
|
+
response: p
|
|
495
503
|
};
|
|
496
504
|
} else {
|
|
497
|
-
if (
|
|
498
|
-
return
|
|
499
|
-
...
|
|
505
|
+
if (u.type === "error")
|
|
506
|
+
return r((p) => [
|
|
507
|
+
...p.filter((f) => f.taskKey !== y),
|
|
500
508
|
{
|
|
501
|
-
taskKey:
|
|
509
|
+
taskKey: y,
|
|
502
510
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
503
|
-
streamId:
|
|
511
|
+
streamId: g.stream.id,
|
|
504
512
|
params: a,
|
|
505
|
-
error:
|
|
513
|
+
error: u.error,
|
|
506
514
|
progressItems: [],
|
|
507
515
|
loading: !1,
|
|
508
516
|
loadingText: c == null ? void 0 : c.loadingText,
|
|
@@ -510,20 +518,20 @@ const ye = (e) => {
|
|
|
510
518
|
}
|
|
511
519
|
]), {
|
|
512
520
|
type: "error",
|
|
513
|
-
error:
|
|
521
|
+
error: u.error
|
|
514
522
|
};
|
|
515
523
|
{
|
|
516
|
-
const
|
|
524
|
+
const p = {
|
|
517
525
|
message: "No response received",
|
|
518
526
|
code: "UnknownError"
|
|
519
527
|
};
|
|
520
|
-
return
|
|
521
|
-
...
|
|
528
|
+
return r((f) => [
|
|
529
|
+
...f.filter((S) => S.taskKey !== y),
|
|
522
530
|
{
|
|
523
|
-
taskKey:
|
|
531
|
+
taskKey: y,
|
|
524
532
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
525
|
-
streamId:
|
|
526
|
-
error:
|
|
533
|
+
streamId: g.stream.id,
|
|
534
|
+
error: p,
|
|
527
535
|
params: a,
|
|
528
536
|
progressItems: [],
|
|
529
537
|
loading: !1,
|
|
@@ -532,62 +540,62 @@ const ye = (e) => {
|
|
|
532
540
|
}
|
|
533
541
|
]), {
|
|
534
542
|
type: "error",
|
|
535
|
-
error:
|
|
543
|
+
error: p
|
|
536
544
|
};
|
|
537
545
|
}
|
|
538
546
|
}
|
|
539
547
|
} else
|
|
540
|
-
return console.error(
|
|
548
|
+
return console.error(g.error), g;
|
|
541
549
|
},
|
|
542
|
-
[t,
|
|
543
|
-
),
|
|
544
|
-
if (
|
|
545
|
-
return [...
|
|
546
|
-
}, [
|
|
547
|
-
return
|
|
550
|
+
[t, n, o]
|
|
551
|
+
), m = $(() => {
|
|
552
|
+
if (n.length !== 0)
|
|
553
|
+
return [...n].sort((a, c) => new Date(c.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
|
|
554
|
+
}, [n]);
|
|
555
|
+
return w(() => () => {
|
|
548
556
|
s.current.clear(), d.current.clear();
|
|
549
557
|
}, []), {
|
|
550
|
-
agentTasks:
|
|
558
|
+
agentTasks: n,
|
|
551
559
|
createAgentTask: l,
|
|
552
|
-
latest:
|
|
560
|
+
latest: m
|
|
553
561
|
};
|
|
554
562
|
};
|
|
555
|
-
function
|
|
556
|
-
return e.progressItems.map((t,
|
|
557
|
-
const
|
|
563
|
+
function Te(e) {
|
|
564
|
+
return e.progressItems.map((t, n) => {
|
|
565
|
+
const r = e.progressItems[n + 1], s = r != null;
|
|
558
566
|
let d;
|
|
559
|
-
if (
|
|
560
|
-
const o = new Date(t.createdAt).getTime(), l = new Date(
|
|
567
|
+
if (r != null && r.createdAt) {
|
|
568
|
+
const o = new Date(t.createdAt).getTime(), l = new Date(r.createdAt).getTime();
|
|
561
569
|
d = Math.round((l - o) / 1e3);
|
|
562
570
|
}
|
|
563
571
|
return {
|
|
564
572
|
item: t,
|
|
565
573
|
completed: s,
|
|
566
|
-
isLatest:
|
|
574
|
+
isLatest: n === e.progressItems.length - 1,
|
|
567
575
|
durationSeconds: d
|
|
568
576
|
};
|
|
569
577
|
});
|
|
570
578
|
}
|
|
571
|
-
function
|
|
579
|
+
function R({
|
|
572
580
|
text: e,
|
|
573
581
|
duration: t = 2,
|
|
574
|
-
delay:
|
|
575
|
-
repeat:
|
|
582
|
+
delay: n = 0,
|
|
583
|
+
repeat: r = !0,
|
|
576
584
|
repeatDelay: s = 0.5,
|
|
577
585
|
className: d,
|
|
578
586
|
startOnView: o = !1,
|
|
579
587
|
once: l = !1,
|
|
580
|
-
inViewMargin:
|
|
588
|
+
inViewMargin: m,
|
|
581
589
|
spread: a = 2,
|
|
582
590
|
color: c = "#999",
|
|
583
|
-
shimmerColor:
|
|
584
|
-
direction:
|
|
591
|
+
shimmerColor: y = "#000",
|
|
592
|
+
direction: g = "fromBottom"
|
|
585
593
|
}) {
|
|
586
|
-
const
|
|
594
|
+
const h = A(null), u = Z(h, { once: l, margin: m }), p = $(() => e.length * a, [e, a]), f = !o || u, S = g === "fromBottom" ? "100% center" : "-100% center", k = g === "fromBottom" ? "0% center" : "200% center";
|
|
587
595
|
return /* @__PURE__ */ i(
|
|
588
|
-
|
|
596
|
+
T.span,
|
|
589
597
|
{
|
|
590
|
-
ref:
|
|
598
|
+
ref: h,
|
|
591
599
|
className: d,
|
|
592
600
|
style: {
|
|
593
601
|
position: "relative",
|
|
@@ -598,9 +606,9 @@ function O({
|
|
|
598
606
|
color: "transparent",
|
|
599
607
|
WebkitTextFillColor: "transparent",
|
|
600
608
|
backgroundRepeat: "no-repeat, padding-box",
|
|
601
|
-
"--spread": `${
|
|
609
|
+
"--spread": `${p}px`,
|
|
602
610
|
"--base-color": c,
|
|
603
|
-
"--shimmer-color":
|
|
611
|
+
"--shimmer-color": y,
|
|
604
612
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
605
613
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
606
614
|
},
|
|
@@ -608,41 +616,41 @@ function O({
|
|
|
608
616
|
backgroundPosition: S,
|
|
609
617
|
opacity: 0
|
|
610
618
|
},
|
|
611
|
-
animate:
|
|
612
|
-
backgroundPosition:
|
|
619
|
+
animate: f ? {
|
|
620
|
+
backgroundPosition: k,
|
|
613
621
|
opacity: 1
|
|
614
622
|
} : {},
|
|
615
623
|
transition: {
|
|
616
624
|
backgroundPosition: {
|
|
617
|
-
repeat:
|
|
625
|
+
repeat: r ? 1 / 0 : 0,
|
|
618
626
|
duration: t,
|
|
619
|
-
delay:
|
|
627
|
+
delay: n,
|
|
620
628
|
repeatDelay: s,
|
|
621
629
|
ease: "linear"
|
|
622
630
|
},
|
|
623
631
|
opacity: {
|
|
624
632
|
duration: 0.3,
|
|
625
|
-
delay:
|
|
633
|
+
delay: n
|
|
626
634
|
}
|
|
627
635
|
},
|
|
628
636
|
children: e
|
|
629
637
|
}
|
|
630
638
|
);
|
|
631
639
|
}
|
|
632
|
-
function
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
640
|
+
function ve(e, t) {
|
|
641
|
+
const n = e.item.data;
|
|
642
|
+
if (n.eventType === "Error" && "message" in n)
|
|
635
643
|
return t.error;
|
|
636
|
-
if (
|
|
637
|
-
if (
|
|
638
|
-
if (
|
|
644
|
+
if (n.taskType === "StreamingChatCompletion") {
|
|
645
|
+
if (n.eventType === "Text") return t.streaming;
|
|
646
|
+
if (n.eventType === "Completed") return t.completed;
|
|
639
647
|
}
|
|
640
|
-
if (
|
|
641
|
-
if (
|
|
642
|
-
if (
|
|
648
|
+
if (n.taskType === "StructuredChatCompletion") {
|
|
649
|
+
if (n.eventType === "Json") return t.generating;
|
|
650
|
+
if (n.eventType === "Completed") return t.completed;
|
|
643
651
|
}
|
|
644
|
-
if (
|
|
645
|
-
switch (
|
|
652
|
+
if (n.taskType === "MemoryChatCompletion")
|
|
653
|
+
switch (n.eventType) {
|
|
646
654
|
case "Text":
|
|
647
655
|
return t.streaming;
|
|
648
656
|
case "Search":
|
|
@@ -657,33 +665,35 @@ function be(e, t) {
|
|
|
657
665
|
return t.memoryExplored;
|
|
658
666
|
case "ExploreMemoryError":
|
|
659
667
|
return t.memoryExplorationFailed;
|
|
668
|
+
case "ChunkResult":
|
|
669
|
+
return t.chunksRetrieved;
|
|
660
670
|
case "Completed":
|
|
661
671
|
return t.completed;
|
|
662
672
|
}
|
|
663
673
|
return t.processing;
|
|
664
674
|
}
|
|
665
|
-
const
|
|
666
|
-
const
|
|
667
|
-
if (!
|
|
668
|
-
const
|
|
669
|
-
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(
|
|
670
|
-
|
|
675
|
+
const be = ({ progressViewItems: e, t }) => {
|
|
676
|
+
const n = e[e.length - 1];
|
|
677
|
+
if (!n) return null;
|
|
678
|
+
const r = ve(n, t);
|
|
679
|
+
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(W, { mode: "wait", children: /* @__PURE__ */ i(
|
|
680
|
+
T.div,
|
|
671
681
|
{
|
|
672
682
|
initial: { opacity: 0, y: 10 },
|
|
673
683
|
animate: { opacity: 1, y: 0 },
|
|
674
684
|
exit: { opacity: 0, y: -10 },
|
|
675
685
|
transition: { duration: 0.3 },
|
|
676
|
-
children:
|
|
686
|
+
children: n.completed ? /* @__PURE__ */ i(
|
|
677
687
|
"div",
|
|
678
688
|
{
|
|
679
689
|
className: "simple-mode-title",
|
|
680
690
|
style: { color: "#666" },
|
|
681
|
-
children:
|
|
691
|
+
children: r
|
|
682
692
|
}
|
|
683
693
|
) : /* @__PURE__ */ i(
|
|
684
|
-
|
|
694
|
+
R,
|
|
685
695
|
{
|
|
686
|
-
text:
|
|
696
|
+
text: r,
|
|
687
697
|
className: "simple-mode-title",
|
|
688
698
|
duration: 2.5,
|
|
689
699
|
repeat: !0,
|
|
@@ -692,7 +702,7 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
692
702
|
}
|
|
693
703
|
)
|
|
694
704
|
},
|
|
695
|
-
|
|
705
|
+
n.item.progressItemId
|
|
696
706
|
) }) });
|
|
697
707
|
}, K = {
|
|
698
708
|
'code[class*="language-"]': {
|
|
@@ -845,10 +855,10 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
845
855
|
italic: {
|
|
846
856
|
fontStyle: "italic"
|
|
847
857
|
}
|
|
848
|
-
},
|
|
858
|
+
}, B = ({
|
|
849
859
|
text: e
|
|
850
860
|
}) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
851
|
-
|
|
861
|
+
T.div,
|
|
852
862
|
{
|
|
853
863
|
className: "fency-markdown-body-raw",
|
|
854
864
|
initial: { opacity: 0, y: -10 },
|
|
@@ -860,7 +870,7 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
860
870
|
remarkPlugins: [te],
|
|
861
871
|
components: {
|
|
862
872
|
code(t) {
|
|
863
|
-
const { children:
|
|
873
|
+
const { children: n, className: r, node: s, ref: d, ...o } = t, l = /language-(\w+)/.exec(r || "");
|
|
864
874
|
return l ? (
|
|
865
875
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
866
876
|
/* @__PURE__ */ i(
|
|
@@ -868,12 +878,12 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
868
878
|
{
|
|
869
879
|
...o,
|
|
870
880
|
PreTag: "div",
|
|
871
|
-
children: String(
|
|
881
|
+
children: String(n).replace(/\n$/, ""),
|
|
872
882
|
language: l[1],
|
|
873
883
|
style: K
|
|
874
884
|
}
|
|
875
885
|
)
|
|
876
|
-
) : /* @__PURE__ */ i("code", { ...o, className:
|
|
886
|
+
) : /* @__PURE__ */ i("code", { ...o, className: r, children: String(n) });
|
|
877
887
|
}
|
|
878
888
|
},
|
|
879
889
|
children: e
|
|
@@ -883,7 +893,7 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
883
893
|
) }), xe = ({ data: e }) => {
|
|
884
894
|
const t = JSON.stringify(e.json, null, 2);
|
|
885
895
|
return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
|
|
886
|
-
|
|
896
|
+
T.div,
|
|
887
897
|
{
|
|
888
898
|
initial: { opacity: 0, y: -10 },
|
|
889
899
|
animate: { opacity: 1, y: 0 },
|
|
@@ -913,7 +923,11 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
913
923
|
pageTwo: "pages {a} and {b}",
|
|
914
924
|
pageMultiple: "pages {list} and {n}",
|
|
915
925
|
clickToCollapse: "Click to collapse",
|
|
916
|
-
clickToExpand: "Click to expand"
|
|
926
|
+
clickToExpand: "Click to expand",
|
|
927
|
+
chunkFound: "1 chunk found",
|
|
928
|
+
chunksFound: "{n} chunks found",
|
|
929
|
+
chunksRetrieved: "Chunks retrieved",
|
|
930
|
+
scoreLabel: "score: {n}"
|
|
917
931
|
},
|
|
918
932
|
no: {
|
|
919
933
|
error: "Feil",
|
|
@@ -936,23 +950,27 @@ const ve = ({ progressViewItems: e, t }) => {
|
|
|
936
950
|
pageTwo: "side {a} og {b}",
|
|
937
951
|
pageMultiple: "side {list} og {n}",
|
|
938
952
|
clickToCollapse: "Klikk for å skjule",
|
|
939
|
-
clickToExpand: "Klikk for å utvide"
|
|
953
|
+
clickToExpand: "Klikk for å utvide",
|
|
954
|
+
chunkFound: "1 del funnet",
|
|
955
|
+
chunksFound: "{n} deler funnet",
|
|
956
|
+
chunksRetrieved: "Deler hentet",
|
|
957
|
+
scoreLabel: "poeng: {n}"
|
|
940
958
|
}
|
|
941
959
|
};
|
|
942
960
|
function Ee(e) {
|
|
943
961
|
return Ce[e];
|
|
944
962
|
}
|
|
945
|
-
function
|
|
963
|
+
function x(e, t) {
|
|
946
964
|
return Object.entries(t).reduce(
|
|
947
|
-
(
|
|
965
|
+
(n, [r, s]) => n.replace(`{${r}}`, String(s)),
|
|
948
966
|
e
|
|
949
967
|
);
|
|
950
968
|
}
|
|
951
|
-
const we = ({ data: e, isLatest: t = !1, durationSeconds:
|
|
952
|
-
const s = `${
|
|
953
|
-
return /* @__PURE__ */
|
|
969
|
+
const we = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
|
|
970
|
+
const s = `${r.searchingPrefix}${e.queryDescription}`;
|
|
971
|
+
return /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
|
|
954
972
|
/* @__PURE__ */ i(
|
|
955
|
-
|
|
973
|
+
T.div,
|
|
956
974
|
{
|
|
957
975
|
style: {
|
|
958
976
|
display: "flex",
|
|
@@ -963,8 +981,8 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
963
981
|
initial: { opacity: 0, y: -10 },
|
|
964
982
|
animate: { opacity: 1, y: 0 },
|
|
965
983
|
transition: { duration: 0.3, delay: 0 },
|
|
966
|
-
children: t && !
|
|
967
|
-
|
|
984
|
+
children: t && !n ? /* @__PURE__ */ i(
|
|
985
|
+
R,
|
|
968
986
|
{
|
|
969
987
|
text: s,
|
|
970
988
|
duration: 2.5,
|
|
@@ -975,7 +993,7 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
975
993
|
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: s })
|
|
976
994
|
}
|
|
977
995
|
),
|
|
978
|
-
|
|
996
|
+
n !== void 0 && /* @__PURE__ */ i(
|
|
979
997
|
"div",
|
|
980
998
|
{
|
|
981
999
|
style: {
|
|
@@ -984,15 +1002,15 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
984
1002
|
marginTop: "4px",
|
|
985
1003
|
fontStyle: "italic"
|
|
986
1004
|
},
|
|
987
|
-
children:
|
|
1005
|
+
children: x(r.tookSeconds, { n })
|
|
988
1006
|
}
|
|
989
1007
|
)
|
|
990
1008
|
] });
|
|
991
|
-
}, Ae = ({ isLatest: e = !1, durationSeconds: t, t:
|
|
992
|
-
const
|
|
993
|
-
return /* @__PURE__ */
|
|
1009
|
+
}, Ae = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
|
|
1010
|
+
const r = n.addingSources;
|
|
1011
|
+
return /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
|
|
994
1012
|
/* @__PURE__ */ i(
|
|
995
|
-
|
|
1013
|
+
T.div,
|
|
996
1014
|
{
|
|
997
1015
|
style: {
|
|
998
1016
|
display: "flex",
|
|
@@ -1004,15 +1022,15 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
1004
1022
|
animate: { opacity: 1, y: 0 },
|
|
1005
1023
|
transition: { duration: 0.3, delay: 0 },
|
|
1006
1024
|
children: e && !t ? /* @__PURE__ */ i(
|
|
1007
|
-
|
|
1025
|
+
R,
|
|
1008
1026
|
{
|
|
1009
|
-
text:
|
|
1027
|
+
text: r,
|
|
1010
1028
|
duration: 2.5,
|
|
1011
1029
|
repeat: !0,
|
|
1012
1030
|
color: "#999",
|
|
1013
1031
|
shimmerColor: "#000"
|
|
1014
1032
|
}
|
|
1015
|
-
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1033
|
+
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: r })
|
|
1016
1034
|
}
|
|
1017
1035
|
),
|
|
1018
1036
|
t !== void 0 && /* @__PURE__ */ i(
|
|
@@ -1024,7 +1042,7 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
1024
1042
|
marginTop: "4px",
|
|
1025
1043
|
fontStyle: "italic"
|
|
1026
1044
|
},
|
|
1027
|
-
children:
|
|
1045
|
+
children: x(n.tookSeconds, { n: t })
|
|
1028
1046
|
}
|
|
1029
1047
|
)
|
|
1030
1048
|
] });
|
|
@@ -1032,18 +1050,18 @@ const we = ({ data: e, isLatest: t = !1, durationSeconds: r, t: n }) => {
|
|
|
1032
1050
|
function Ie(e, t) {
|
|
1033
1051
|
if (e.length === 0) return "";
|
|
1034
1052
|
if (e.length === 1)
|
|
1035
|
-
return
|
|
1053
|
+
return x(t.pageSingle, { n: e[0] });
|
|
1036
1054
|
if (e.length === 2)
|
|
1037
|
-
return
|
|
1055
|
+
return x(t.pageTwo, {
|
|
1038
1056
|
a: e[0],
|
|
1039
1057
|
b: e[1]
|
|
1040
1058
|
});
|
|
1041
|
-
const
|
|
1042
|
-
return
|
|
1059
|
+
const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
|
|
1060
|
+
return x(t.pageMultiple, { list: r, n });
|
|
1043
1061
|
}
|
|
1044
|
-
const Me = ({ data: e, onSourceClick: t, t:
|
|
1062
|
+
const Me = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
|
|
1045
1063
|
/* @__PURE__ */ i(
|
|
1046
|
-
|
|
1064
|
+
T.div,
|
|
1047
1065
|
{
|
|
1048
1066
|
style: {
|
|
1049
1067
|
marginBottom: "10px",
|
|
@@ -1056,33 +1074,33 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1056
1074
|
initial: { opacity: 0, y: -10 },
|
|
1057
1075
|
animate: { opacity: 1, y: 0 },
|
|
1058
1076
|
transition: { duration: 0.3, delay: 0 },
|
|
1059
|
-
children:
|
|
1077
|
+
children: n.sources
|
|
1060
1078
|
}
|
|
1061
1079
|
),
|
|
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:
|
|
1080
|
+
/* @__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
1081
|
De,
|
|
1064
1082
|
{
|
|
1065
|
-
source:
|
|
1083
|
+
source: r,
|
|
1066
1084
|
index: s,
|
|
1067
1085
|
onSourceClick: t,
|
|
1068
|
-
t:
|
|
1086
|
+
t: n
|
|
1069
1087
|
},
|
|
1070
|
-
|
|
1088
|
+
r.memoryId
|
|
1071
1089
|
)) })
|
|
1072
1090
|
] }), De = ({
|
|
1073
1091
|
source: e,
|
|
1074
1092
|
index: t,
|
|
1075
|
-
onSourceClick:
|
|
1076
|
-
t:
|
|
1093
|
+
onSourceClick: n,
|
|
1094
|
+
t: r
|
|
1077
1095
|
}) => {
|
|
1078
|
-
const [s, d] =
|
|
1079
|
-
return /* @__PURE__ */
|
|
1080
|
-
|
|
1096
|
+
const [s, d] = C(!1), o = !!n, l = e.pageNumbers ?? [], m = Ie(l, r);
|
|
1097
|
+
return /* @__PURE__ */ v(
|
|
1098
|
+
T.div,
|
|
1081
1099
|
{
|
|
1082
1100
|
initial: { opacity: 0, scale: 0.9 },
|
|
1083
1101
|
animate: { opacity: 1, scale: 1 },
|
|
1084
1102
|
transition: { duration: 0.25, delay: t * 0.05 },
|
|
1085
|
-
onClick: o ? () =>
|
|
1103
|
+
onClick: o ? () => n(e.memoryId) : void 0,
|
|
1086
1104
|
onMouseEnter: o ? () => d(!0) : void 0,
|
|
1087
1105
|
onMouseLeave: o ? () => d(!1) : void 0,
|
|
1088
1106
|
style: {
|
|
@@ -1099,16 +1117,16 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1099
1117
|
},
|
|
1100
1118
|
children: [
|
|
1101
1119
|
/* @__PURE__ */ i("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1102
|
-
|
|
1120
|
+
m && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: m })
|
|
1103
1121
|
]
|
|
1104
1122
|
}
|
|
1105
1123
|
);
|
|
1106
1124
|
}, U = ({
|
|
1107
1125
|
color: e = "#78b13f",
|
|
1108
1126
|
size: t = 24,
|
|
1109
|
-
borderWidth:
|
|
1127
|
+
borderWidth: n = 7
|
|
1110
1128
|
}) => {
|
|
1111
|
-
const
|
|
1129
|
+
const r = t * 0.5;
|
|
1112
1130
|
return /* @__PURE__ */ i(
|
|
1113
1131
|
"span",
|
|
1114
1132
|
{
|
|
@@ -1116,26 +1134,26 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1116
1134
|
display: "inline-block",
|
|
1117
1135
|
transform: "rotate(45deg)",
|
|
1118
1136
|
height: t,
|
|
1119
|
-
width:
|
|
1120
|
-
borderBottom: `${
|
|
1121
|
-
borderRight: `${
|
|
1137
|
+
width: r,
|
|
1138
|
+
borderBottom: `${n}px solid ${e}`,
|
|
1139
|
+
borderRight: `${n}px solid ${e}`
|
|
1122
1140
|
}
|
|
1123
1141
|
}
|
|
1124
1142
|
);
|
|
1125
1143
|
}, Pe = ({
|
|
1126
1144
|
color: e = "#333",
|
|
1127
1145
|
size: t = 32,
|
|
1128
|
-
lineWidth:
|
|
1146
|
+
lineWidth: n = 2
|
|
1129
1147
|
}) => {
|
|
1130
|
-
const
|
|
1148
|
+
const r = t + 1, s = (t - n) / 2, d = (t - r) / 2, o = {
|
|
1131
1149
|
position: "absolute",
|
|
1132
1150
|
left: s,
|
|
1133
1151
|
top: d,
|
|
1134
|
-
width:
|
|
1135
|
-
height:
|
|
1152
|
+
width: n,
|
|
1153
|
+
height: r,
|
|
1136
1154
|
backgroundColor: e
|
|
1137
1155
|
};
|
|
1138
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ v(
|
|
1139
1157
|
"span",
|
|
1140
1158
|
{
|
|
1141
1159
|
style: {
|
|
@@ -1167,16 +1185,16 @@ const Me = ({ data: e, onSourceClick: t, t: r }) => /* @__PURE__ */ x("div", { s
|
|
|
1167
1185
|
}
|
|
1168
1186
|
);
|
|
1169
1187
|
};
|
|
1170
|
-
function
|
|
1188
|
+
function Re({
|
|
1171
1189
|
eventType: e,
|
|
1172
1190
|
completed: t
|
|
1173
1191
|
}) {
|
|
1174
1192
|
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
1193
|
}
|
|
1176
|
-
const
|
|
1177
|
-
const [s, d] =
|
|
1178
|
-
return /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: /* @__PURE__ */
|
|
1179
|
-
|
|
1194
|
+
const z = 80, Fe = ({ data: e, completed: t, isLatest: n = !1, t: r }) => {
|
|
1195
|
+
const [s, d] = C(!1), o = e.eventType === "ExploreMemoryResult" ? e.result : void 0, l = o != null && o.length > z, m = o != null ? s || !l ? o : `${o.slice(0, z)}...` : void 0, a = l;
|
|
1196
|
+
return /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: /* @__PURE__ */ v(
|
|
1197
|
+
T.div,
|
|
1180
1198
|
{
|
|
1181
1199
|
initial: { opacity: 0 },
|
|
1182
1200
|
animate: { opacity: 1 },
|
|
@@ -1204,7 +1222,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1204
1222
|
width: 32
|
|
1205
1223
|
},
|
|
1206
1224
|
children: /* @__PURE__ */ i(
|
|
1207
|
-
|
|
1225
|
+
Re,
|
|
1208
1226
|
{
|
|
1209
1227
|
eventType: e.eventType,
|
|
1210
1228
|
completed: t
|
|
@@ -1212,7 +1230,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1212
1230
|
)
|
|
1213
1231
|
}
|
|
1214
1232
|
),
|
|
1215
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ v(
|
|
1216
1234
|
"div",
|
|
1217
1235
|
{
|
|
1218
1236
|
style: {
|
|
@@ -1229,7 +1247,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1229
1247
|
children: e.memoryTitle
|
|
1230
1248
|
}
|
|
1231
1249
|
),
|
|
1232
|
-
|
|
1250
|
+
m != null && /* @__PURE__ */ i(
|
|
1233
1251
|
"span",
|
|
1234
1252
|
{
|
|
1235
1253
|
style: {
|
|
@@ -1238,7 +1256,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1238
1256
|
lineHeight: 1.4,
|
|
1239
1257
|
whiteSpace: s ? "pre-wrap" : void 0
|
|
1240
1258
|
},
|
|
1241
|
-
children:
|
|
1259
|
+
children: m
|
|
1242
1260
|
}
|
|
1243
1261
|
),
|
|
1244
1262
|
a && /* @__PURE__ */ i(
|
|
@@ -1249,7 +1267,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1249
1267
|
color: "#999",
|
|
1250
1268
|
marginTop: 2
|
|
1251
1269
|
},
|
|
1252
|
-
children: s ?
|
|
1270
|
+
children: s ? r.clickToCollapse : r.clickToExpand
|
|
1253
1271
|
}
|
|
1254
1272
|
)
|
|
1255
1273
|
]
|
|
@@ -1258,8 +1276,124 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1258
1276
|
]
|
|
1259
1277
|
}
|
|
1260
1278
|
) });
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1279
|
+
};
|
|
1280
|
+
function Oe(e, t) {
|
|
1281
|
+
if (e.length === 0) return "";
|
|
1282
|
+
if (e.length === 1)
|
|
1283
|
+
return x(t.pageSingle, { n: e[0] });
|
|
1284
|
+
if (e.length === 2)
|
|
1285
|
+
return x(t.pageTwo, {
|
|
1286
|
+
a: e[0],
|
|
1287
|
+
b: e[1]
|
|
1288
|
+
});
|
|
1289
|
+
const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
|
|
1290
|
+
return x(t.pageMultiple, { list: r, n });
|
|
1291
|
+
}
|
|
1292
|
+
function Le(e, t) {
|
|
1293
|
+
return e === 1 ? t.chunkFound : x(t.chunksFound, { n: e });
|
|
1294
|
+
}
|
|
1295
|
+
const Be = ({ data: e, t }) => {
|
|
1296
|
+
const [n, r] = C(!1), s = e.chunks.length, d = s > 0;
|
|
1297
|
+
return /* @__PURE__ */ v("div", { style: { padding: "10px" }, children: [
|
|
1298
|
+
/* @__PURE__ */ v(
|
|
1299
|
+
T.div,
|
|
1300
|
+
{
|
|
1301
|
+
initial: { opacity: 0 },
|
|
1302
|
+
animate: { opacity: 1 },
|
|
1303
|
+
transition: { duration: 0.25 },
|
|
1304
|
+
onClick: d ? () => r((o) => !o) : void 0,
|
|
1305
|
+
style: {
|
|
1306
|
+
paddingBottom: n ? "12px" : 0,
|
|
1307
|
+
borderBottom: n ? "1px solid #eee" : void 0,
|
|
1308
|
+
display: "flex",
|
|
1309
|
+
flexDirection: "column",
|
|
1310
|
+
gap: "4px",
|
|
1311
|
+
minWidth: 0,
|
|
1312
|
+
cursor: d ? "pointer" : "default"
|
|
1313
|
+
},
|
|
1314
|
+
children: [
|
|
1315
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1316
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Le(s, t) }),
|
|
1317
|
+
d && /* @__PURE__ */ i(
|
|
1318
|
+
"span",
|
|
1319
|
+
{
|
|
1320
|
+
style: {
|
|
1321
|
+
fontSize: 11,
|
|
1322
|
+
color: "#999",
|
|
1323
|
+
marginTop: 2
|
|
1324
|
+
},
|
|
1325
|
+
children: n ? t.clickToCollapse : t.clickToExpand
|
|
1326
|
+
}
|
|
1327
|
+
)
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
n && d && /* @__PURE__ */ i(
|
|
1332
|
+
T.div,
|
|
1333
|
+
{
|
|
1334
|
+
initial: { opacity: 0, height: 0 },
|
|
1335
|
+
animate: { opacity: 1, height: "auto" },
|
|
1336
|
+
transition: { duration: 0.2 },
|
|
1337
|
+
style: {
|
|
1338
|
+
maxHeight: 220,
|
|
1339
|
+
overflowY: "auto",
|
|
1340
|
+
marginTop: 12,
|
|
1341
|
+
display: "flex",
|
|
1342
|
+
flexDirection: "column",
|
|
1343
|
+
gap: 8
|
|
1344
|
+
},
|
|
1345
|
+
children: e.chunks.map((o, l) => {
|
|
1346
|
+
const m = o.pageNumbers ?? [], a = Oe(m, t);
|
|
1347
|
+
return /* @__PURE__ */ v(
|
|
1348
|
+
"div",
|
|
1349
|
+
{
|
|
1350
|
+
style: {
|
|
1351
|
+
padding: "8px 12px",
|
|
1352
|
+
borderRadius: 6,
|
|
1353
|
+
border: "1px solid #e0e0e0",
|
|
1354
|
+
backgroundColor: "#fafafa"
|
|
1355
|
+
},
|
|
1356
|
+
children: [
|
|
1357
|
+
/* @__PURE__ */ i(
|
|
1358
|
+
"span",
|
|
1359
|
+
{
|
|
1360
|
+
style: {
|
|
1361
|
+
fontSize: 12,
|
|
1362
|
+
color: "#333",
|
|
1363
|
+
lineHeight: 1.4,
|
|
1364
|
+
display: "block",
|
|
1365
|
+
marginBottom: 4
|
|
1366
|
+
},
|
|
1367
|
+
children: o.content
|
|
1368
|
+
}
|
|
1369
|
+
),
|
|
1370
|
+
/* @__PURE__ */ v(
|
|
1371
|
+
"div",
|
|
1372
|
+
{
|
|
1373
|
+
style: {
|
|
1374
|
+
display: "flex",
|
|
1375
|
+
gap: 8,
|
|
1376
|
+
fontSize: 11,
|
|
1377
|
+
color: "#666"
|
|
1378
|
+
},
|
|
1379
|
+
children: [
|
|
1380
|
+
a && /* @__PURE__ */ i("span", { children: a }),
|
|
1381
|
+
/* @__PURE__ */ i("span", { children: x(t.scoreLabel, {
|
|
1382
|
+
n: o.score
|
|
1383
|
+
}) })
|
|
1384
|
+
]
|
|
1385
|
+
}
|
|
1386
|
+
)
|
|
1387
|
+
]
|
|
1388
|
+
},
|
|
1389
|
+
l
|
|
1390
|
+
);
|
|
1391
|
+
})
|
|
1392
|
+
}
|
|
1393
|
+
)
|
|
1394
|
+
] });
|
|
1395
|
+
}, Ue = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
1396
|
+
T.div,
|
|
1263
1397
|
{
|
|
1264
1398
|
initial: { opacity: 0, y: -10 },
|
|
1265
1399
|
animate: { opacity: 1, y: 0 },
|
|
@@ -1281,26 +1415,26 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1281
1415
|
}
|
|
1282
1416
|
)
|
|
1283
1417
|
}
|
|
1284
|
-
) }),
|
|
1418
|
+
) }), ze = ({
|
|
1285
1419
|
progressViewItems: e,
|
|
1286
1420
|
loadingText: t,
|
|
1287
|
-
t:
|
|
1288
|
-
onSourceClick:
|
|
1421
|
+
t: n,
|
|
1422
|
+
onSourceClick: r
|
|
1289
1423
|
}) => {
|
|
1290
|
-
const s =
|
|
1291
|
-
|
|
1424
|
+
const s = A(null);
|
|
1425
|
+
w(() => {
|
|
1292
1426
|
s.current && (s.current.scrollTop = s.current.scrollHeight);
|
|
1293
1427
|
}, [e.length]);
|
|
1294
1428
|
const d = (o) => {
|
|
1295
1429
|
const l = o.item.data;
|
|
1296
1430
|
if (l.taskType === "StreamingChatCompletion" && l.eventType === "Text")
|
|
1297
|
-
return /* @__PURE__ */ i(
|
|
1431
|
+
return /* @__PURE__ */ i(B, { text: l.text });
|
|
1298
1432
|
if (l.taskType === "StructuredChatCompletion" && l.eventType === "Json")
|
|
1299
1433
|
return /* @__PURE__ */ i(xe, { data: l });
|
|
1300
1434
|
if (l.taskType === "MemoryChatCompletion")
|
|
1301
1435
|
switch (l.eventType) {
|
|
1302
1436
|
case "Text":
|
|
1303
|
-
return /* @__PURE__ */ i(
|
|
1437
|
+
return /* @__PURE__ */ i(B, { text: l.text });
|
|
1304
1438
|
case "Search":
|
|
1305
1439
|
return /* @__PURE__ */ i(
|
|
1306
1440
|
we,
|
|
@@ -1308,7 +1442,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1308
1442
|
data: l,
|
|
1309
1443
|
isLatest: o.isLatest,
|
|
1310
1444
|
durationSeconds: o.durationSeconds,
|
|
1311
|
-
t:
|
|
1445
|
+
t: n
|
|
1312
1446
|
}
|
|
1313
1447
|
);
|
|
1314
1448
|
case "FindSources":
|
|
@@ -1318,7 +1452,7 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1318
1452
|
data: l,
|
|
1319
1453
|
isLatest: o.isLatest,
|
|
1320
1454
|
durationSeconds: o.durationSeconds,
|
|
1321
|
-
t:
|
|
1455
|
+
t: n
|
|
1322
1456
|
}
|
|
1323
1457
|
);
|
|
1324
1458
|
case "SourcesResult":
|
|
@@ -1326,39 +1460,41 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1326
1460
|
Me,
|
|
1327
1461
|
{
|
|
1328
1462
|
data: l,
|
|
1329
|
-
onSourceClick:
|
|
1330
|
-
t:
|
|
1463
|
+
onSourceClick: r,
|
|
1464
|
+
t: n
|
|
1331
1465
|
}
|
|
1332
1466
|
);
|
|
1333
1467
|
case "ExploreMemoryStart":
|
|
1334
1468
|
case "ExploreMemoryResult":
|
|
1335
1469
|
case "ExploreMemoryError":
|
|
1336
1470
|
return /* @__PURE__ */ i(
|
|
1337
|
-
|
|
1471
|
+
Fe,
|
|
1338
1472
|
{
|
|
1339
1473
|
data: l,
|
|
1340
1474
|
completed: o.completed,
|
|
1341
1475
|
isLatest: o.isLatest,
|
|
1342
|
-
t:
|
|
1476
|
+
t: n
|
|
1343
1477
|
}
|
|
1344
1478
|
);
|
|
1479
|
+
case "ChunkResult":
|
|
1480
|
+
return /* @__PURE__ */ i(Be, { data: l, t: n });
|
|
1345
1481
|
case "Completed":
|
|
1346
1482
|
return null;
|
|
1347
1483
|
}
|
|
1348
|
-
return l.taskType === "StreamingChatCompletion" && l.eventType === "Completed" || l.taskType === "StructuredChatCompletion" && l.eventType === "Completed" ? null : l.eventType === "Error" && "message" in l ? /* @__PURE__ */ i(
|
|
1484
|
+
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
1485
|
};
|
|
1350
1486
|
return e.length === 0 ? /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
|
|
1351
|
-
|
|
1487
|
+
R,
|
|
1352
1488
|
{
|
|
1353
|
-
text: t ??
|
|
1489
|
+
text: t ?? n.processingYourTask,
|
|
1354
1490
|
duration: 1.5,
|
|
1355
1491
|
repeat: !0,
|
|
1356
1492
|
repeatDelay: 0,
|
|
1357
1493
|
color: "#999",
|
|
1358
1494
|
shimmerColor: "#000"
|
|
1359
1495
|
}
|
|
1360
|
-
) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(
|
|
1361
|
-
|
|
1496
|
+
) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(W, { children: e.map((o, l) => /* @__PURE__ */ i(
|
|
1497
|
+
T.div,
|
|
1362
1498
|
{
|
|
1363
1499
|
id: `agent-task-progress-item-${o.item.progressItemId}`,
|
|
1364
1500
|
initial: { opacity: 0, y: -20 },
|
|
@@ -1372,33 +1508,33 @@ const N = 80, Re = ({ data: e, completed: t, isLatest: r = !1, t: n }) => {
|
|
|
1372
1508
|
},
|
|
1373
1509
|
o.item.progressItemId
|
|
1374
1510
|
)) }) });
|
|
1375
|
-
},
|
|
1511
|
+
}, Ve = ({
|
|
1376
1512
|
agentTask: e,
|
|
1377
1513
|
mode: t = "verbose",
|
|
1378
|
-
language:
|
|
1379
|
-
onSourceClick:
|
|
1514
|
+
language: n,
|
|
1515
|
+
onSourceClick: r
|
|
1380
1516
|
}) => {
|
|
1381
|
-
const s =
|
|
1517
|
+
const s = Te(e), d = e.params.type === "MemoryChatCompletion" && "language" in e.params ? e.params.language ?? "en" : n ?? "en", o = Ee(d);
|
|
1382
1518
|
return t === "simple" ? /* @__PURE__ */ i(
|
|
1383
|
-
|
|
1519
|
+
be,
|
|
1384
1520
|
{
|
|
1385
1521
|
progressViewItems: s,
|
|
1386
1522
|
t: o
|
|
1387
1523
|
}
|
|
1388
1524
|
) : /* @__PURE__ */ i(
|
|
1389
|
-
|
|
1525
|
+
ze,
|
|
1390
1526
|
{
|
|
1391
1527
|
progressViewItems: s,
|
|
1392
1528
|
loadingText: e.loadingText,
|
|
1393
1529
|
t: o,
|
|
1394
|
-
onSourceClick:
|
|
1530
|
+
onSourceClick: r
|
|
1395
1531
|
}
|
|
1396
1532
|
);
|
|
1397
1533
|
};
|
|
1398
1534
|
export {
|
|
1399
|
-
|
|
1535
|
+
Ve as AgentTaskProgress,
|
|
1400
1536
|
U as Checkmark,
|
|
1401
|
-
|
|
1537
|
+
Ge as FencyProvider,
|
|
1402
1538
|
Pe as XMark,
|
|
1403
|
-
|
|
1539
|
+
Je as useAgentTasks
|
|
1404
1540
|
};
|