@fencyai/react 0.1.172 → 0.1.173
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/hooks/useFencyEventSource/index.d.ts +0 -1
- package/dist/hooks/useFencyEventSource/index.d.ts.map +1 -1
- package/dist/index.js +1207 -971
- package/dist/provider/StreamEventManager.d.ts +14 -1
- package/dist/provider/StreamEventManager.d.ts.map +1 -1
- package/dist/provider/createStreamWorkerCode.d.ts +7 -0
- package/dist/provider/createStreamWorkerCode.d.ts.map +1 -0
- package/dist/utils/base64Decode.d.ts +5 -0
- package/dist/utils/base64Decode.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createStream as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { motion as
|
|
5
|
-
import
|
|
6
|
-
import { Prism as
|
|
7
|
-
import
|
|
8
|
-
import './assets/index.css';const
|
|
1
|
+
import { jsxs as h, jsx as o, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { createStream as ce, isStreamTimeoutEvent as de, isStreamNotFoundEvent as me, isAgentTaskProgressItemUpdatedEvent as ue, createAgentTask as ye } from "@fencyai/js";
|
|
3
|
+
import { createContext as ge, useState as I, useRef as F, useEffect as A, useCallback as O, useContext as he, useMemo as B } from "react";
|
|
4
|
+
import { motion as C, useInView as pe, AnimatePresence as fe } from "motion/react";
|
|
5
|
+
import Se from "react-markdown";
|
|
6
|
+
import { Prism as oe } from "react-syntax-highlighter";
|
|
7
|
+
import xe from "remark-gfm";
|
|
8
|
+
import './assets/index.css';const ie = ge(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
|
-
async function
|
|
11
|
+
async function ke(e, r) {
|
|
12
12
|
const t = e.getReader();
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
n
|
|
13
|
+
let n;
|
|
14
|
+
for (; !(n = await t.read()).done; )
|
|
15
|
+
r(n.value);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
return function(
|
|
20
|
-
|
|
21
|
-
const
|
|
17
|
+
function be(e) {
|
|
18
|
+
let r, t, n, i = !1;
|
|
19
|
+
return function(a) {
|
|
20
|
+
r === void 0 ? (r = a, t = 0, n = -1) : r = Te(r, a);
|
|
21
|
+
const c = r.length;
|
|
22
22
|
let u = 0;
|
|
23
|
-
for (; t <
|
|
24
|
-
|
|
23
|
+
for (; t < c; ) {
|
|
24
|
+
i && (r[t] === 10 && (u = ++t), i = !1);
|
|
25
25
|
let y = -1;
|
|
26
|
-
for (; t <
|
|
27
|
-
switch (
|
|
26
|
+
for (; t < c && y === -1; ++t)
|
|
27
|
+
switch (r[t]) {
|
|
28
28
|
case 58:
|
|
29
|
-
|
|
29
|
+
n === -1 && (n = t - u);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
|
-
|
|
32
|
+
i = !0;
|
|
33
33
|
case 10:
|
|
34
34
|
y = t;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
if (y === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(
|
|
39
|
+
e(r.subarray(u, y), n), u = t, n = -1;
|
|
40
40
|
}
|
|
41
|
-
u ===
|
|
41
|
+
u === c ? r = void 0 : u !== 0 && (r = r.subarray(u), t -= u);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
return function(
|
|
48
|
-
if (
|
|
49
|
-
t == null || t(
|
|
50
|
-
else if (
|
|
51
|
-
const u =
|
|
44
|
+
function ve(e, r, t) {
|
|
45
|
+
let n = J();
|
|
46
|
+
const i = new TextDecoder();
|
|
47
|
+
return function(a, c) {
|
|
48
|
+
if (a.length === 0)
|
|
49
|
+
t == null || t(n), n = J();
|
|
50
|
+
else if (c > 0) {
|
|
51
|
+
const u = i.decode(a.subarray(0, c)), y = c + (a[c + 1] === 32 ? 2 : 1), s = i.decode(a.subarray(y));
|
|
52
52
|
switch (u) {
|
|
53
53
|
case "data":
|
|
54
|
-
|
|
55
|
-
` +
|
|
54
|
+
n.data = n.data ? n.data + `
|
|
55
|
+
` + s : s;
|
|
56
56
|
break;
|
|
57
57
|
case "event":
|
|
58
|
-
|
|
58
|
+
n.event = s;
|
|
59
59
|
break;
|
|
60
60
|
case "id":
|
|
61
|
-
e(
|
|
61
|
+
e(n.id = s);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
64
|
+
const d = parseInt(s, 10);
|
|
65
|
+
isNaN(d) || r(n.retry = d);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const t = new Uint8Array(e.length +
|
|
73
|
-
return t.set(e), t.set(
|
|
71
|
+
function Te(e, r) {
|
|
72
|
+
const t = new Uint8Array(e.length + r.length);
|
|
73
|
+
return t.set(e), t.set(r, e.length), t;
|
|
74
74
|
}
|
|
75
75
|
function J() {
|
|
76
76
|
return {
|
|
@@ -80,110 +80,339 @@ function J() {
|
|
|
80
80
|
retry: void 0
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
var
|
|
83
|
+
var we = function(e, r) {
|
|
84
84
|
var t = {};
|
|
85
|
-
for (var
|
|
85
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
|
|
86
86
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
87
|
-
for (var
|
|
88
|
-
|
|
87
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
88
|
+
r.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (t[n[i]] = e[n[i]]);
|
|
89
89
|
return t;
|
|
90
90
|
};
|
|
91
|
-
const
|
|
92
|
-
function Ce(e,
|
|
93
|
-
var { signal: t, headers:
|
|
94
|
-
return new Promise((
|
|
95
|
-
const g = Object.assign({},
|
|
96
|
-
g.accept || (g.accept =
|
|
97
|
-
let
|
|
91
|
+
const z = "text/event-stream", Ie = 1e3, Y = "last-event-id";
|
|
92
|
+
function Ce(e, r) {
|
|
93
|
+
var { signal: t, headers: n, onopen: i, onmessage: l, onclose: a, onerror: c, openWhenHidden: u, fetch: y } = r, s = we(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((d, m) => {
|
|
95
|
+
const g = Object.assign({}, n);
|
|
96
|
+
g.accept || (g.accept = z);
|
|
97
|
+
let p;
|
|
98
98
|
function f() {
|
|
99
|
-
|
|
99
|
+
p.abort(), document.hidden || T();
|
|
100
100
|
}
|
|
101
101
|
u || document.addEventListener("visibilitychange", f);
|
|
102
|
-
let
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange", f), window.clearTimeout(
|
|
102
|
+
let x = Ie, k = 0;
|
|
103
|
+
function b() {
|
|
104
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(k), p.abort();
|
|
105
105
|
}
|
|
106
106
|
t == null || t.addEventListener("abort", () => {
|
|
107
|
-
|
|
107
|
+
b(), d();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
110
|
-
async function
|
|
111
|
-
var
|
|
112
|
-
|
|
109
|
+
const S = y ?? window.fetch, w = i ?? Ee;
|
|
110
|
+
async function T() {
|
|
111
|
+
var L;
|
|
112
|
+
p = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
} catch (
|
|
121
|
-
if (!
|
|
114
|
+
const P = await S(e, Object.assign(Object.assign({}, s), { headers: g, signal: p.signal }));
|
|
115
|
+
await w(P), await ke(P.body, be(ve((R) => {
|
|
116
|
+
R ? g[Y] = R : delete g[Y];
|
|
117
|
+
}, (R) => {
|
|
118
|
+
x = R;
|
|
119
|
+
}, l))), a == null || a(), b(), d();
|
|
120
|
+
} catch (P) {
|
|
121
|
+
if (!p.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
|
|
123
|
+
const R = (L = c == null ? void 0 : c(P)) !== null && L !== void 0 ? L : x;
|
|
124
|
+
window.clearTimeout(k), k = window.setTimeout(T, R);
|
|
125
|
+
} catch (R) {
|
|
126
|
+
b(), m(R);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
T();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
if (!(
|
|
136
|
-
throw new Error(`Expected content-type to be ${
|
|
133
|
+
function Ee(e) {
|
|
134
|
+
const r = e.headers.get("content-type");
|
|
135
|
+
if (!(r != null && r.startsWith(z)))
|
|
136
|
+
throw new Error(`Expected content-type to be ${z}, Actual: ${r}`);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
140
|
-
for (let
|
|
141
|
-
t[
|
|
138
|
+
function Z(e) {
|
|
139
|
+
const r = atob(e), t = new Uint8Array(r.length);
|
|
140
|
+
for (let n = 0; n < r.length; n++)
|
|
141
|
+
t[n] = r.charCodeAt(n);
|
|
142
142
|
return new TextDecoder("utf-8").decode(t);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Me() {
|
|
145
|
+
return `
|
|
146
|
+
var connections = new Map();
|
|
147
|
+
|
|
148
|
+
function disconnectStream(streamId) {
|
|
149
|
+
var entry = connections.get(streamId);
|
|
150
|
+
if (entry) {
|
|
151
|
+
try {
|
|
152
|
+
entry.cancel();
|
|
153
|
+
} catch (e) {}
|
|
154
|
+
connections.delete(streamId);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function findEventBoundary(buf) {
|
|
159
|
+
var iCRLF = buf.indexOf("\\r\\n\\r\\n");
|
|
160
|
+
var iLF = buf.indexOf("\\n\\n");
|
|
161
|
+
if (iCRLF !== -1 && (iLF === -1 || iCRLF < iLF)) {
|
|
162
|
+
return { index: iCRLF, len: 4 };
|
|
163
|
+
}
|
|
164
|
+
if (iLF !== -1) {
|
|
165
|
+
return { index: iLF, len: 2 };
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function parseSseBuffer(buffer) {
|
|
171
|
+
var events = [];
|
|
172
|
+
var rest = buffer;
|
|
173
|
+
while (true) {
|
|
174
|
+
var boundary = findEventBoundary(rest);
|
|
175
|
+
if (!boundary) break;
|
|
176
|
+
var rawEvent = rest.slice(0, boundary.index);
|
|
177
|
+
rest = rest.slice(boundary.index + boundary.len);
|
|
178
|
+
if (!rawEvent.trim()) continue;
|
|
179
|
+
|
|
180
|
+
var eventType = "";
|
|
181
|
+
var eventId = "";
|
|
182
|
+
var dataLines = [];
|
|
183
|
+
var lines = rawEvent.split(/\\r\\n|\\r|\\n/);
|
|
184
|
+
for (var i = 0; i < lines.length; i++) {
|
|
185
|
+
var line = lines[i];
|
|
186
|
+
if (line.charAt(0) === ":") continue;
|
|
187
|
+
var colon = line.indexOf(":");
|
|
188
|
+
if (colon === -1) continue;
|
|
189
|
+
var field = line.slice(0, colon);
|
|
190
|
+
var value = line.slice(colon + 1);
|
|
191
|
+
if (value.charAt(0) === " ") value = value.slice(1);
|
|
192
|
+
if (field === "data") dataLines.push(value);
|
|
193
|
+
else if (field === "event") eventType = value;
|
|
194
|
+
else if (field === "id") eventId = value;
|
|
195
|
+
}
|
|
196
|
+
var data = dataLines.join("\\n");
|
|
197
|
+
if (data.length > 0) {
|
|
198
|
+
events.push({ data: data, event: eventType, id: eventId });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return { events: events, rest: rest };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function readStream(streamId, readableStream) {
|
|
205
|
+
disconnectStream(streamId);
|
|
206
|
+
if (!readableStream || typeof readableStream.getReader !== "function") {
|
|
207
|
+
self.postMessage({
|
|
208
|
+
type: "error",
|
|
209
|
+
streamId: streamId,
|
|
210
|
+
error: "No readable stream",
|
|
211
|
+
});
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
var reader = readableStream.getReader();
|
|
215
|
+
connections.set(streamId, {
|
|
216
|
+
cancel: function () {
|
|
217
|
+
reader.cancel().catch(function () {});
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
try {
|
|
221
|
+
var decoder = new TextDecoder();
|
|
222
|
+
var buf = "";
|
|
223
|
+
while (true) {
|
|
224
|
+
var readResult = await reader.read();
|
|
225
|
+
var done = readResult.done;
|
|
226
|
+
var value = readResult.value;
|
|
227
|
+
if (done) break;
|
|
228
|
+
buf += decoder.decode(value, { stream: true });
|
|
229
|
+
var parsed = parseSseBuffer(buf);
|
|
230
|
+
buf = parsed.rest;
|
|
231
|
+
for (var j = 0; j < parsed.events.length; j++) {
|
|
232
|
+
var ev = parsed.events[j];
|
|
233
|
+
self.postMessage({
|
|
234
|
+
type: "message",
|
|
235
|
+
streamId: streamId,
|
|
236
|
+
data: ev.data,
|
|
237
|
+
event: ev.event || undefined,
|
|
238
|
+
id: ev.id || undefined,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
buf += decoder.decode();
|
|
243
|
+
var finalParsed = parseSseBuffer(buf);
|
|
244
|
+
for (var k = 0; k < finalParsed.events.length; k++) {
|
|
245
|
+
var fev = finalParsed.events[k];
|
|
246
|
+
self.postMessage({
|
|
247
|
+
type: "message",
|
|
248
|
+
streamId: streamId,
|
|
249
|
+
data: fev.data,
|
|
250
|
+
event: fev.event || undefined,
|
|
251
|
+
id: fev.id || undefined,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
if (err && err.name === "AbortError") {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
var msg = err && err.message ? String(err.message) : String(err);
|
|
259
|
+
self.postMessage({ type: "error", streamId: streamId, error: msg });
|
|
260
|
+
} finally {
|
|
261
|
+
connections.delete(streamId);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
self.onmessage = function (e) {
|
|
266
|
+
var d = e.data;
|
|
267
|
+
if (!d || !d.command) return;
|
|
268
|
+
switch (d.command) {
|
|
269
|
+
case "start":
|
|
270
|
+
readStream(d.streamId, d.readableStream);
|
|
271
|
+
break;
|
|
272
|
+
case "disconnect":
|
|
273
|
+
disconnectStream(d.streamId);
|
|
274
|
+
break;
|
|
275
|
+
case "cleanup":
|
|
276
|
+
connections.forEach(function (entry) {
|
|
277
|
+
try {
|
|
278
|
+
entry.cancel();
|
|
279
|
+
} catch (e2) {}
|
|
280
|
+
});
|
|
281
|
+
connections.clear();
|
|
282
|
+
self.close();
|
|
283
|
+
break;
|
|
284
|
+
default:
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
`.trim();
|
|
289
|
+
}
|
|
290
|
+
function ee(e) {
|
|
145
291
|
return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
|
|
146
292
|
}
|
|
147
|
-
class
|
|
148
|
-
constructor(
|
|
149
|
-
this.
|
|
293
|
+
class Re {
|
|
294
|
+
constructor(r) {
|
|
295
|
+
this.activeConnections = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.worker = null, this.workerBlobUrl = null, this.workerSupported = !1, this.fency = r, this.tryInitWorker();
|
|
296
|
+
}
|
|
297
|
+
tryInitWorker() {
|
|
298
|
+
try {
|
|
299
|
+
if (typeof Worker > "u" || typeof Blob > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function" || typeof ReadableStream > "u")
|
|
300
|
+
return;
|
|
301
|
+
const r = Me(), t = new Blob([r], { type: "application/javascript" }), n = URL.createObjectURL(t), i = new Worker(n);
|
|
302
|
+
i.onmessage = (l) => {
|
|
303
|
+
this.handleWorkerMessage(l.data);
|
|
304
|
+
}, i.onerror = (l) => {
|
|
305
|
+
console.error("Fency stream worker error:", l.message);
|
|
306
|
+
}, this.worker = i, this.workerBlobUrl = n, this.workerSupported = !0;
|
|
307
|
+
} catch {
|
|
308
|
+
this.workerSupported = !1, this.worker = null, this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
handleWorkerMessage(r) {
|
|
312
|
+
if (!r || typeof r != "object") return;
|
|
313
|
+
const t = r;
|
|
314
|
+
switch (t.type) {
|
|
315
|
+
case "message":
|
|
316
|
+
if (t.data && t.streamId) {
|
|
317
|
+
const n = Z(t.data);
|
|
318
|
+
this.broadcast(n, t.streamId);
|
|
319
|
+
}
|
|
320
|
+
break;
|
|
321
|
+
case "error":
|
|
322
|
+
t.streamId && (this.activeConnections.delete(t.streamId), this.broadcastError(t.streamId, t.error));
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
150
325
|
}
|
|
151
326
|
/**
|
|
152
327
|
* Called by FencyProvider when activeStreams changes.
|
|
153
328
|
* Creates new connections and removes old ones.
|
|
154
329
|
*/
|
|
155
|
-
updateStreams(
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
this.
|
|
330
|
+
updateStreams(r) {
|
|
331
|
+
r.forEach((n) => {
|
|
332
|
+
const i = n.stream.id;
|
|
333
|
+
this.activeConnections.has(i) || this.connectStream(n);
|
|
159
334
|
});
|
|
160
|
-
const t = new Set(
|
|
161
|
-
this.
|
|
162
|
-
t.has(
|
|
335
|
+
const t = new Set(r.map((n) => n.stream.id));
|
|
336
|
+
this.activeConnections.forEach((n, i) => {
|
|
337
|
+
t.has(i) || (n.abort(), this.activeConnections.delete(i));
|
|
163
338
|
});
|
|
164
339
|
}
|
|
165
|
-
connectStream(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
340
|
+
connectStream(r) {
|
|
341
|
+
this.workerSupported && this.worker ? this.connectStreamInWorker(r) : this.connectStreamOnMainThread(r);
|
|
342
|
+
}
|
|
343
|
+
connectStreamInWorker(r) {
|
|
344
|
+
const t = r.stream.id, n = `${this.fency.baseUrl}/sse/streams/${t}`, i = new AbortController(), l = {
|
|
345
|
+
accept: z,
|
|
346
|
+
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
347
|
+
"X-Fency-Stream-Token": r.stream.token
|
|
348
|
+
};
|
|
349
|
+
this.activeConnections.set(t, {
|
|
350
|
+
abort: () => {
|
|
351
|
+
var a;
|
|
352
|
+
i.abort(), (a = this.worker) == null || a.postMessage({ command: "disconnect", streamId: t });
|
|
353
|
+
}
|
|
354
|
+
}), this.startWorkerStream(t, n, l, i);
|
|
355
|
+
}
|
|
356
|
+
async startWorkerStream(r, t, n, i) {
|
|
357
|
+
const l = this.worker;
|
|
358
|
+
if (!l) return;
|
|
359
|
+
const a = (c) => {
|
|
360
|
+
i.signal.aborted || (this.activeConnections.delete(r), this.broadcastError(r, c));
|
|
361
|
+
};
|
|
362
|
+
try {
|
|
363
|
+
const c = await fetch(t, {
|
|
364
|
+
method: "GET",
|
|
365
|
+
headers: n,
|
|
366
|
+
signal: i.signal
|
|
367
|
+
});
|
|
368
|
+
if (!c.ok) {
|
|
369
|
+
c.status >= 400 && c.status < 500 && c.status !== 429 ? a(`Client error ${c.status}`) : a(`HTTP ${c.status}`);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const u = c.body;
|
|
373
|
+
if (!u) {
|
|
374
|
+
a("No response body");
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (!this.activeConnections.has(r)) {
|
|
378
|
+
await u.cancel().catch(() => {
|
|
379
|
+
});
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
l.postMessage(
|
|
383
|
+
{ command: "start", streamId: r, readableStream: u },
|
|
384
|
+
[u]
|
|
385
|
+
);
|
|
386
|
+
} catch (c) {
|
|
387
|
+
if (i.signal.aborted) return;
|
|
388
|
+
a(ee(c));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
connectStreamOnMainThread(r) {
|
|
392
|
+
const t = r.stream.id, n = new AbortController();
|
|
393
|
+
this.activeConnections.set(t, {
|
|
394
|
+
abort: () => n.abort()
|
|
395
|
+
});
|
|
396
|
+
const i = `${this.fency.baseUrl}/sse/streams/${t}`, l = {
|
|
169
397
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
170
|
-
"X-Fency-Stream-Token":
|
|
398
|
+
"X-Fency-Stream-Token": r.stream.token
|
|
171
399
|
};
|
|
172
|
-
Ce(
|
|
173
|
-
headers:
|
|
174
|
-
signal:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
400
|
+
Ce(i, {
|
|
401
|
+
headers: l,
|
|
402
|
+
signal: n.signal,
|
|
403
|
+
openWhenHidden: !0,
|
|
404
|
+
onopen: async (a) => {
|
|
405
|
+
if (!a.ok && a.status >= 400 && a.status < 500 && a.status !== 429)
|
|
406
|
+
throw this.activeConnections.delete(t), new Error(`Client error ${a.status}`);
|
|
178
407
|
},
|
|
179
|
-
onmessage: (
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
this.broadcast(
|
|
408
|
+
onmessage: (a) => {
|
|
409
|
+
if (a.data) {
|
|
410
|
+
const c = Z(a.data);
|
|
411
|
+
this.broadcast(c, t);
|
|
183
412
|
}
|
|
184
413
|
},
|
|
185
|
-
onerror: (
|
|
186
|
-
throw console.error("EventSource error for stream", t, ":",
|
|
414
|
+
onerror: (a) => {
|
|
415
|
+
throw console.error("EventSource error for stream", t, ":", a), this.activeConnections.delete(t), this.broadcastError(t, ee(a)), a;
|
|
187
416
|
},
|
|
188
417
|
onclose() {
|
|
189
418
|
}
|
|
@@ -193,129 +422,136 @@ class Me {
|
|
|
193
422
|
* Subscribe to events from all active streams.
|
|
194
423
|
* Returns an unsubscribe function.
|
|
195
424
|
*/
|
|
196
|
-
subscribe(
|
|
197
|
-
return this.subscribers.set(
|
|
198
|
-
this.subscribers.delete(
|
|
425
|
+
subscribe(r, t) {
|
|
426
|
+
return this.subscribers.set(r, t), () => {
|
|
427
|
+
this.subscribers.delete(r);
|
|
199
428
|
};
|
|
200
429
|
}
|
|
201
|
-
broadcast(
|
|
202
|
-
this.subscribers.forEach((
|
|
203
|
-
|
|
430
|
+
broadcast(r, t) {
|
|
431
|
+
this.subscribers.forEach((n) => {
|
|
432
|
+
n.onMessage(r, t);
|
|
204
433
|
});
|
|
205
434
|
}
|
|
206
|
-
broadcastError(
|
|
207
|
-
this.subscribers.forEach((
|
|
208
|
-
|
|
435
|
+
broadcastError(r, t) {
|
|
436
|
+
this.subscribers.forEach((n) => {
|
|
437
|
+
n.onError(r, t);
|
|
209
438
|
});
|
|
210
439
|
}
|
|
211
440
|
/**
|
|
212
441
|
* Cleanup all connections and subscriptions
|
|
213
442
|
*/
|
|
214
443
|
cleanup() {
|
|
215
|
-
this.
|
|
444
|
+
if (this.activeConnections.forEach((r) => r.abort()), this.activeConnections.clear(), this.worker) {
|
|
445
|
+
try {
|
|
446
|
+
this.worker.postMessage({ command: "cleanup" });
|
|
447
|
+
} catch {
|
|
448
|
+
}
|
|
449
|
+
this.worker = null;
|
|
450
|
+
}
|
|
451
|
+
this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null), this.workerSupported = !1, this.subscribers.clear();
|
|
216
452
|
}
|
|
217
453
|
}
|
|
218
|
-
const Ae = 48e4,
|
|
219
|
-
const
|
|
220
|
-
return e.filter((t) =>
|
|
454
|
+
const Ae = 48e4, Fe = 3e5, re = (e) => {
|
|
455
|
+
const r = Date.now();
|
|
456
|
+
return e.filter((t) => r - t.createdAt < Ae);
|
|
221
457
|
};
|
|
222
|
-
function
|
|
223
|
-
const [
|
|
458
|
+
function Lr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
459
|
+
const [n, i] = I(
|
|
224
460
|
null
|
|
225
|
-
), [
|
|
226
|
-
|
|
227
|
-
e.then((
|
|
228
|
-
|
|
229
|
-
}).catch((
|
|
230
|
-
u(
|
|
461
|
+
), [l, a] = I(!0), [c, u] = I(null), [y, s] = I([]), d = F(null), m = F(null);
|
|
462
|
+
A(() => {
|
|
463
|
+
e.then((x) => {
|
|
464
|
+
i(x), a(!1);
|
|
465
|
+
}).catch((x) => {
|
|
466
|
+
u(x), a(!1);
|
|
231
467
|
});
|
|
232
|
-
}, [e]),
|
|
233
|
-
|
|
234
|
-
}, [
|
|
468
|
+
}, [e]), A(() => {
|
|
469
|
+
n && !m.current && (m.current = new Re(n));
|
|
470
|
+
}, [n]), A(() => {
|
|
235
471
|
m.current && m.current.updateStreams(y);
|
|
236
|
-
}, [y]),
|
|
237
|
-
var
|
|
238
|
-
(
|
|
239
|
-
}, []),
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
return
|
|
472
|
+
}, [y]), A(() => () => {
|
|
473
|
+
var x;
|
|
474
|
+
(x = m.current) == null || x.cleanup();
|
|
475
|
+
}, []), A(() => {
|
|
476
|
+
const x = setInterval(() => {
|
|
477
|
+
s((k) => {
|
|
478
|
+
const b = re(k);
|
|
479
|
+
return b.length !== k.length ? b : k;
|
|
244
480
|
});
|
|
245
481
|
}, 6e4);
|
|
246
|
-
return () => clearInterval(
|
|
482
|
+
return () => clearInterval(x);
|
|
247
483
|
}, []);
|
|
248
|
-
const g =
|
|
249
|
-
async (
|
|
250
|
-
if (
|
|
251
|
-
return
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
return
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
484
|
+
const g = O(
|
|
485
|
+
async (x = Fe) => {
|
|
486
|
+
if (d.current)
|
|
487
|
+
return d.current;
|
|
488
|
+
const k = Date.now(), b = y.length > 0 ? y[y.length - 1] : null;
|
|
489
|
+
if (b && k - b.createdAt < x)
|
|
490
|
+
return b.stream;
|
|
491
|
+
const S = (async () => {
|
|
492
|
+
if (!n)
|
|
257
493
|
throw new Error("Fency instance not initialized");
|
|
258
|
-
const
|
|
259
|
-
pk:
|
|
260
|
-
baseUrl:
|
|
261
|
-
clientToken: (
|
|
494
|
+
const w = await r(), T = await ce({
|
|
495
|
+
pk: n.publishableKey,
|
|
496
|
+
baseUrl: n.baseUrl,
|
|
497
|
+
clientToken: (w == null ? void 0 : w.clientToken) ?? ""
|
|
262
498
|
});
|
|
263
|
-
if (
|
|
264
|
-
const
|
|
265
|
-
stream:
|
|
499
|
+
if (T.type === "success") {
|
|
500
|
+
const L = {
|
|
501
|
+
stream: T.stream,
|
|
266
502
|
createdAt: Date.now()
|
|
267
503
|
};
|
|
268
|
-
return
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
}),
|
|
504
|
+
return s((P) => {
|
|
505
|
+
const R = [...P, L];
|
|
506
|
+
return re(R);
|
|
507
|
+
}), d.current = null, T.stream;
|
|
272
508
|
} else
|
|
273
|
-
throw
|
|
509
|
+
throw d.current = null, new Error("Failed to create stream");
|
|
274
510
|
})();
|
|
275
|
-
return
|
|
511
|
+
return d.current = S, S;
|
|
276
512
|
},
|
|
277
|
-
[
|
|
513
|
+
[n, y]
|
|
278
514
|
);
|
|
279
|
-
if (
|
|
280
|
-
return /* @__PURE__ */
|
|
515
|
+
if (c)
|
|
516
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
281
517
|
"Fency error: ",
|
|
282
|
-
|
|
518
|
+
c.message
|
|
283
519
|
] });
|
|
284
|
-
if (!
|
|
520
|
+
if (!n)
|
|
285
521
|
return null;
|
|
286
|
-
const
|
|
287
|
-
fency:
|
|
288
|
-
loading:
|
|
289
|
-
error:
|
|
522
|
+
const p = y.length > 0 ? y[y.length - 1] : null, f = {
|
|
523
|
+
fency: n,
|
|
524
|
+
loading: l,
|
|
525
|
+
error: c,
|
|
290
526
|
activeStreams: y,
|
|
291
|
-
latestStream:
|
|
527
|
+
latestStream: p,
|
|
292
528
|
eventManager: m.current,
|
|
293
529
|
getOrCreateStream: g
|
|
294
530
|
};
|
|
295
|
-
return /* @__PURE__ */ o(
|
|
531
|
+
return /* @__PURE__ */ o(ie.Provider, { value: f, children: t });
|
|
296
532
|
}
|
|
297
|
-
function
|
|
298
|
-
const e =
|
|
533
|
+
function ae() {
|
|
534
|
+
const e = he(ie);
|
|
299
535
|
if (e === void 0)
|
|
300
536
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
301
537
|
return e;
|
|
302
538
|
}
|
|
303
|
-
const
|
|
539
|
+
const Le = (e) => {
|
|
304
540
|
try {
|
|
305
|
-
const
|
|
306
|
-
return Pe(
|
|
307
|
-
} catch (
|
|
308
|
-
return console.error("Error parsing message:",
|
|
541
|
+
const r = JSON.parse(e);
|
|
542
|
+
return Pe(r);
|
|
543
|
+
} catch (r) {
|
|
544
|
+
return console.error("Error parsing message:", r), null;
|
|
309
545
|
}
|
|
310
|
-
}, Pe = (e) =>
|
|
546
|
+
}, Pe = (e) => de(e) ? De(e) : me(e) ? Be(e) : ue(e) ? Oe(e) : null, De = (e) => ({
|
|
311
547
|
type: "STREAM_TIMEOUT",
|
|
312
548
|
streamId: e.streamId,
|
|
313
549
|
timestamp: e.timestamp
|
|
314
|
-
}),
|
|
550
|
+
}), Be = (e) => ({
|
|
315
551
|
type: "STREAM_NOT_FOUND",
|
|
316
552
|
streamId: e.streamId,
|
|
317
553
|
timestamp: e.timestamp
|
|
318
|
-
}),
|
|
554
|
+
}), Oe = (e) => ({
|
|
319
555
|
type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
|
|
320
556
|
streamId: e.streamId,
|
|
321
557
|
agentTaskId: e.agentTaskId,
|
|
@@ -323,30 +559,30 @@ const Fe = (e) => {
|
|
|
323
559
|
timestamp: e.timestamp,
|
|
324
560
|
createdAt: e.createdAt,
|
|
325
561
|
data: JSON.parse(e.data)
|
|
326
|
-
}),
|
|
327
|
-
const
|
|
328
|
-
return
|
|
329
|
-
if (!
|
|
330
|
-
const
|
|
562
|
+
}), We = (e) => {
|
|
563
|
+
const r = ae(), [t, n] = I(null), i = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
564
|
+
return A(() => {
|
|
565
|
+
if (!r.eventManager) return;
|
|
566
|
+
const a = {
|
|
331
567
|
onMessage: (u, y) => {
|
|
332
|
-
var
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
335
|
-
switch (
|
|
568
|
+
var d, m, g;
|
|
569
|
+
const s = Le(u);
|
|
570
|
+
if (s)
|
|
571
|
+
switch (s.type) {
|
|
336
572
|
case "STREAM_TIMEOUT":
|
|
337
|
-
(
|
|
573
|
+
(d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, s);
|
|
338
574
|
break;
|
|
339
575
|
case "STREAM_NOT_FOUND":
|
|
340
|
-
(m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e,
|
|
576
|
+
(m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, s);
|
|
341
577
|
break;
|
|
342
578
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
343
|
-
(g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e,
|
|
579
|
+
(g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e, s);
|
|
344
580
|
break;
|
|
345
581
|
}
|
|
346
582
|
},
|
|
347
583
|
onError: (u, y) => {
|
|
348
|
-
var
|
|
349
|
-
(
|
|
584
|
+
var s;
|
|
585
|
+
(s = e == null ? void 0 : e.onStreamError) == null || s.call(e, {
|
|
350
586
|
streamId: u,
|
|
351
587
|
error: {
|
|
352
588
|
code: "UnknownError",
|
|
@@ -355,24 +591,24 @@ const Fe = (e) => {
|
|
|
355
591
|
});
|
|
356
592
|
}
|
|
357
593
|
};
|
|
358
|
-
return
|
|
359
|
-
|
|
360
|
-
|
|
594
|
+
return r.eventManager.subscribe(
|
|
595
|
+
i.current,
|
|
596
|
+
a
|
|
361
597
|
);
|
|
362
|
-
}, [
|
|
598
|
+
}, [r.eventManager, e]), {
|
|
363
599
|
createStream: async () => {
|
|
364
600
|
try {
|
|
365
|
-
const
|
|
366
|
-
return
|
|
601
|
+
const a = await r.getOrCreateStream();
|
|
602
|
+
return n(a), {
|
|
367
603
|
type: "success",
|
|
368
|
-
stream:
|
|
604
|
+
stream: a
|
|
369
605
|
};
|
|
370
|
-
} catch (
|
|
606
|
+
} catch (a) {
|
|
371
607
|
return {
|
|
372
608
|
type: "error",
|
|
373
609
|
error: {
|
|
374
610
|
code: "UnknownError",
|
|
375
|
-
message:
|
|
611
|
+
message: a instanceof Error ? a.message : "Failed to create stream"
|
|
376
612
|
}
|
|
377
613
|
};
|
|
378
614
|
}
|
|
@@ -380,292 +616,292 @@ const Fe = (e) => {
|
|
|
380
616
|
stream: t
|
|
381
617
|
};
|
|
382
618
|
}, Pr = (e) => {
|
|
383
|
-
const
|
|
384
|
-
(
|
|
385
|
-
|
|
386
|
-
const g = [],
|
|
387
|
-
var
|
|
388
|
-
if (f.streamId !==
|
|
389
|
-
const
|
|
390
|
-
return
|
|
619
|
+
const r = ae(), [t, n] = I([]), i = F(/* @__PURE__ */ new Set()), l = F(/* @__PURE__ */ new Map()), a = O(
|
|
620
|
+
(s, d) => {
|
|
621
|
+
n((m) => {
|
|
622
|
+
const g = [], p = m.map((f) => {
|
|
623
|
+
var k;
|
|
624
|
+
if (f.streamId !== s || !f.loading) return f;
|
|
625
|
+
const x = (k = f.confirmedData) == null ? void 0 : k.taskId;
|
|
626
|
+
return x && g.push(x), { ...f, loading: !1, error: d };
|
|
391
627
|
});
|
|
392
628
|
for (const f of g) {
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
629
|
+
i.current.delete(f);
|
|
630
|
+
const x = l.current.get(f);
|
|
631
|
+
x && (l.current.delete(f), x({ type: "error", error: d }));
|
|
396
632
|
}
|
|
397
|
-
return
|
|
633
|
+
return p;
|
|
398
634
|
});
|
|
399
635
|
},
|
|
400
636
|
[]
|
|
401
|
-
), { createStream:
|
|
402
|
-
onAgentTaskProgressItemUpdated: (
|
|
637
|
+
), { createStream: c } = We({
|
|
638
|
+
onAgentTaskProgressItemUpdated: (s) => {
|
|
403
639
|
var g;
|
|
404
|
-
if (!
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
var
|
|
411
|
-
if (((
|
|
412
|
-
return
|
|
413
|
-
const
|
|
414
|
-
(
|
|
415
|
-
) ?
|
|
416
|
-
(
|
|
417
|
-
) : [...
|
|
640
|
+
if (!i.current.has(s.agentTaskId)) return;
|
|
641
|
+
const d = s.data;
|
|
642
|
+
if (d.taskType === "StreamingChatCompletion" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed" || d.taskType === "MemoryChat" && d.eventType === "Completed" || d.taskType === "MemorySearch" && d.eventType === "Completed") {
|
|
643
|
+
const p = d.taskType === "MemorySearch" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed";
|
|
644
|
+
n(
|
|
645
|
+
p ? (x) => x.map((k) => {
|
|
646
|
+
var w;
|
|
647
|
+
if (((w = k.confirmedData) == null ? void 0 : w.taskId) !== s.agentTaskId)
|
|
648
|
+
return k;
|
|
649
|
+
const S = k.progressItems.some(
|
|
650
|
+
(T) => T.progressItemId === s.progressItemId
|
|
651
|
+
) ? k.progressItems.map(
|
|
652
|
+
(T) => T.progressItemId === s.progressItemId ? s : T
|
|
653
|
+
) : [...k.progressItems, s];
|
|
418
654
|
return {
|
|
419
|
-
...
|
|
420
|
-
progressItems:
|
|
655
|
+
...k,
|
|
656
|
+
progressItems: S,
|
|
421
657
|
loading: !1
|
|
422
658
|
};
|
|
423
|
-
}) : (
|
|
424
|
-
(
|
|
425
|
-
var
|
|
426
|
-
return ((
|
|
659
|
+
}) : (x) => x.map(
|
|
660
|
+
(k) => {
|
|
661
|
+
var b;
|
|
662
|
+
return ((b = k.confirmedData) == null ? void 0 : b.taskId) === s.agentTaskId ? { ...k, loading: !1 } : k;
|
|
427
663
|
}
|
|
428
664
|
)
|
|
429
665
|
);
|
|
430
|
-
const f =
|
|
431
|
-
|
|
666
|
+
const f = l.current.get(
|
|
667
|
+
s.agentTaskId
|
|
432
668
|
);
|
|
433
|
-
f && (
|
|
669
|
+
f && (l.current.delete(s.agentTaskId), f({
|
|
434
670
|
type: "success",
|
|
435
|
-
streamId:
|
|
436
|
-
agentTaskId:
|
|
437
|
-
response:
|
|
671
|
+
streamId: s.streamId,
|
|
672
|
+
agentTaskId: s.agentTaskId,
|
|
673
|
+
response: d
|
|
438
674
|
}));
|
|
439
675
|
return;
|
|
440
676
|
}
|
|
441
|
-
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e,
|
|
442
|
-
(
|
|
443
|
-
var
|
|
444
|
-
if (((
|
|
677
|
+
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, s), n(
|
|
678
|
+
(p) => p.map((f) => {
|
|
679
|
+
var b;
|
|
680
|
+
if (((b = f.confirmedData) == null ? void 0 : b.taskId) !== s.agentTaskId)
|
|
445
681
|
return f;
|
|
446
|
-
const
|
|
447
|
-
(
|
|
682
|
+
const k = f.progressItems.some(
|
|
683
|
+
(S) => S.progressItemId === s.progressItemId
|
|
448
684
|
) ? f.progressItems.map(
|
|
449
|
-
(
|
|
450
|
-
) : [...f.progressItems,
|
|
451
|
-
return { ...f, progressItems:
|
|
685
|
+
(S) => S.progressItemId === s.progressItemId ? s : S
|
|
686
|
+
) : [...f.progressItems, s];
|
|
687
|
+
return { ...f, progressItems: k };
|
|
452
688
|
})
|
|
453
689
|
);
|
|
454
690
|
},
|
|
455
|
-
onStreamError: (
|
|
456
|
-
var
|
|
457
|
-
(
|
|
691
|
+
onStreamError: (s) => {
|
|
692
|
+
var d;
|
|
693
|
+
(d = e == null ? void 0 : e.onStreamError) == null || d.call(e, s), a(s.streamId, s.error);
|
|
458
694
|
},
|
|
459
|
-
onStreamNotFound: (
|
|
460
|
-
var
|
|
461
|
-
(
|
|
695
|
+
onStreamNotFound: (s) => {
|
|
696
|
+
var d;
|
|
697
|
+
(d = e == null ? void 0 : e.onStreamNotFound) == null || d.call(e, s), a(s.streamId, {
|
|
462
698
|
code: "StreamNotFound",
|
|
463
699
|
message: "Stream not found"
|
|
464
700
|
});
|
|
465
701
|
},
|
|
466
|
-
onStreamTimeout: (
|
|
467
|
-
var
|
|
468
|
-
(
|
|
702
|
+
onStreamTimeout: (s) => {
|
|
703
|
+
var d;
|
|
704
|
+
(d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, s), a(s.streamId, {
|
|
469
705
|
code: "StreamTimeout",
|
|
470
706
|
message: "Stream timed out"
|
|
471
707
|
});
|
|
472
708
|
}
|
|
473
|
-
}), u =
|
|
474
|
-
async (
|
|
709
|
+
}), u = O(
|
|
710
|
+
async (s, d) => {
|
|
475
711
|
var f;
|
|
476
|
-
const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = (
|
|
712
|
+
const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = (d == null ? void 0 : d.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
|
|
477
713
|
if (g === void 0)
|
|
478
714
|
throw new Error(
|
|
479
715
|
"fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
|
|
480
716
|
);
|
|
481
|
-
const
|
|
482
|
-
if (
|
|
483
|
-
const
|
|
717
|
+
const p = await c();
|
|
718
|
+
if (p.type === "success") {
|
|
719
|
+
const x = (/* @__PURE__ */ new Date()).toISOString(), k = {
|
|
484
720
|
taskKey: m,
|
|
485
|
-
streamId:
|
|
486
|
-
triggeredAt:
|
|
721
|
+
streamId: p.stream.id,
|
|
722
|
+
triggeredAt: x,
|
|
487
723
|
confirmedData: null,
|
|
488
724
|
error: null,
|
|
489
|
-
params:
|
|
725
|
+
params: s,
|
|
490
726
|
progressItems: [],
|
|
491
727
|
loading: !0,
|
|
492
|
-
loadingText:
|
|
728
|
+
loadingText: d == null ? void 0 : d.loadingText
|
|
493
729
|
};
|
|
494
|
-
|
|
730
|
+
n((b) => [...b, k]), (f = d == null ? void 0 : d.onTaskRegistered) == null || f.call(d, k);
|
|
495
731
|
try {
|
|
496
|
-
const { clientToken:
|
|
497
|
-
pk:
|
|
498
|
-
baseUrl:
|
|
499
|
-
clientToken:
|
|
500
|
-
streamToken:
|
|
732
|
+
const { clientToken: b } = await g(), S = await ye({
|
|
733
|
+
pk: r.fency.publishableKey,
|
|
734
|
+
baseUrl: r.fency.baseUrl,
|
|
735
|
+
clientToken: b,
|
|
736
|
+
streamToken: p.stream.token,
|
|
501
737
|
request: {
|
|
502
|
-
streamingChatCompletionTask:
|
|
503
|
-
messages:
|
|
504
|
-
model:
|
|
505
|
-
...
|
|
506
|
-
temperature:
|
|
738
|
+
streamingChatCompletionTask: s.type === "StreamingChatCompletion" ? {
|
|
739
|
+
messages: s.messages,
|
|
740
|
+
model: s.model,
|
|
741
|
+
...s.temperature !== void 0 ? {
|
|
742
|
+
temperature: s.temperature
|
|
507
743
|
} : {},
|
|
508
|
-
...
|
|
744
|
+
...s.topP !== void 0 ? { topP: s.topP } : {}
|
|
509
745
|
} : void 0,
|
|
510
|
-
structuredChatCompletionTask:
|
|
511
|
-
messages:
|
|
512
|
-
jsonSchema:
|
|
513
|
-
model:
|
|
514
|
-
...
|
|
515
|
-
temperature:
|
|
746
|
+
structuredChatCompletionTask: s.type === "StructuredChatCompletion" ? {
|
|
747
|
+
messages: s.messages,
|
|
748
|
+
jsonSchema: s.jsonSchema,
|
|
749
|
+
model: s.model,
|
|
750
|
+
...s.temperature !== void 0 ? {
|
|
751
|
+
temperature: s.temperature
|
|
516
752
|
} : {},
|
|
517
|
-
...
|
|
753
|
+
...s.topP !== void 0 ? { topP: s.topP } : {}
|
|
518
754
|
} : void 0,
|
|
519
|
-
memoryChatTask:
|
|
520
|
-
messages:
|
|
521
|
-
model:
|
|
522
|
-
language:
|
|
523
|
-
chunkLimit:
|
|
524
|
-
memoryScanLimit:
|
|
755
|
+
memoryChatTask: s.type === "MemoryChat" ? {
|
|
756
|
+
messages: s.messages,
|
|
757
|
+
model: s.model,
|
|
758
|
+
language: s.language ?? "en",
|
|
759
|
+
chunkLimit: s.chunkLimit ?? 10,
|
|
760
|
+
memoryScanLimit: s.memoryScanLimit ?? 3
|
|
525
761
|
} : void 0,
|
|
526
|
-
memorySearchTask:
|
|
527
|
-
query:
|
|
528
|
-
model:
|
|
529
|
-
language:
|
|
530
|
-
chunkLimit:
|
|
531
|
-
contextExpansion:
|
|
532
|
-
...
|
|
533
|
-
queryExpansion:
|
|
762
|
+
memorySearchTask: s.type === "MemorySearch" ? {
|
|
763
|
+
query: s.query,
|
|
764
|
+
model: s.model,
|
|
765
|
+
language: s.language ?? "en",
|
|
766
|
+
chunkLimit: s.chunkLimit ?? 10,
|
|
767
|
+
contextExpansion: s.contextExpansion,
|
|
768
|
+
...s.queryExpansion != null ? {
|
|
769
|
+
queryExpansion: s.queryExpansion
|
|
534
770
|
} : {}
|
|
535
771
|
} : void 0
|
|
536
772
|
}
|
|
537
773
|
});
|
|
538
|
-
if (
|
|
539
|
-
return
|
|
540
|
-
|
|
541
|
-
),
|
|
542
|
-
...
|
|
774
|
+
if (S.type === "success" && S.agentTask)
|
|
775
|
+
return i.current.add(
|
|
776
|
+
S.agentTask.id
|
|
777
|
+
), n((w) => [
|
|
778
|
+
...w.filter((T) => T.taskKey !== m),
|
|
543
779
|
{
|
|
544
780
|
taskKey: m,
|
|
545
|
-
streamId:
|
|
781
|
+
streamId: p.stream.id,
|
|
546
782
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
547
|
-
taskId:
|
|
548
|
-
createdAt:
|
|
783
|
+
taskId: S.agentTask.id,
|
|
784
|
+
createdAt: S.agentTask.createdAt,
|
|
549
785
|
error: null,
|
|
550
|
-
params:
|
|
786
|
+
params: s,
|
|
551
787
|
progressItems: [],
|
|
552
788
|
loading: !0,
|
|
553
|
-
loadingText:
|
|
789
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
554
790
|
confirmedData: {
|
|
555
|
-
taskId:
|
|
556
|
-
createdAt:
|
|
791
|
+
taskId: S.agentTask.id,
|
|
792
|
+
createdAt: S.agentTask.createdAt
|
|
557
793
|
}
|
|
558
794
|
}
|
|
559
795
|
]), await new Promise(
|
|
560
|
-
(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
796
|
+
(w) => {
|
|
797
|
+
l.current.set(
|
|
798
|
+
S.agentTask.id,
|
|
799
|
+
w
|
|
564
800
|
);
|
|
565
801
|
}
|
|
566
802
|
);
|
|
567
|
-
if (
|
|
568
|
-
return
|
|
569
|
-
...
|
|
803
|
+
if (S.type === "error")
|
|
804
|
+
return n((w) => [
|
|
805
|
+
...w.filter((T) => T.taskKey !== m),
|
|
570
806
|
{
|
|
571
807
|
taskKey: m,
|
|
572
808
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
573
|
-
streamId:
|
|
574
|
-
params:
|
|
575
|
-
error:
|
|
809
|
+
streamId: p.stream.id,
|
|
810
|
+
params: s,
|
|
811
|
+
error: S.error,
|
|
576
812
|
progressItems: [],
|
|
577
813
|
loading: !1,
|
|
578
|
-
loadingText:
|
|
814
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
579
815
|
confirmedData: null
|
|
580
816
|
}
|
|
581
817
|
]), {
|
|
582
818
|
type: "error",
|
|
583
|
-
error:
|
|
819
|
+
error: S.error
|
|
584
820
|
};
|
|
585
821
|
{
|
|
586
|
-
const
|
|
822
|
+
const w = {
|
|
587
823
|
message: "No response received",
|
|
588
824
|
code: "UnknownError"
|
|
589
825
|
};
|
|
590
|
-
return
|
|
591
|
-
...
|
|
826
|
+
return n((T) => [
|
|
827
|
+
...T.filter((L) => L.taskKey !== m),
|
|
592
828
|
{
|
|
593
829
|
taskKey: m,
|
|
594
830
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
595
|
-
streamId:
|
|
596
|
-
error:
|
|
597
|
-
params:
|
|
831
|
+
streamId: p.stream.id,
|
|
832
|
+
error: w,
|
|
833
|
+
params: s,
|
|
598
834
|
progressItems: [],
|
|
599
835
|
loading: !1,
|
|
600
|
-
loadingText:
|
|
836
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
601
837
|
confirmedData: null
|
|
602
838
|
}
|
|
603
839
|
]), {
|
|
604
840
|
type: "error",
|
|
605
|
-
error:
|
|
841
|
+
error: w
|
|
606
842
|
};
|
|
607
843
|
}
|
|
608
|
-
} catch (
|
|
609
|
-
const
|
|
844
|
+
} catch (b) {
|
|
845
|
+
const S = {
|
|
610
846
|
code: "UnknownError",
|
|
611
|
-
message:
|
|
847
|
+
message: b instanceof Error ? b.message : "Unknown error during agent task creation"
|
|
612
848
|
};
|
|
613
|
-
return
|
|
614
|
-
...
|
|
849
|
+
return n((w) => [
|
|
850
|
+
...w.filter((T) => T.taskKey !== m),
|
|
615
851
|
{
|
|
616
852
|
taskKey: m,
|
|
617
853
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
618
|
-
streamId:
|
|
619
|
-
params:
|
|
620
|
-
error:
|
|
854
|
+
streamId: p.stream.id,
|
|
855
|
+
params: s,
|
|
856
|
+
error: S,
|
|
621
857
|
progressItems: [],
|
|
622
858
|
loading: !1,
|
|
623
|
-
loadingText:
|
|
859
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
624
860
|
confirmedData: null
|
|
625
861
|
}
|
|
626
862
|
]), {
|
|
627
863
|
type: "error",
|
|
628
|
-
error:
|
|
864
|
+
error: S
|
|
629
865
|
};
|
|
630
866
|
}
|
|
631
867
|
} else
|
|
632
|
-
return console.error(
|
|
868
|
+
return console.error(p.error), p;
|
|
633
869
|
},
|
|
634
870
|
[
|
|
635
|
-
|
|
636
|
-
|
|
871
|
+
r,
|
|
872
|
+
c,
|
|
637
873
|
e.fetchCreateAgentTaskClientToken,
|
|
638
|
-
|
|
874
|
+
a
|
|
639
875
|
]
|
|
640
|
-
), y =
|
|
876
|
+
), y = B(() => {
|
|
641
877
|
if (t.length !== 0)
|
|
642
|
-
return [...t].sort((
|
|
878
|
+
return [...t].sort((s, d) => new Date(d.triggeredAt).getTime() - new Date(s.triggeredAt).getTime())[0];
|
|
643
879
|
}, [t]);
|
|
644
|
-
return
|
|
645
|
-
|
|
880
|
+
return A(() => () => {
|
|
881
|
+
i.current.clear(), l.current.clear();
|
|
646
882
|
}, []), {
|
|
647
883
|
agentTasks: t,
|
|
648
884
|
createAgentTask: u,
|
|
649
885
|
latest: y
|
|
650
886
|
};
|
|
651
887
|
};
|
|
652
|
-
function
|
|
653
|
-
return e.progressItems.map((
|
|
654
|
-
const
|
|
655
|
-
let
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
658
|
-
|
|
888
|
+
function ze(e) {
|
|
889
|
+
return e.progressItems.map((r, t) => {
|
|
890
|
+
const n = e.progressItems[t + 1], i = n != null;
|
|
891
|
+
let l;
|
|
892
|
+
if (n != null && n.createdAt) {
|
|
893
|
+
const a = new Date(r.createdAt).getTime(), c = new Date(n.createdAt).getTime();
|
|
894
|
+
l = Math.round((c - a) / 1e3);
|
|
659
895
|
}
|
|
660
896
|
return {
|
|
661
|
-
item:
|
|
662
|
-
completed:
|
|
897
|
+
item: r,
|
|
898
|
+
completed: i,
|
|
663
899
|
isLatest: t === e.progressItems.length - 1,
|
|
664
|
-
durationSeconds:
|
|
900
|
+
durationSeconds: l
|
|
665
901
|
};
|
|
666
902
|
});
|
|
667
903
|
}
|
|
668
|
-
const
|
|
904
|
+
const se = {
|
|
669
905
|
'code[class*="language-"]': {
|
|
670
906
|
color: "#f8f8f2",
|
|
671
907
|
background: "none",
|
|
@@ -816,57 +1052,57 @@ const ie = {
|
|
|
816
1052
|
italic: {
|
|
817
1053
|
fontStyle: "italic"
|
|
818
1054
|
}
|
|
819
|
-
},
|
|
1055
|
+
}, ne = ({
|
|
820
1056
|
text: e
|
|
821
1057
|
}) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
822
|
-
|
|
1058
|
+
C.div,
|
|
823
1059
|
{
|
|
824
1060
|
className: "fency-markdown-body-raw",
|
|
825
1061
|
initial: { opacity: 0, y: -10 },
|
|
826
1062
|
animate: { opacity: 1, y: 0 },
|
|
827
1063
|
transition: { duration: 0.3, delay: 0 },
|
|
828
1064
|
children: /* @__PURE__ */ o(
|
|
829
|
-
|
|
1065
|
+
Se,
|
|
830
1066
|
{
|
|
831
|
-
remarkPlugins: [
|
|
1067
|
+
remarkPlugins: [xe],
|
|
832
1068
|
components: {
|
|
833
|
-
code(
|
|
834
|
-
const { children: t, className:
|
|
835
|
-
return
|
|
1069
|
+
code(r) {
|
|
1070
|
+
const { children: t, className: n, node: i, ref: l, ...a } = r, c = /language-(\w+)/.exec(n || "");
|
|
1071
|
+
return c ? (
|
|
836
1072
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
837
1073
|
/* @__PURE__ */ o(
|
|
838
|
-
|
|
1074
|
+
oe,
|
|
839
1075
|
{
|
|
840
|
-
...
|
|
1076
|
+
...a,
|
|
841
1077
|
PreTag: "div",
|
|
842
1078
|
children: String(t).replace(/\n$/, ""),
|
|
843
|
-
language:
|
|
844
|
-
style:
|
|
1079
|
+
language: c[1],
|
|
1080
|
+
style: se
|
|
845
1081
|
}
|
|
846
1082
|
)
|
|
847
|
-
) : /* @__PURE__ */ o("code", { ...
|
|
1083
|
+
) : /* @__PURE__ */ o("code", { ...a, className: n, children: String(t) });
|
|
848
1084
|
}
|
|
849
1085
|
},
|
|
850
1086
|
children: e
|
|
851
1087
|
}
|
|
852
1088
|
)
|
|
853
1089
|
}
|
|
854
|
-
) }),
|
|
855
|
-
const
|
|
1090
|
+
) }), Ne = ({ data: e }) => {
|
|
1091
|
+
const r = JSON.stringify(
|
|
856
1092
|
JSON.parse(e.response.jsonResponse),
|
|
857
1093
|
null,
|
|
858
1094
|
2
|
|
859
1095
|
);
|
|
860
1096
|
return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
|
|
861
|
-
|
|
1097
|
+
C.div,
|
|
862
1098
|
{
|
|
863
1099
|
initial: { opacity: 0, y: -10 },
|
|
864
1100
|
animate: { opacity: 1, y: 0 },
|
|
865
1101
|
transition: { duration: 0.3, delay: 0 },
|
|
866
|
-
children: /* @__PURE__ */ o(
|
|
1102
|
+
children: /* @__PURE__ */ o(oe, { language: "json", style: se, PreTag: "div", children: r })
|
|
867
1103
|
}
|
|
868
1104
|
) });
|
|
869
|
-
},
|
|
1105
|
+
}, $e = {
|
|
870
1106
|
en: {
|
|
871
1107
|
error: "Error",
|
|
872
1108
|
streaming: "Streaming...",
|
|
@@ -990,44 +1226,44 @@ const ie = {
|
|
|
990
1226
|
memoryChatChunkResultsInOneMemory: "i 1 minne"
|
|
991
1227
|
}
|
|
992
1228
|
};
|
|
993
|
-
function
|
|
994
|
-
return
|
|
1229
|
+
function He(e) {
|
|
1230
|
+
return $e[e];
|
|
995
1231
|
}
|
|
996
|
-
function
|
|
997
|
-
return Object.entries(
|
|
998
|
-
(t, [
|
|
1232
|
+
function v(e, r) {
|
|
1233
|
+
return Object.entries(r).reduce(
|
|
1234
|
+
(t, [n, i]) => t.replace(`{${n}}`, String(i)),
|
|
999
1235
|
e
|
|
1000
1236
|
);
|
|
1001
1237
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const t = e.map((
|
|
1004
|
-
if (
|
|
1005
|
-
const
|
|
1006
|
-
return t.length > 0 ? `${t.join(", ")} ${
|
|
1238
|
+
function G(e, r) {
|
|
1239
|
+
const t = e.map((n) => `'${n}'`);
|
|
1240
|
+
if (r != null && t.length >= 2) {
|
|
1241
|
+
const n = t.pop();
|
|
1242
|
+
return t.length > 0 ? `${t.join(", ")} ${r} ${n}` : n;
|
|
1007
1243
|
}
|
|
1008
1244
|
return t.join(", ");
|
|
1009
1245
|
}
|
|
1010
1246
|
function M({
|
|
1011
1247
|
text: e,
|
|
1012
|
-
duration:
|
|
1248
|
+
duration: r = 2,
|
|
1013
1249
|
delay: t = 0,
|
|
1014
|
-
repeat:
|
|
1015
|
-
repeatDelay:
|
|
1016
|
-
className:
|
|
1017
|
-
startOnView:
|
|
1018
|
-
once:
|
|
1250
|
+
repeat: n = !0,
|
|
1251
|
+
repeatDelay: i = 0.5,
|
|
1252
|
+
className: l,
|
|
1253
|
+
startOnView: a = !1,
|
|
1254
|
+
once: c = !1,
|
|
1019
1255
|
inViewMargin: u,
|
|
1020
1256
|
spread: y = 2,
|
|
1021
|
-
color:
|
|
1022
|
-
shimmerColor:
|
|
1257
|
+
color: s = "#999",
|
|
1258
|
+
shimmerColor: d = "#000",
|
|
1023
1259
|
direction: m = "fromBottom"
|
|
1024
1260
|
}) {
|
|
1025
|
-
const g = F(null),
|
|
1261
|
+
const g = F(null), p = pe(g, { once: c, margin: u }), f = B(() => e.length * y, [e, y]), x = !a || p, k = m === "fromBottom" ? "100% center" : "-100% center", b = m === "fromBottom" ? "0% center" : "200% center";
|
|
1026
1262
|
return /* @__PURE__ */ o(
|
|
1027
|
-
|
|
1263
|
+
C.span,
|
|
1028
1264
|
{
|
|
1029
1265
|
ref: g,
|
|
1030
|
-
className:
|
|
1266
|
+
className: l,
|
|
1031
1267
|
style: {
|
|
1032
1268
|
position: "relative",
|
|
1033
1269
|
display: "inline-block",
|
|
@@ -1038,25 +1274,25 @@ function M({
|
|
|
1038
1274
|
WebkitTextFillColor: "transparent",
|
|
1039
1275
|
backgroundRepeat: "no-repeat, padding-box",
|
|
1040
1276
|
"--spread": `${f}px`,
|
|
1041
|
-
"--base-color":
|
|
1042
|
-
"--shimmer-color":
|
|
1277
|
+
"--base-color": s,
|
|
1278
|
+
"--shimmer-color": d,
|
|
1043
1279
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
1044
1280
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
1045
1281
|
},
|
|
1046
1282
|
initial: {
|
|
1047
|
-
backgroundPosition:
|
|
1283
|
+
backgroundPosition: k,
|
|
1048
1284
|
opacity: 0
|
|
1049
1285
|
},
|
|
1050
|
-
animate:
|
|
1051
|
-
backgroundPosition:
|
|
1286
|
+
animate: x ? {
|
|
1287
|
+
backgroundPosition: b,
|
|
1052
1288
|
opacity: 1
|
|
1053
1289
|
} : {},
|
|
1054
1290
|
transition: {
|
|
1055
1291
|
backgroundPosition: {
|
|
1056
|
-
repeat:
|
|
1057
|
-
duration:
|
|
1292
|
+
repeat: n ? 1 / 0 : 0,
|
|
1293
|
+
duration: r,
|
|
1058
1294
|
delay: t,
|
|
1059
|
-
repeatDelay:
|
|
1295
|
+
repeatDelay: i,
|
|
1060
1296
|
ease: "linear"
|
|
1061
1297
|
},
|
|
1062
1298
|
opacity: {
|
|
@@ -1068,20 +1304,20 @@ function M({
|
|
|
1068
1304
|
}
|
|
1069
1305
|
);
|
|
1070
1306
|
}
|
|
1071
|
-
const
|
|
1072
|
-
const [
|
|
1073
|
-
|
|
1074
|
-
m ?
|
|
1075
|
-
)}` : "", f = u ? `${g}${
|
|
1076
|
-
return /* @__PURE__ */
|
|
1307
|
+
const H = 5, Ue = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1308
|
+
const [i, l] = I(!1), c = (e.memories ?? []).map((x) => x.memoryTitle), u = c.length > 0, y = u && c.length > H, s = y && !i ? c.slice(0, H) : c, d = c.length - H, m = !y || i, g = `${n.searchingFor}'${e.queryDescription}'`, p = u ? `${n.searchingIn}${G(
|
|
1309
|
+
s,
|
|
1310
|
+
m ? n.and : void 0
|
|
1311
|
+
)}` : "", f = u ? `${g}${p}` : `${n.searchingPrefix}${e.queryDescription}`;
|
|
1312
|
+
return /* @__PURE__ */ h("div", { style: { padding: "16px" }, children: [
|
|
1077
1313
|
/* @__PURE__ */ o(
|
|
1078
|
-
|
|
1314
|
+
C.div,
|
|
1079
1315
|
{
|
|
1080
1316
|
style: { color: "#666" },
|
|
1081
1317
|
initial: { opacity: 0, y: -10 },
|
|
1082
1318
|
animate: { opacity: 1, y: 0 },
|
|
1083
1319
|
transition: { duration: 0.3, delay: 0 },
|
|
1084
|
-
children:
|
|
1320
|
+
children: r && !t && !y ? /* @__PURE__ */ o(
|
|
1085
1321
|
M,
|
|
1086
1322
|
{
|
|
1087
1323
|
text: f,
|
|
@@ -1090,23 +1326,23 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1090
1326
|
color: "#999",
|
|
1091
1327
|
shimmerColor: "#000"
|
|
1092
1328
|
}
|
|
1093
|
-
) : /* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: u ? /* @__PURE__ */
|
|
1095
|
-
|
|
1096
|
-
/* @__PURE__ */
|
|
1329
|
+
) : /* @__PURE__ */ h(E, { children: [
|
|
1330
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: u ? /* @__PURE__ */ h(E, { children: [
|
|
1331
|
+
n.searchingFor,
|
|
1332
|
+
/* @__PURE__ */ h("span", { style: { fontWeight: 600 }, children: [
|
|
1097
1333
|
"'",
|
|
1098
1334
|
e.queryDescription,
|
|
1099
1335
|
"'"
|
|
1100
1336
|
] }),
|
|
1101
|
-
|
|
1102
|
-
] }) : `${
|
|
1103
|
-
y && !
|
|
1337
|
+
p
|
|
1338
|
+
] }) : `${n.searchingPrefix}${e.queryDescription}` }),
|
|
1339
|
+
y && !i && /* @__PURE__ */ h(E, { children: [
|
|
1104
1340
|
" ",
|
|
1105
1341
|
/* @__PURE__ */ o(
|
|
1106
1342
|
"button",
|
|
1107
1343
|
{
|
|
1108
1344
|
type: "button",
|
|
1109
|
-
onClick: () =>
|
|
1345
|
+
onClick: () => l(!0),
|
|
1110
1346
|
style: {
|
|
1111
1347
|
background: "none",
|
|
1112
1348
|
border: "none",
|
|
@@ -1118,19 +1354,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1118
1354
|
textDecoration: "underline",
|
|
1119
1355
|
fontFamily: "inherit"
|
|
1120
1356
|
},
|
|
1121
|
-
children:
|
|
1122
|
-
n:
|
|
1357
|
+
children: v(n.moreMemories, {
|
|
1358
|
+
n: d
|
|
1123
1359
|
})
|
|
1124
1360
|
}
|
|
1125
1361
|
)
|
|
1126
1362
|
] }),
|
|
1127
|
-
y &&
|
|
1363
|
+
y && i && /* @__PURE__ */ h(E, { children: [
|
|
1128
1364
|
" ",
|
|
1129
1365
|
/* @__PURE__ */ o(
|
|
1130
1366
|
"button",
|
|
1131
1367
|
{
|
|
1132
1368
|
type: "button",
|
|
1133
|
-
onClick: () =>
|
|
1369
|
+
onClick: () => l(!1),
|
|
1134
1370
|
style: {
|
|
1135
1371
|
background: "none",
|
|
1136
1372
|
border: "none",
|
|
@@ -1142,7 +1378,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1142
1378
|
textDecoration: "underline",
|
|
1143
1379
|
fontFamily: "inherit"
|
|
1144
1380
|
},
|
|
1145
|
-
children:
|
|
1381
|
+
children: n.clickToCollapse
|
|
1146
1382
|
}
|
|
1147
1383
|
)
|
|
1148
1384
|
] })
|
|
@@ -1158,18 +1394,18 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1158
1394
|
marginTop: "4px",
|
|
1159
1395
|
fontStyle: "italic"
|
|
1160
1396
|
},
|
|
1161
|
-
children:
|
|
1397
|
+
children: v(n.tookSeconds, { n: t })
|
|
1162
1398
|
}
|
|
1163
1399
|
)
|
|
1164
1400
|
] });
|
|
1165
|
-
},
|
|
1166
|
-
const [
|
|
1401
|
+
}, U = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1402
|
+
const [i, l] = I(!1), a = e.titles, c = a.length > 0, u = c && a.length > U, y = u && !i ? a.slice(0, U) : a, s = a.length - U, d = !u || i, m = c ? `${n.findingMemoriesIn}${G(
|
|
1167
1403
|
y,
|
|
1168
|
-
|
|
1169
|
-
)}` :
|
|
1170
|
-
return /* @__PURE__ */
|
|
1404
|
+
d ? n.and : void 0
|
|
1405
|
+
)}` : n.findingMemories;
|
|
1406
|
+
return /* @__PURE__ */ h("div", { style: { padding: "16px" }, children: [
|
|
1171
1407
|
/* @__PURE__ */ o(
|
|
1172
|
-
|
|
1408
|
+
C.div,
|
|
1173
1409
|
{
|
|
1174
1410
|
style: {
|
|
1175
1411
|
color: "#666"
|
|
@@ -1177,7 +1413,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1177
1413
|
initial: { opacity: 0, y: -10 },
|
|
1178
1414
|
animate: { opacity: 1, y: 0 },
|
|
1179
1415
|
transition: { duration: 0.3, delay: 0 },
|
|
1180
|
-
children:
|
|
1416
|
+
children: r && !t && !u ? /* @__PURE__ */ o(
|
|
1181
1417
|
M,
|
|
1182
1418
|
{
|
|
1183
1419
|
text: m,
|
|
@@ -1186,15 +1422,15 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1186
1422
|
color: "#999",
|
|
1187
1423
|
shimmerColor: "#000"
|
|
1188
1424
|
}
|
|
1189
|
-
) : /* @__PURE__ */
|
|
1425
|
+
) : /* @__PURE__ */ h(E, { children: [
|
|
1190
1426
|
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: m }),
|
|
1191
|
-
u && !
|
|
1427
|
+
u && !i && /* @__PURE__ */ h(E, { children: [
|
|
1192
1428
|
" ",
|
|
1193
1429
|
/* @__PURE__ */ o(
|
|
1194
1430
|
"button",
|
|
1195
1431
|
{
|
|
1196
1432
|
type: "button",
|
|
1197
|
-
onClick: () =>
|
|
1433
|
+
onClick: () => l(!0),
|
|
1198
1434
|
style: {
|
|
1199
1435
|
background: "none",
|
|
1200
1436
|
border: "none",
|
|
@@ -1206,19 +1442,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1206
1442
|
textDecoration: "underline",
|
|
1207
1443
|
fontFamily: "inherit"
|
|
1208
1444
|
},
|
|
1209
|
-
children:
|
|
1210
|
-
n:
|
|
1445
|
+
children: v(n.moreMemories, {
|
|
1446
|
+
n: s
|
|
1211
1447
|
})
|
|
1212
1448
|
}
|
|
1213
1449
|
)
|
|
1214
1450
|
] }),
|
|
1215
|
-
u &&
|
|
1451
|
+
u && i && /* @__PURE__ */ h(E, { children: [
|
|
1216
1452
|
" ",
|
|
1217
1453
|
/* @__PURE__ */ o(
|
|
1218
1454
|
"button",
|
|
1219
1455
|
{
|
|
1220
1456
|
type: "button",
|
|
1221
|
-
onClick: () =>
|
|
1457
|
+
onClick: () => l(!1),
|
|
1222
1458
|
style: {
|
|
1223
1459
|
background: "none",
|
|
1224
1460
|
border: "none",
|
|
@@ -1230,7 +1466,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1230
1466
|
textDecoration: "underline",
|
|
1231
1467
|
fontFamily: "inherit"
|
|
1232
1468
|
},
|
|
1233
|
-
children:
|
|
1469
|
+
children: n.clickToCollapse
|
|
1234
1470
|
}
|
|
1235
1471
|
)
|
|
1236
1472
|
] })
|
|
@@ -1246,31 +1482,31 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1246
1482
|
marginTop: "4px",
|
|
1247
1483
|
fontStyle: "italic"
|
|
1248
1484
|
},
|
|
1249
|
-
children:
|
|
1485
|
+
children: v(n.tookSeconds, { n: t })
|
|
1250
1486
|
}
|
|
1251
1487
|
)
|
|
1252
1488
|
] });
|
|
1253
|
-
}, _ = 5,
|
|
1254
|
-
const [t,
|
|
1489
|
+
}, _ = 5, je = ({ data: e, t: r }) => {
|
|
1490
|
+
const [t, n] = I(!1), l = e.memories.map((g) => g.memoryTitle), a = l.length > 0, c = a && l.length > _, u = c && !t ? l.slice(0, _) : l, y = l.length - _, s = !c || t, d = l.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, m = a ? `${d}${G(
|
|
1255
1491
|
u,
|
|
1256
|
-
|
|
1257
|
-
)}` :
|
|
1492
|
+
s ? r.and : void 0
|
|
1493
|
+
)}` : r.memoriesFound;
|
|
1258
1494
|
return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
1259
|
-
|
|
1495
|
+
C.div,
|
|
1260
1496
|
{
|
|
1261
1497
|
style: { color: "#666" },
|
|
1262
1498
|
initial: { opacity: 0, y: -10 },
|
|
1263
1499
|
animate: { opacity: 1, y: 0 },
|
|
1264
1500
|
transition: { duration: 0.3, delay: 0 },
|
|
1265
|
-
children: /* @__PURE__ */
|
|
1501
|
+
children: /* @__PURE__ */ h(E, { children: [
|
|
1266
1502
|
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: m }),
|
|
1267
|
-
|
|
1503
|
+
c && !t && /* @__PURE__ */ h(E, { children: [
|
|
1268
1504
|
" ",
|
|
1269
1505
|
/* @__PURE__ */ o(
|
|
1270
1506
|
"button",
|
|
1271
1507
|
{
|
|
1272
1508
|
type: "button",
|
|
1273
|
-
onClick: () =>
|
|
1509
|
+
onClick: () => n(!0),
|
|
1274
1510
|
style: {
|
|
1275
1511
|
background: "none",
|
|
1276
1512
|
border: "none",
|
|
@@ -1282,19 +1518,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1282
1518
|
textDecoration: "underline",
|
|
1283
1519
|
fontFamily: "inherit"
|
|
1284
1520
|
},
|
|
1285
|
-
children:
|
|
1521
|
+
children: v(r.moreMemories, {
|
|
1286
1522
|
n: y
|
|
1287
1523
|
})
|
|
1288
1524
|
}
|
|
1289
1525
|
)
|
|
1290
1526
|
] }),
|
|
1291
|
-
|
|
1527
|
+
c && t && /* @__PURE__ */ h(E, { children: [
|
|
1292
1528
|
" ",
|
|
1293
1529
|
/* @__PURE__ */ o(
|
|
1294
1530
|
"button",
|
|
1295
1531
|
{
|
|
1296
1532
|
type: "button",
|
|
1297
|
-
onClick: () =>
|
|
1533
|
+
onClick: () => n(!1),
|
|
1298
1534
|
style: {
|
|
1299
1535
|
background: "none",
|
|
1300
1536
|
border: "none",
|
|
@@ -1306,18 +1542,18 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1306
1542
|
textDecoration: "underline",
|
|
1307
1543
|
fontFamily: "inherit"
|
|
1308
1544
|
},
|
|
1309
|
-
children:
|
|
1545
|
+
children: r.clickToCollapse
|
|
1310
1546
|
}
|
|
1311
1547
|
)
|
|
1312
1548
|
] })
|
|
1313
1549
|
] })
|
|
1314
1550
|
}
|
|
1315
1551
|
) });
|
|
1316
|
-
},
|
|
1317
|
-
const
|
|
1318
|
-
return /* @__PURE__ */
|
|
1552
|
+
}, Ge = ({ isLatest: e = !1, durationSeconds: r, t }) => {
|
|
1553
|
+
const n = t.addingSources;
|
|
1554
|
+
return /* @__PURE__ */ h("div", { style: { padding: "16px" }, children: [
|
|
1319
1555
|
/* @__PURE__ */ o(
|
|
1320
|
-
|
|
1556
|
+
C.div,
|
|
1321
1557
|
{
|
|
1322
1558
|
style: {
|
|
1323
1559
|
display: "flex",
|
|
@@ -1328,19 +1564,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1328
1564
|
initial: { opacity: 0, y: -10 },
|
|
1329
1565
|
animate: { opacity: 1, y: 0 },
|
|
1330
1566
|
transition: { duration: 0.3, delay: 0 },
|
|
1331
|
-
children: e && !
|
|
1567
|
+
children: e && !r ? /* @__PURE__ */ o(
|
|
1332
1568
|
M,
|
|
1333
1569
|
{
|
|
1334
|
-
text:
|
|
1570
|
+
text: n,
|
|
1335
1571
|
duration: 2.5,
|
|
1336
1572
|
repeat: !0,
|
|
1337
1573
|
color: "#999",
|
|
1338
1574
|
shimmerColor: "#000"
|
|
1339
1575
|
}
|
|
1340
|
-
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1576
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: n })
|
|
1341
1577
|
}
|
|
1342
1578
|
),
|
|
1343
|
-
|
|
1579
|
+
r !== void 0 && /* @__PURE__ */ o(
|
|
1344
1580
|
"div",
|
|
1345
1581
|
{
|
|
1346
1582
|
style: {
|
|
@@ -1349,28 +1585,28 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1349
1585
|
marginTop: "4px",
|
|
1350
1586
|
fontStyle: "italic"
|
|
1351
1587
|
},
|
|
1352
|
-
children:
|
|
1588
|
+
children: v(t.tookSeconds, { n: r })
|
|
1353
1589
|
}
|
|
1354
1590
|
)
|
|
1355
1591
|
] });
|
|
1356
1592
|
};
|
|
1357
|
-
function Qe(e,
|
|
1593
|
+
function Qe(e, r) {
|
|
1358
1594
|
if (e.length === 0) return "";
|
|
1359
1595
|
if (e.length === 1)
|
|
1360
|
-
return
|
|
1596
|
+
return v(r.pageSingle, { n: e[0] });
|
|
1361
1597
|
if (e.length === 2)
|
|
1362
|
-
return
|
|
1598
|
+
return v(r.pageTwo, {
|
|
1363
1599
|
a: e[0],
|
|
1364
1600
|
b: e[1]
|
|
1365
1601
|
});
|
|
1366
|
-
const t = e[e.length - 1],
|
|
1367
|
-
return
|
|
1602
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1603
|
+
return v(r.pageMultiple, { list: n, n: t });
|
|
1368
1604
|
}
|
|
1369
|
-
const
|
|
1370
|
-
const [
|
|
1371
|
-
return /* @__PURE__ */
|
|
1605
|
+
const qe = ({ data: e, onSourceClick: r, t }) => {
|
|
1606
|
+
const [n, i] = I(null);
|
|
1607
|
+
return /* @__PURE__ */ h("div", { style: { padding: "16px" }, children: [
|
|
1372
1608
|
/* @__PURE__ */ o(
|
|
1373
|
-
|
|
1609
|
+
C.div,
|
|
1374
1610
|
{
|
|
1375
1611
|
style: {
|
|
1376
1612
|
marginBottom: "10px",
|
|
@@ -1386,51 +1622,51 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1386
1622
|
children: t.sources
|
|
1387
1623
|
}
|
|
1388
1624
|
),
|
|
1389
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((
|
|
1390
|
-
|
|
1625
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((l, a) => /* @__PURE__ */ o(
|
|
1626
|
+
Ke,
|
|
1391
1627
|
{
|
|
1392
|
-
source:
|
|
1393
|
-
index:
|
|
1394
|
-
loadingMemoryId:
|
|
1395
|
-
setLoadingMemoryId:
|
|
1396
|
-
onSourceClick:
|
|
1628
|
+
source: l,
|
|
1629
|
+
index: a,
|
|
1630
|
+
loadingMemoryId: n,
|
|
1631
|
+
setLoadingMemoryId: i,
|
|
1632
|
+
onSourceClick: r,
|
|
1397
1633
|
t
|
|
1398
1634
|
},
|
|
1399
|
-
|
|
1635
|
+
l.memoryId
|
|
1400
1636
|
)) })
|
|
1401
1637
|
] });
|
|
1402
|
-
},
|
|
1638
|
+
}, Ke = ({
|
|
1403
1639
|
source: e,
|
|
1404
|
-
index:
|
|
1640
|
+
index: r,
|
|
1405
1641
|
loadingMemoryId: t,
|
|
1406
|
-
setLoadingMemoryId:
|
|
1407
|
-
onSourceClick:
|
|
1408
|
-
t:
|
|
1642
|
+
setLoadingMemoryId: n,
|
|
1643
|
+
onSourceClick: i,
|
|
1644
|
+
t: l
|
|
1409
1645
|
}) => {
|
|
1410
|
-
const [
|
|
1411
|
-
return /* @__PURE__ */
|
|
1412
|
-
|
|
1646
|
+
const [a, c] = I(!1), u = !!i, y = t === e.memoryId, s = e.pageNumbers ?? [], d = Qe(s, l);
|
|
1647
|
+
return /* @__PURE__ */ h(
|
|
1648
|
+
C.div,
|
|
1413
1649
|
{
|
|
1414
1650
|
"aria-busy": y,
|
|
1415
1651
|
initial: { opacity: 0, scale: 0.9 },
|
|
1416
1652
|
animate: { opacity: 1, scale: 1 },
|
|
1417
|
-
transition: { duration: 0.25, delay:
|
|
1653
|
+
transition: { duration: 0.25, delay: r * 0.05 },
|
|
1418
1654
|
onClick: u && !y ? async () => {
|
|
1419
|
-
|
|
1655
|
+
n(e.memoryId);
|
|
1420
1656
|
try {
|
|
1421
|
-
await
|
|
1657
|
+
await i({
|
|
1422
1658
|
memoryId: e.memoryId,
|
|
1423
1659
|
memoryTitle: e.memoryTitle,
|
|
1424
1660
|
memoryTypeId: e.memoryTypeId,
|
|
1425
1661
|
memoryTypeName: e.memoryTypeName,
|
|
1426
|
-
pageNumbers: [...
|
|
1662
|
+
pageNumbers: [...s]
|
|
1427
1663
|
});
|
|
1428
1664
|
} finally {
|
|
1429
|
-
|
|
1665
|
+
n(null);
|
|
1430
1666
|
}
|
|
1431
1667
|
} : void 0,
|
|
1432
|
-
onMouseEnter: u && !y ? () =>
|
|
1433
|
-
onMouseLeave: u && !y ? () =>
|
|
1668
|
+
onMouseEnter: u && !y ? () => c(!0) : void 0,
|
|
1669
|
+
onMouseLeave: u && !y ? () => c(!1) : void 0,
|
|
1434
1670
|
style: {
|
|
1435
1671
|
display: "inline-flex",
|
|
1436
1672
|
flexDirection: "column",
|
|
@@ -1438,14 +1674,14 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1438
1674
|
padding: "8px 12px",
|
|
1439
1675
|
borderRadius: "6px",
|
|
1440
1676
|
border: "1px solid #e0e0e0",
|
|
1441
|
-
backgroundColor:
|
|
1677
|
+
backgroundColor: a ? "#f5f5f5" : "transparent",
|
|
1442
1678
|
cursor: u && !y ? "pointer" : y ? "wait" : "default",
|
|
1443
1679
|
transition: "background-color 0.15s ease",
|
|
1444
1680
|
userSelect: "none",
|
|
1445
1681
|
pointerEvents: y ? "none" : void 0
|
|
1446
1682
|
},
|
|
1447
1683
|
children: [
|
|
1448
|
-
/* @__PURE__ */
|
|
1684
|
+
/* @__PURE__ */ h(
|
|
1449
1685
|
"span",
|
|
1450
1686
|
{
|
|
1451
1687
|
style: {
|
|
@@ -1468,57 +1704,57 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1468
1704
|
]
|
|
1469
1705
|
}
|
|
1470
1706
|
),
|
|
1471
|
-
|
|
1707
|
+
d && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: d })
|
|
1472
1708
|
]
|
|
1473
1709
|
}
|
|
1474
1710
|
);
|
|
1475
|
-
},
|
|
1711
|
+
}, D = ({
|
|
1476
1712
|
color: e = "#78b13f",
|
|
1477
|
-
size:
|
|
1713
|
+
size: r = 24,
|
|
1478
1714
|
borderWidth: t = 7
|
|
1479
1715
|
}) => {
|
|
1480
|
-
const
|
|
1716
|
+
const n = r * 0.5;
|
|
1481
1717
|
return /* @__PURE__ */ o(
|
|
1482
1718
|
"span",
|
|
1483
1719
|
{
|
|
1484
1720
|
style: {
|
|
1485
1721
|
display: "inline-block",
|
|
1486
1722
|
transform: "rotate(45deg)",
|
|
1487
|
-
height:
|
|
1488
|
-
width:
|
|
1723
|
+
height: r,
|
|
1724
|
+
width: n,
|
|
1489
1725
|
borderBottom: `${t}px solid ${e}`,
|
|
1490
1726
|
borderRight: `${t}px solid ${e}`
|
|
1491
1727
|
}
|
|
1492
1728
|
}
|
|
1493
1729
|
);
|
|
1494
|
-
},
|
|
1730
|
+
}, Q = ({
|
|
1495
1731
|
color: e = "#333",
|
|
1496
|
-
size:
|
|
1732
|
+
size: r = 32,
|
|
1497
1733
|
lineWidth: t = 2
|
|
1498
1734
|
}) => {
|
|
1499
|
-
const
|
|
1735
|
+
const n = r + 1, i = (r - t) / 2, l = (r - n) / 2, a = {
|
|
1500
1736
|
position: "absolute",
|
|
1501
|
-
left:
|
|
1502
|
-
top:
|
|
1737
|
+
left: i,
|
|
1738
|
+
top: l,
|
|
1503
1739
|
width: t,
|
|
1504
|
-
height:
|
|
1740
|
+
height: n,
|
|
1505
1741
|
backgroundColor: e
|
|
1506
1742
|
};
|
|
1507
|
-
return /* @__PURE__ */
|
|
1743
|
+
return /* @__PURE__ */ h(
|
|
1508
1744
|
"span",
|
|
1509
1745
|
{
|
|
1510
1746
|
style: {
|
|
1511
1747
|
position: "relative",
|
|
1512
1748
|
display: "inline-block",
|
|
1513
|
-
width:
|
|
1514
|
-
height:
|
|
1749
|
+
width: r,
|
|
1750
|
+
height: r
|
|
1515
1751
|
},
|
|
1516
1752
|
children: [
|
|
1517
1753
|
/* @__PURE__ */ o(
|
|
1518
1754
|
"span",
|
|
1519
1755
|
{
|
|
1520
1756
|
style: {
|
|
1521
|
-
...
|
|
1757
|
+
...a,
|
|
1522
1758
|
transform: "rotate(45deg)"
|
|
1523
1759
|
}
|
|
1524
1760
|
}
|
|
@@ -1527,7 +1763,7 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1527
1763
|
"span",
|
|
1528
1764
|
{
|
|
1529
1765
|
style: {
|
|
1530
|
-
...
|
|
1766
|
+
...a,
|
|
1531
1767
|
transform: "rotate(-45deg)"
|
|
1532
1768
|
}
|
|
1533
1769
|
}
|
|
@@ -1536,26 +1772,26 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1536
1772
|
}
|
|
1537
1773
|
);
|
|
1538
1774
|
};
|
|
1539
|
-
function
|
|
1775
|
+
function Ve({
|
|
1540
1776
|
memory: e,
|
|
1541
|
-
completed:
|
|
1777
|
+
completed: r
|
|
1542
1778
|
}) {
|
|
1543
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
1779
|
+
return e.error != null ? /* @__PURE__ */ o(Q, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(D, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(D, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
1544
1780
|
}
|
|
1545
|
-
const
|
|
1546
|
-
function
|
|
1781
|
+
const te = 80;
|
|
1782
|
+
function Xe({
|
|
1547
1783
|
memory: e,
|
|
1548
|
-
completed:
|
|
1784
|
+
completed: r,
|
|
1549
1785
|
t
|
|
1550
1786
|
}) {
|
|
1551
|
-
const [
|
|
1552
|
-
return /* @__PURE__ */
|
|
1553
|
-
|
|
1787
|
+
const [n, i] = I(!1), l = e.result ?? e.error, a = l != null && l.length > te, c = l != null ? n || !a ? l : `${l.slice(0, te)}...` : void 0, u = a, y = e.error != null;
|
|
1788
|
+
return /* @__PURE__ */ h(
|
|
1789
|
+
C.div,
|
|
1554
1790
|
{
|
|
1555
1791
|
initial: { opacity: 0 },
|
|
1556
1792
|
animate: { opacity: 1 },
|
|
1557
1793
|
transition: { duration: 0.25 },
|
|
1558
|
-
onClick: u ? () =>
|
|
1794
|
+
onClick: u ? () => i((s) => !s) : void 0,
|
|
1559
1795
|
style: {
|
|
1560
1796
|
paddingTop: "12px",
|
|
1561
1797
|
paddingBottom: "12px",
|
|
@@ -1578,10 +1814,10 @@ function Ve({
|
|
|
1578
1814
|
flexShrink: 0,
|
|
1579
1815
|
width: 32
|
|
1580
1816
|
},
|
|
1581
|
-
children: /* @__PURE__ */ o(
|
|
1817
|
+
children: /* @__PURE__ */ o(Ve, { memory: e, completed: r })
|
|
1582
1818
|
}
|
|
1583
1819
|
),
|
|
1584
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ h(
|
|
1585
1821
|
"div",
|
|
1586
1822
|
{
|
|
1587
1823
|
style: {
|
|
@@ -1598,16 +1834,16 @@ function Ve({
|
|
|
1598
1834
|
children: e.memoryTitle
|
|
1599
1835
|
}
|
|
1600
1836
|
),
|
|
1601
|
-
|
|
1837
|
+
c != null && /* @__PURE__ */ o(
|
|
1602
1838
|
"span",
|
|
1603
1839
|
{
|
|
1604
1840
|
style: {
|
|
1605
1841
|
fontSize: 12,
|
|
1606
1842
|
color: y ? "#c62828" : "#666",
|
|
1607
1843
|
lineHeight: 1.4,
|
|
1608
|
-
whiteSpace:
|
|
1844
|
+
whiteSpace: n ? "pre-wrap" : void 0
|
|
1609
1845
|
},
|
|
1610
|
-
children:
|
|
1846
|
+
children: c
|
|
1611
1847
|
}
|
|
1612
1848
|
),
|
|
1613
1849
|
u && /* @__PURE__ */ o(
|
|
@@ -1618,7 +1854,7 @@ function Ve({
|
|
|
1618
1854
|
color: "#999",
|
|
1619
1855
|
marginTop: 2
|
|
1620
1856
|
},
|
|
1621
|
-
children:
|
|
1857
|
+
children: n ? t.clickToCollapse : t.clickToExpand
|
|
1622
1858
|
}
|
|
1623
1859
|
)
|
|
1624
1860
|
]
|
|
@@ -1628,102 +1864,102 @@ function Ve({
|
|
|
1628
1864
|
}
|
|
1629
1865
|
);
|
|
1630
1866
|
}
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1867
|
+
const Je = ({ data: e, completed: r, t }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ o(
|
|
1868
|
+
Xe,
|
|
1633
1869
|
{
|
|
1634
|
-
memory:
|
|
1635
|
-
completed:
|
|
1870
|
+
memory: n,
|
|
1871
|
+
completed: r,
|
|
1636
1872
|
t
|
|
1637
1873
|
},
|
|
1638
|
-
|
|
1874
|
+
n.memoryId
|
|
1639
1875
|
)) });
|
|
1640
|
-
function
|
|
1641
|
-
const t = Math.min(e.length,
|
|
1642
|
-
for (let
|
|
1643
|
-
if (e.slice(-
|
|
1876
|
+
function Ye(e, r) {
|
|
1877
|
+
const t = Math.min(e.length, r.length);
|
|
1878
|
+
for (let n = t; n >= 0; n--)
|
|
1879
|
+
if (e.slice(-n) === r.slice(0, n)) return n;
|
|
1644
1880
|
return 0;
|
|
1645
1881
|
}
|
|
1646
|
-
const
|
|
1882
|
+
const Ze = `
|
|
1647
1883
|
|
|
1648
1884
|
`;
|
|
1649
1885
|
function q(e) {
|
|
1650
|
-
var t,
|
|
1886
|
+
var t, n;
|
|
1651
1887
|
if (e.length === 0) return "";
|
|
1652
|
-
let
|
|
1653
|
-
for (let
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1656
|
-
if (
|
|
1657
|
-
|
|
1888
|
+
let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
|
|
1889
|
+
for (let i = 1; i < e.length; i++) {
|
|
1890
|
+
const l = ((n = e[i]) == null ? void 0 : n.content) ?? "";
|
|
1891
|
+
if (l === "") continue;
|
|
1892
|
+
if (r === "") {
|
|
1893
|
+
r = l;
|
|
1658
1894
|
continue;
|
|
1659
1895
|
}
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1896
|
+
const a = Ye(r, l);
|
|
1897
|
+
a === 0 ? r += Ze + l : r += l.slice(a);
|
|
1662
1898
|
}
|
|
1663
|
-
return
|
|
1899
|
+
return r;
|
|
1664
1900
|
}
|
|
1665
|
-
function K(e,
|
|
1901
|
+
function K(e, r) {
|
|
1666
1902
|
if (e.length === 0) return "";
|
|
1667
1903
|
if (e.length === 1)
|
|
1668
|
-
return
|
|
1904
|
+
return v(r.memorySearchPagesSingle, {
|
|
1669
1905
|
n: e[0]
|
|
1670
1906
|
});
|
|
1671
1907
|
if (e.length === 2)
|
|
1672
|
-
return
|
|
1908
|
+
return v(r.memorySearchPagesTwo, {
|
|
1673
1909
|
a: e[0],
|
|
1674
1910
|
b: e[1]
|
|
1675
1911
|
});
|
|
1676
|
-
const t = e[e.length - 1],
|
|
1677
|
-
return
|
|
1678
|
-
list:
|
|
1912
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1913
|
+
return v(r.memorySearchPagesMultiple, {
|
|
1914
|
+
list: n,
|
|
1679
1915
|
n: t
|
|
1680
1916
|
});
|
|
1681
1917
|
}
|
|
1682
1918
|
function V(e) {
|
|
1683
|
-
const
|
|
1919
|
+
const r = /* @__PURE__ */ new Set();
|
|
1684
1920
|
for (const t of e)
|
|
1685
|
-
for (const
|
|
1686
|
-
return [...
|
|
1921
|
+
for (const n of t.pageNumbers) r.add(n);
|
|
1922
|
+
return [...r].sort((t, n) => t - n);
|
|
1687
1923
|
}
|
|
1688
1924
|
function X(e) {
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1925
|
+
const r = e.memoryTypeName.trim();
|
|
1926
|
+
if (r !== "") return r;
|
|
1691
1927
|
if (e.memoryTypeId !== "") return e.memoryTypeId;
|
|
1692
1928
|
}
|
|
1693
|
-
function
|
|
1694
|
-
return e.chunks.filter((
|
|
1929
|
+
function le(e) {
|
|
1930
|
+
return e.chunks.filter((r) => r.relation === "MATCH").length;
|
|
1695
1931
|
}
|
|
1696
|
-
function
|
|
1697
|
-
let t = 0,
|
|
1698
|
-
for (const
|
|
1699
|
-
t +=
|
|
1700
|
-
const
|
|
1701
|
-
n:
|
|
1932
|
+
function er(e, r) {
|
|
1933
|
+
let t = 0, n = 0;
|
|
1934
|
+
for (const a of e)
|
|
1935
|
+
t += le(a), a.matchingChunkScore > n && (n = a.matchingChunkScore);
|
|
1936
|
+
const i = t === 1 ? r.chunkFound : v(r.chunksFound, { n: t }), l = v(r.scoreLabel, {
|
|
1937
|
+
n: n.toFixed(2)
|
|
1702
1938
|
});
|
|
1703
|
-
return `${
|
|
1939
|
+
return `${i} - ${l}`;
|
|
1704
1940
|
}
|
|
1705
|
-
function
|
|
1706
|
-
const
|
|
1707
|
-
return e.forEach((
|
|
1708
|
-
let
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
memoryId:
|
|
1714
|
-
memoryTitle:
|
|
1941
|
+
function rr(e) {
|
|
1942
|
+
const r = [], t = /* @__PURE__ */ new Map();
|
|
1943
|
+
return e.forEach((n, i) => {
|
|
1944
|
+
let l = t.get(n.memoryId);
|
|
1945
|
+
if (l == null) {
|
|
1946
|
+
r.push(n.memoryId);
|
|
1947
|
+
const a = n.memoryTitle !== "" ? n.memoryTitle : n.memoryId;
|
|
1948
|
+
l = {
|
|
1949
|
+
memoryId: n.memoryId,
|
|
1950
|
+
memoryTitle: a,
|
|
1715
1951
|
items: []
|
|
1716
|
-
}, t.set(
|
|
1952
|
+
}, t.set(n.memoryId, l);
|
|
1717
1953
|
}
|
|
1718
|
-
|
|
1719
|
-
}),
|
|
1954
|
+
l.items.push({ item: n, flatIndex: i });
|
|
1955
|
+
}), r.map((n) => t.get(n));
|
|
1720
1956
|
}
|
|
1721
|
-
function
|
|
1957
|
+
function nr({
|
|
1722
1958
|
items: e,
|
|
1723
|
-
onSearchResultClick:
|
|
1959
|
+
onSearchResultClick: r,
|
|
1724
1960
|
t
|
|
1725
1961
|
}) {
|
|
1726
|
-
const [
|
|
1962
|
+
const [n, i] = I(null), l = !!r;
|
|
1727
1963
|
return /* @__PURE__ */ o(
|
|
1728
1964
|
"div",
|
|
1729
1965
|
{
|
|
@@ -1735,25 +1971,25 @@ function rr({
|
|
|
1735
1971
|
paddingTop: 8,
|
|
1736
1972
|
borderTop: "1px solid #f0f0f0"
|
|
1737
1973
|
},
|
|
1738
|
-
children: e.map((
|
|
1974
|
+
children: e.map((a, c) => {
|
|
1739
1975
|
const u = V(
|
|
1740
|
-
|
|
1976
|
+
a.chunks
|
|
1741
1977
|
), y = [
|
|
1742
|
-
X(
|
|
1743
|
-
|
|
1744
|
-
n:
|
|
1978
|
+
X(a),
|
|
1979
|
+
v(t.scoreLabel, {
|
|
1980
|
+
n: a.matchingChunkScore.toFixed(2)
|
|
1745
1981
|
}),
|
|
1746
1982
|
u.length > 0 ? K(u, t) : t.pagesNotAvailable
|
|
1747
1983
|
].filter(
|
|
1748
1984
|
(g) => g != null && g !== ""
|
|
1749
|
-
),
|
|
1750
|
-
memoryId:
|
|
1751
|
-
memoryTitle:
|
|
1752
|
-
memoryTypeId:
|
|
1753
|
-
memoryTypeName:
|
|
1985
|
+
), s = {
|
|
1986
|
+
memoryId: a.memoryId,
|
|
1987
|
+
memoryTitle: a.memoryTitle,
|
|
1988
|
+
memoryTypeId: a.memoryTypeId,
|
|
1989
|
+
memoryTypeName: a.memoryTypeName,
|
|
1754
1990
|
pageNumbers: u
|
|
1755
|
-
},
|
|
1756
|
-
return /* @__PURE__ */
|
|
1991
|
+
}, d = `${a.memoryId}-${c}`, m = n === d;
|
|
1992
|
+
return /* @__PURE__ */ h(
|
|
1757
1993
|
"div",
|
|
1758
1994
|
{
|
|
1759
1995
|
style: {
|
|
@@ -1761,13 +1997,13 @@ function rr({
|
|
|
1761
1997
|
flexDirection: "row",
|
|
1762
1998
|
alignItems: "flex-start",
|
|
1763
1999
|
gap: "12px",
|
|
1764
|
-
paddingTop:
|
|
1765
|
-
paddingBottom:
|
|
1766
|
-
borderBottom:
|
|
2000
|
+
paddingTop: c > 0 ? 12 : 0,
|
|
2001
|
+
paddingBottom: c < e.length - 1 ? 12 : 0,
|
|
2002
|
+
borderBottom: c < e.length - 1 ? "1px solid #eee" : void 0,
|
|
1767
2003
|
minWidth: 0
|
|
1768
2004
|
},
|
|
1769
2005
|
children: [
|
|
1770
|
-
/* @__PURE__ */
|
|
2006
|
+
/* @__PURE__ */ h(
|
|
1771
2007
|
"div",
|
|
1772
2008
|
{
|
|
1773
2009
|
style: {
|
|
@@ -1788,7 +2024,7 @@ function rr({
|
|
|
1788
2024
|
whiteSpace: "pre-wrap",
|
|
1789
2025
|
wordBreak: "break-word"
|
|
1790
2026
|
},
|
|
1791
|
-
children: q(
|
|
2027
|
+
children: q(a.chunks)
|
|
1792
2028
|
}
|
|
1793
2029
|
),
|
|
1794
2030
|
/* @__PURE__ */ o(
|
|
@@ -1806,20 +2042,20 @@ function rr({
|
|
|
1806
2042
|
]
|
|
1807
2043
|
}
|
|
1808
2044
|
),
|
|
1809
|
-
|
|
2045
|
+
l && /* @__PURE__ */ h(
|
|
1810
2046
|
"button",
|
|
1811
2047
|
{
|
|
1812
2048
|
type: "button",
|
|
1813
2049
|
"aria-busy": m,
|
|
1814
2050
|
disabled: m,
|
|
1815
2051
|
onClick: async () => {
|
|
1816
|
-
|
|
2052
|
+
i(d);
|
|
1817
2053
|
try {
|
|
1818
|
-
await
|
|
1819
|
-
|
|
2054
|
+
await r(
|
|
2055
|
+
s
|
|
1820
2056
|
);
|
|
1821
2057
|
} finally {
|
|
1822
|
-
|
|
2058
|
+
i(null);
|
|
1823
2059
|
}
|
|
1824
2060
|
},
|
|
1825
2061
|
style: {
|
|
@@ -1852,22 +2088,22 @@ function rr({
|
|
|
1852
2088
|
)
|
|
1853
2089
|
]
|
|
1854
2090
|
},
|
|
1855
|
-
|
|
2091
|
+
d
|
|
1856
2092
|
);
|
|
1857
2093
|
})
|
|
1858
2094
|
}
|
|
1859
2095
|
);
|
|
1860
2096
|
}
|
|
1861
|
-
function
|
|
2097
|
+
function tr({
|
|
1862
2098
|
group: e,
|
|
1863
|
-
t:
|
|
2099
|
+
t: r,
|
|
1864
2100
|
expanded: t,
|
|
1865
|
-
onToggle:
|
|
1866
|
-
onSearchResultClick:
|
|
2101
|
+
onToggle: n,
|
|
2102
|
+
onSearchResultClick: i
|
|
1867
2103
|
}) {
|
|
1868
|
-
const
|
|
1869
|
-
return /* @__PURE__ */
|
|
1870
|
-
|
|
2104
|
+
const l = e.items.map((c) => c.item), a = l.some((c) => c.chunks.length > 0);
|
|
2105
|
+
return /* @__PURE__ */ h(
|
|
2106
|
+
C.div,
|
|
1871
2107
|
{
|
|
1872
2108
|
initial: { opacity: 0 },
|
|
1873
2109
|
animate: { opacity: 1 },
|
|
@@ -1894,10 +2130,10 @@ function nr({
|
|
|
1894
2130
|
width: 32,
|
|
1895
2131
|
paddingTop: 2
|
|
1896
2132
|
},
|
|
1897
|
-
children: /* @__PURE__ */ o(
|
|
2133
|
+
children: /* @__PURE__ */ o(D, { color: "#999", size: 15, borderWidth: 2 })
|
|
1898
2134
|
}
|
|
1899
2135
|
),
|
|
1900
|
-
/* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ h(
|
|
1901
2137
|
"div",
|
|
1902
2138
|
{
|
|
1903
2139
|
style: {
|
|
@@ -1920,7 +2156,7 @@ function nr({
|
|
|
1920
2156
|
children: e.memoryTitle
|
|
1921
2157
|
}
|
|
1922
2158
|
),
|
|
1923
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ h(
|
|
1924
2160
|
"div",
|
|
1925
2161
|
{
|
|
1926
2162
|
style: {
|
|
@@ -1940,14 +2176,14 @@ function nr({
|
|
|
1940
2176
|
color: "#666",
|
|
1941
2177
|
whiteSpace: "nowrap"
|
|
1942
2178
|
},
|
|
1943
|
-
children:
|
|
2179
|
+
children: er(l, r)
|
|
1944
2180
|
}
|
|
1945
2181
|
),
|
|
1946
|
-
|
|
2182
|
+
a && /* @__PURE__ */ o(
|
|
1947
2183
|
"button",
|
|
1948
2184
|
{
|
|
1949
2185
|
type: "button",
|
|
1950
|
-
onClick:
|
|
2186
|
+
onClick: n,
|
|
1951
2187
|
style: {
|
|
1952
2188
|
border: "none",
|
|
1953
2189
|
background: "none",
|
|
@@ -1958,18 +2194,18 @@ function nr({
|
|
|
1958
2194
|
textDecoration: "underline",
|
|
1959
2195
|
fontFamily: "inherit"
|
|
1960
2196
|
},
|
|
1961
|
-
children: t ?
|
|
2197
|
+
children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
1962
2198
|
}
|
|
1963
2199
|
)
|
|
1964
2200
|
]
|
|
1965
2201
|
}
|
|
1966
2202
|
),
|
|
1967
|
-
t &&
|
|
1968
|
-
|
|
2203
|
+
t && a && /* @__PURE__ */ o(
|
|
2204
|
+
nr,
|
|
1969
2205
|
{
|
|
1970
|
-
items:
|
|
1971
|
-
onSearchResultClick:
|
|
1972
|
-
t:
|
|
2206
|
+
items: l,
|
|
2207
|
+
onSearchResultClick: i,
|
|
2208
|
+
t: r
|
|
1973
2209
|
}
|
|
1974
2210
|
)
|
|
1975
2211
|
]
|
|
@@ -1979,26 +2215,26 @@ function nr({
|
|
|
1979
2215
|
}
|
|
1980
2216
|
);
|
|
1981
2217
|
}
|
|
1982
|
-
function
|
|
1983
|
-
return e === 1 ?
|
|
2218
|
+
function or(e, r) {
|
|
2219
|
+
return e === 1 ? r.chunkFound : v(r.chunksFound, { n: e });
|
|
1984
2220
|
}
|
|
1985
|
-
const
|
|
2221
|
+
const ir = ({
|
|
1986
2222
|
data: e,
|
|
1987
|
-
onSearchResultClick:
|
|
2223
|
+
onSearchResultClick: r,
|
|
1988
2224
|
t
|
|
1989
2225
|
}) => {
|
|
1990
|
-
const
|
|
1991
|
-
(m, g) => m +
|
|
2226
|
+
const n = e.items, i = n.reduce(
|
|
2227
|
+
(m, g) => m + le(g),
|
|
1992
2228
|
0
|
|
1993
|
-
),
|
|
1994
|
-
|
|
2229
|
+
), l = new Set(n.map((m) => m.memoryId)).size, [a, c] = I({}), u = O((m) => {
|
|
2230
|
+
c((g) => ({
|
|
1995
2231
|
...g,
|
|
1996
2232
|
[m]: !g[m]
|
|
1997
2233
|
}));
|
|
1998
|
-
}, []), y =
|
|
1999
|
-
n:
|
|
2000
|
-
}),
|
|
2001
|
-
return
|
|
2234
|
+
}, []), y = B(() => rr(n), [n]), s = l === 1 ? t.memoryChatChunkResultsInOneMemory : v(t.memoryChatChunkResultsInMemories, {
|
|
2235
|
+
n: l
|
|
2236
|
+
}), d = `${or(i, t)} ${s}`;
|
|
2237
|
+
return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2002
2238
|
"div",
|
|
2003
2239
|
{
|
|
2004
2240
|
style: {
|
|
@@ -2008,15 +2244,15 @@ const or = ({
|
|
|
2008
2244
|
},
|
|
2009
2245
|
children: t.memorySearchExploreNoResults
|
|
2010
2246
|
}
|
|
2011
|
-
) }) : /* @__PURE__ */
|
|
2247
|
+
) }) : /* @__PURE__ */ h("div", { style: { padding: "10px" }, children: [
|
|
2012
2248
|
y.map((m) => /* @__PURE__ */ o(
|
|
2013
|
-
|
|
2249
|
+
tr,
|
|
2014
2250
|
{
|
|
2015
2251
|
group: m,
|
|
2016
2252
|
t,
|
|
2017
|
-
expanded:
|
|
2253
|
+
expanded: a[m.memoryId] === !0,
|
|
2018
2254
|
onToggle: () => u(m.memoryId),
|
|
2019
|
-
onSearchResultClick:
|
|
2255
|
+
onSearchResultClick: r
|
|
2020
2256
|
},
|
|
2021
2257
|
m.memoryId
|
|
2022
2258
|
)),
|
|
@@ -2029,27 +2265,27 @@ const or = ({
|
|
|
2029
2265
|
marginTop: "4px",
|
|
2030
2266
|
fontStyle: "italic"
|
|
2031
2267
|
},
|
|
2032
|
-
children:
|
|
2268
|
+
children: d
|
|
2033
2269
|
}
|
|
2034
2270
|
)
|
|
2035
2271
|
] });
|
|
2036
2272
|
};
|
|
2037
|
-
function
|
|
2038
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
2273
|
+
function ar({ item: e }) {
|
|
2274
|
+
return e.error != null ? /* @__PURE__ */ o(Q, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(D, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2039
2275
|
}
|
|
2040
|
-
function
|
|
2041
|
-
return
|
|
2276
|
+
function sr(e, r) {
|
|
2277
|
+
return v(r.searchingInMemoriesOfType, {
|
|
2042
2278
|
name: e.memoryTypeName
|
|
2043
2279
|
});
|
|
2044
2280
|
}
|
|
2045
|
-
function
|
|
2281
|
+
function lr({
|
|
2046
2282
|
item: e,
|
|
2047
|
-
t:
|
|
2283
|
+
t: r,
|
|
2048
2284
|
showShimmerForPrimary: t
|
|
2049
2285
|
}) {
|
|
2050
|
-
const
|
|
2051
|
-
return /* @__PURE__ */
|
|
2052
|
-
|
|
2286
|
+
const n = e.result != null, i = e.error != null, l = sr(e, r);
|
|
2287
|
+
return /* @__PURE__ */ h(
|
|
2288
|
+
C.div,
|
|
2053
2289
|
{
|
|
2054
2290
|
initial: { opacity: 0 },
|
|
2055
2291
|
animate: { opacity: 1 },
|
|
@@ -2075,10 +2311,10 @@ function sr({
|
|
|
2075
2311
|
flexShrink: 0,
|
|
2076
2312
|
width: 32
|
|
2077
2313
|
},
|
|
2078
|
-
children: /* @__PURE__ */ o(
|
|
2314
|
+
children: /* @__PURE__ */ o(ar, { item: e })
|
|
2079
2315
|
}
|
|
2080
2316
|
),
|
|
2081
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ h(
|
|
2082
2318
|
"div",
|
|
2083
2319
|
{
|
|
2084
2320
|
style: {
|
|
@@ -2089,25 +2325,25 @@ function sr({
|
|
|
2089
2325
|
flex: 1
|
|
2090
2326
|
},
|
|
2091
2327
|
children: [
|
|
2092
|
-
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !
|
|
2328
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !i && t ? /* @__PURE__ */ o(
|
|
2093
2329
|
M,
|
|
2094
2330
|
{
|
|
2095
|
-
text:
|
|
2331
|
+
text: l,
|
|
2096
2332
|
duration: 2.5,
|
|
2097
2333
|
repeat: !0,
|
|
2098
2334
|
color: "#999",
|
|
2099
2335
|
shimmerColor: "#000"
|
|
2100
2336
|
}
|
|
2101
|
-
) :
|
|
2102
|
-
|
|
2103
|
-
|
|
2337
|
+
) : l }),
|
|
2338
|
+
n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? v(
|
|
2339
|
+
r.memorySearchTypeResultSummaryOne,
|
|
2104
2340
|
{
|
|
2105
2341
|
score: e.result.highestChunkScore.toFixed(
|
|
2106
2342
|
2
|
|
2107
2343
|
)
|
|
2108
2344
|
}
|
|
2109
|
-
) :
|
|
2110
|
-
|
|
2345
|
+
) : v(
|
|
2346
|
+
r.memorySearchTypeResultSummary,
|
|
2111
2347
|
{
|
|
2112
2348
|
count: e.result.numberOfChunks,
|
|
2113
2349
|
score: e.result.highestChunkScore.toFixed(
|
|
@@ -2115,7 +2351,7 @@ function sr({
|
|
|
2115
2351
|
)
|
|
2116
2352
|
}
|
|
2117
2353
|
) }),
|
|
2118
|
-
|
|
2354
|
+
i && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
|
|
2119
2355
|
]
|
|
2120
2356
|
}
|
|
2121
2357
|
)
|
|
@@ -2123,31 +2359,31 @@ function sr({
|
|
|
2123
2359
|
}
|
|
2124
2360
|
);
|
|
2125
2361
|
}
|
|
2126
|
-
const
|
|
2127
|
-
const
|
|
2128
|
-
let
|
|
2129
|
-
return e.memoryTypes.forEach((
|
|
2130
|
-
|
|
2131
|
-
}),
|
|
2362
|
+
const cr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
2363
|
+
const i = B(() => {
|
|
2364
|
+
let l = -1;
|
|
2365
|
+
return e.memoryTypes.forEach((a, c) => {
|
|
2366
|
+
a.result == null && a.error == null && (l = c);
|
|
2367
|
+
}), l;
|
|
2132
2368
|
}, [e.memoryTypes]);
|
|
2133
|
-
return /* @__PURE__ */
|
|
2134
|
-
|
|
2369
|
+
return /* @__PURE__ */ h("div", { style: { padding: "10px" }, children: [
|
|
2370
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
|
|
2135
2371
|
M,
|
|
2136
2372
|
{
|
|
2137
|
-
text:
|
|
2373
|
+
text: n.searchingMemoryTypes,
|
|
2138
2374
|
duration: 2.5,
|
|
2139
2375
|
repeat: !0,
|
|
2140
2376
|
color: "#999",
|
|
2141
2377
|
shimmerColor: "#000"
|
|
2142
2378
|
}
|
|
2143
|
-
) : e.memoryTypes.map((
|
|
2144
|
-
|
|
2379
|
+
) : e.memoryTypes.map((l, a) => /* @__PURE__ */ o(
|
|
2380
|
+
lr,
|
|
2145
2381
|
{
|
|
2146
|
-
item:
|
|
2147
|
-
t:
|
|
2148
|
-
showShimmerForPrimary:
|
|
2382
|
+
item: l,
|
|
2383
|
+
t: n,
|
|
2384
|
+
showShimmerForPrimary: a === i && r
|
|
2149
2385
|
},
|
|
2150
|
-
|
|
2386
|
+
l.memoryTypeId
|
|
2151
2387
|
)),
|
|
2152
2388
|
t !== void 0 && /* @__PURE__ */ o(
|
|
2153
2389
|
"div",
|
|
@@ -2158,45 +2394,45 @@ const lr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
2158
2394
|
marginTop: "4px",
|
|
2159
2395
|
fontStyle: "italic"
|
|
2160
2396
|
},
|
|
2161
|
-
children:
|
|
2397
|
+
children: v(n.tookSeconds, { n: t })
|
|
2162
2398
|
}
|
|
2163
2399
|
)
|
|
2164
2400
|
] });
|
|
2165
|
-
},
|
|
2166
|
-
|
|
2167
|
-
),
|
|
2168
|
-
5 *
|
|
2401
|
+
}, N = 12, $ = 1.45, dr = Math.ceil(
|
|
2402
|
+
N * $
|
|
2403
|
+
), mr = Math.ceil(
|
|
2404
|
+
5 * N * $
|
|
2169
2405
|
);
|
|
2170
|
-
function
|
|
2406
|
+
function W(e) {
|
|
2171
2407
|
return e.queries != null && e.queries.length > 0;
|
|
2172
2408
|
}
|
|
2173
|
-
function mr(e) {
|
|
2174
|
-
const n = e.reasoning;
|
|
2175
|
-
return (n == null || n === "") && !O(e);
|
|
2176
|
-
}
|
|
2177
2409
|
function ur(e) {
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
return n == null || n === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
|
|
2410
|
+
const r = e.reasoning;
|
|
2411
|
+
return (r == null || r === "") && !W(e);
|
|
2181
2412
|
}
|
|
2182
|
-
function yr(
|
|
2183
|
-
|
|
2413
|
+
function yr(e) {
|
|
2414
|
+
if (W(e)) return 3;
|
|
2415
|
+
const r = e.reasoning;
|
|
2416
|
+
return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
|
|
2184
2417
|
}
|
|
2185
|
-
function gr({
|
|
2418
|
+
function gr({ phase: e }) {
|
|
2419
|
+
return e === 3 ? /* @__PURE__ */ o(D, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2420
|
+
}
|
|
2421
|
+
function hr({
|
|
2186
2422
|
item: e,
|
|
2187
|
-
t:
|
|
2423
|
+
t: r,
|
|
2188
2424
|
isActiveRow: t
|
|
2189
2425
|
}) {
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
const
|
|
2193
|
-
|
|
2194
|
-
}, [
|
|
2195
|
-
const m =
|
|
2426
|
+
const n = ur(e), i = yr(e), l = e.reasoning, a = l != null && l.length > 0, c = F(null), [u, y] = I(!1), s = n && t, d = i === 2 && t && !W(e);
|
|
2427
|
+
A(() => {
|
|
2428
|
+
const p = c.current;
|
|
2429
|
+
p != null && i === 1 && a && (p.scrollTop = p.scrollHeight);
|
|
2430
|
+
}, [l, i, a]);
|
|
2431
|
+
const m = v(r.searchingInMemoriesOfType, {
|
|
2196
2432
|
name: e.memoryTypeName
|
|
2197
|
-
}), g = !
|
|
2198
|
-
return /* @__PURE__ */
|
|
2199
|
-
|
|
2433
|
+
}), g = !n && i === 3;
|
|
2434
|
+
return /* @__PURE__ */ h(
|
|
2435
|
+
C.div,
|
|
2200
2436
|
{
|
|
2201
2437
|
initial: { opacity: 0 },
|
|
2202
2438
|
animate: { opacity: 1 },
|
|
@@ -2223,10 +2459,10 @@ function gr({
|
|
|
2223
2459
|
width: 32,
|
|
2224
2460
|
...g ? { paddingTop: 2 } : {}
|
|
2225
2461
|
},
|
|
2226
|
-
children: /* @__PURE__ */ o(
|
|
2462
|
+
children: /* @__PURE__ */ o(gr, { phase: n ? 1 : i })
|
|
2227
2463
|
}
|
|
2228
2464
|
),
|
|
2229
|
-
/* @__PURE__ */
|
|
2465
|
+
/* @__PURE__ */ h(
|
|
2230
2466
|
"div",
|
|
2231
2467
|
{
|
|
2232
2468
|
style: {
|
|
@@ -2237,7 +2473,7 @@ function gr({
|
|
|
2237
2473
|
flex: 1
|
|
2238
2474
|
},
|
|
2239
2475
|
children: [
|
|
2240
|
-
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children:
|
|
2476
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: s ? /* @__PURE__ */ o(
|
|
2241
2477
|
M,
|
|
2242
2478
|
{
|
|
2243
2479
|
text: m,
|
|
@@ -2247,7 +2483,7 @@ function gr({
|
|
|
2247
2483
|
shimmerColor: "#000"
|
|
2248
2484
|
}
|
|
2249
2485
|
) : e.memoryTypeName }),
|
|
2250
|
-
|
|
2486
|
+
i === 1 && a && !W(e) && /* @__PURE__ */ h("div", { style: { minWidth: 0 }, children: [
|
|
2251
2487
|
/* @__PURE__ */ o(
|
|
2252
2488
|
"span",
|
|
2253
2489
|
{
|
|
@@ -2258,7 +2494,7 @@ function gr({
|
|
|
2258
2494
|
marginBottom: 4,
|
|
2259
2495
|
fontWeight: 500
|
|
2260
2496
|
},
|
|
2261
|
-
children:
|
|
2497
|
+
children: r.memorySearchQueryReasoningLabel
|
|
2262
2498
|
}
|
|
2263
2499
|
),
|
|
2264
2500
|
/* @__PURE__ */ o(
|
|
@@ -2273,38 +2509,38 @@ function gr({
|
|
|
2273
2509
|
children: /* @__PURE__ */ o(
|
|
2274
2510
|
"div",
|
|
2275
2511
|
{
|
|
2276
|
-
ref:
|
|
2512
|
+
ref: c,
|
|
2277
2513
|
className: "memory-search-generating-reasoning-viewport",
|
|
2278
2514
|
style: {
|
|
2279
|
-
minHeight:
|
|
2280
|
-
maxHeight:
|
|
2515
|
+
minHeight: dr,
|
|
2516
|
+
maxHeight: mr,
|
|
2281
2517
|
height: "auto",
|
|
2282
2518
|
overflowY: "auto",
|
|
2283
2519
|
overflowX: "hidden",
|
|
2284
|
-
fontSize:
|
|
2285
|
-
lineHeight:
|
|
2520
|
+
fontSize: N,
|
|
2521
|
+
lineHeight: $,
|
|
2286
2522
|
whiteSpace: "pre-wrap",
|
|
2287
2523
|
wordBreak: "break-word",
|
|
2288
2524
|
color: "#888"
|
|
2289
2525
|
},
|
|
2290
|
-
children:
|
|
2526
|
+
children: l
|
|
2291
2527
|
}
|
|
2292
2528
|
)
|
|
2293
2529
|
}
|
|
2294
2530
|
)
|
|
2295
2531
|
] }),
|
|
2296
|
-
|
|
2532
|
+
i === 2 && d && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
2297
2533
|
M,
|
|
2298
2534
|
{
|
|
2299
|
-
text:
|
|
2535
|
+
text: r.memorySearchGeneratingQueriesPending,
|
|
2300
2536
|
duration: 2.5,
|
|
2301
2537
|
repeat: !0,
|
|
2302
2538
|
color: "#999",
|
|
2303
2539
|
shimmerColor: "#000"
|
|
2304
2540
|
}
|
|
2305
2541
|
) }),
|
|
2306
|
-
|
|
2307
|
-
/* @__PURE__ */
|
|
2542
|
+
i === 3 && /* @__PURE__ */ h(E, { children: [
|
|
2543
|
+
/* @__PURE__ */ h("div", { style: { minWidth: 0 }, children: [
|
|
2308
2544
|
/* @__PURE__ */ o(
|
|
2309
2545
|
"span",
|
|
2310
2546
|
{
|
|
@@ -2315,7 +2551,7 @@ function gr({
|
|
|
2315
2551
|
marginBottom: 6,
|
|
2316
2552
|
fontWeight: 500
|
|
2317
2553
|
},
|
|
2318
|
-
children:
|
|
2554
|
+
children: r.memorySearchGeneratedQueriesHeading
|
|
2319
2555
|
}
|
|
2320
2556
|
),
|
|
2321
2557
|
/* @__PURE__ */ o(
|
|
@@ -2326,7 +2562,7 @@ function gr({
|
|
|
2326
2562
|
flexDirection: "column",
|
|
2327
2563
|
gap: 6
|
|
2328
2564
|
},
|
|
2329
|
-
children: e.queries.map((
|
|
2565
|
+
children: e.queries.map((p, f) => /* @__PURE__ */ o(
|
|
2330
2566
|
"div",
|
|
2331
2567
|
{
|
|
2332
2568
|
style: {
|
|
@@ -2335,19 +2571,19 @@ function gr({
|
|
|
2335
2571
|
lineHeight: 1.5,
|
|
2336
2572
|
wordBreak: "break-word"
|
|
2337
2573
|
},
|
|
2338
|
-
children:
|
|
2574
|
+
children: p.query
|
|
2339
2575
|
},
|
|
2340
2576
|
f
|
|
2341
2577
|
))
|
|
2342
2578
|
}
|
|
2343
2579
|
)
|
|
2344
2580
|
] }),
|
|
2345
|
-
|
|
2581
|
+
a && /* @__PURE__ */ h(E, { children: [
|
|
2346
2582
|
/* @__PURE__ */ o(
|
|
2347
2583
|
"button",
|
|
2348
2584
|
{
|
|
2349
2585
|
type: "button",
|
|
2350
|
-
onClick: () => y((
|
|
2586
|
+
onClick: () => y((p) => !p),
|
|
2351
2587
|
style: {
|
|
2352
2588
|
alignSelf: "flex-start",
|
|
2353
2589
|
border: "none",
|
|
@@ -2358,15 +2594,15 @@ function gr({
|
|
|
2358
2594
|
color: "#666",
|
|
2359
2595
|
textDecoration: "underline"
|
|
2360
2596
|
},
|
|
2361
|
-
children: u ?
|
|
2597
|
+
children: u ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
|
|
2362
2598
|
}
|
|
2363
2599
|
),
|
|
2364
2600
|
u && /* @__PURE__ */ o(
|
|
2365
2601
|
"div",
|
|
2366
2602
|
{
|
|
2367
2603
|
style: {
|
|
2368
|
-
fontSize:
|
|
2369
|
-
lineHeight:
|
|
2604
|
+
fontSize: N,
|
|
2605
|
+
lineHeight: $,
|
|
2370
2606
|
whiteSpace: "pre-wrap",
|
|
2371
2607
|
wordBreak: "break-word",
|
|
2372
2608
|
color: "#888",
|
|
@@ -2374,7 +2610,7 @@ function gr({
|
|
|
2374
2610
|
borderRadius: 6,
|
|
2375
2611
|
padding: "8px 10px"
|
|
2376
2612
|
},
|
|
2377
|
-
children:
|
|
2613
|
+
children: l
|
|
2378
2614
|
}
|
|
2379
2615
|
)
|
|
2380
2616
|
] })
|
|
@@ -2386,31 +2622,31 @@ function gr({
|
|
|
2386
2622
|
}
|
|
2387
2623
|
);
|
|
2388
2624
|
}
|
|
2389
|
-
const pr = ({ data: e, isLatest:
|
|
2390
|
-
const
|
|
2391
|
-
let
|
|
2392
|
-
return e.memoryTypes.forEach((
|
|
2393
|
-
|
|
2394
|
-
}),
|
|
2625
|
+
const pr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
2626
|
+
const i = B(() => {
|
|
2627
|
+
let l = -1;
|
|
2628
|
+
return e.memoryTypes.forEach((a, c) => {
|
|
2629
|
+
W(a) || (l = c);
|
|
2630
|
+
}), l;
|
|
2395
2631
|
}, [e.memoryTypes]);
|
|
2396
|
-
return /* @__PURE__ */
|
|
2397
|
-
|
|
2632
|
+
return /* @__PURE__ */ h("div", { style: { padding: "10px" }, children: [
|
|
2633
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
|
|
2398
2634
|
M,
|
|
2399
2635
|
{
|
|
2400
|
-
text:
|
|
2636
|
+
text: n.memorySearchGeneratingQueries,
|
|
2401
2637
|
duration: 2.5,
|
|
2402
2638
|
repeat: !0,
|
|
2403
2639
|
color: "#999",
|
|
2404
2640
|
shimmerColor: "#000"
|
|
2405
2641
|
}
|
|
2406
|
-
) : e.memoryTypes.map((
|
|
2407
|
-
|
|
2642
|
+
) : e.memoryTypes.map((l, a) => /* @__PURE__ */ o(
|
|
2643
|
+
hr,
|
|
2408
2644
|
{
|
|
2409
|
-
item:
|
|
2410
|
-
t:
|
|
2411
|
-
isActiveRow:
|
|
2645
|
+
item: l,
|
|
2646
|
+
t: n,
|
|
2647
|
+
isActiveRow: a === i && r
|
|
2412
2648
|
},
|
|
2413
|
-
|
|
2649
|
+
l.memoryTypeId
|
|
2414
2650
|
)),
|
|
2415
2651
|
t !== void 0 && /* @__PURE__ */ o(
|
|
2416
2652
|
"div",
|
|
@@ -2421,44 +2657,44 @@ const pr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
2421
2657
|
marginTop: "4px",
|
|
2422
2658
|
fontStyle: "italic"
|
|
2423
2659
|
},
|
|
2424
|
-
children:
|
|
2660
|
+
children: v(n.tookSeconds, { n: t })
|
|
2425
2661
|
}
|
|
2426
2662
|
)
|
|
2427
2663
|
] });
|
|
2428
2664
|
};
|
|
2429
|
-
function
|
|
2430
|
-
return e.some((
|
|
2665
|
+
function fr(e) {
|
|
2666
|
+
return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ o(Q, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(D, { color: "#999", size: 15, borderWidth: 2 });
|
|
2431
2667
|
}
|
|
2432
|
-
function
|
|
2668
|
+
function Sr(e, r) {
|
|
2433
2669
|
if (e.error != null)
|
|
2434
2670
|
return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
|
|
2435
2671
|
if (e.result == null)
|
|
2436
2672
|
return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
2437
2673
|
M,
|
|
2438
2674
|
{
|
|
2439
|
-
text:
|
|
2675
|
+
text: r.searching,
|
|
2440
2676
|
duration: 2.5,
|
|
2441
2677
|
repeat: !0,
|
|
2442
2678
|
color: "#999",
|
|
2443
2679
|
shimmerColor: "#000"
|
|
2444
2680
|
}
|
|
2445
2681
|
) });
|
|
2446
|
-
const t = e.result,
|
|
2682
|
+
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : v(r.chunksFound, { n: t.numberOfChunks }), i = v(r.scoreLabel, {
|
|
2447
2683
|
n: t.highestChunkScore.toFixed(2)
|
|
2448
2684
|
});
|
|
2449
|
-
return /* @__PURE__ */
|
|
2450
|
-
|
|
2685
|
+
return /* @__PURE__ */ h("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
2686
|
+
n,
|
|
2451
2687
|
" · ",
|
|
2452
|
-
|
|
2688
|
+
i
|
|
2453
2689
|
] });
|
|
2454
2690
|
}
|
|
2455
2691
|
function xr({
|
|
2456
2692
|
items: e,
|
|
2457
|
-
queryRow:
|
|
2693
|
+
queryRow: r,
|
|
2458
2694
|
onExploreQueryResultClick: t,
|
|
2459
|
-
t:
|
|
2695
|
+
t: n
|
|
2460
2696
|
}) {
|
|
2461
|
-
const [
|
|
2697
|
+
const [i, l] = I(null);
|
|
2462
2698
|
if (e.length === 0)
|
|
2463
2699
|
return /* @__PURE__ */ o(
|
|
2464
2700
|
"div",
|
|
@@ -2468,10 +2704,10 @@ function xr({
|
|
|
2468
2704
|
color: "#94a3b8",
|
|
2469
2705
|
paddingTop: 4
|
|
2470
2706
|
},
|
|
2471
|
-
children:
|
|
2707
|
+
children: n.memorySearchExploreNoResults
|
|
2472
2708
|
}
|
|
2473
2709
|
);
|
|
2474
|
-
const
|
|
2710
|
+
const a = !!t;
|
|
2475
2711
|
return /* @__PURE__ */ o(
|
|
2476
2712
|
"div",
|
|
2477
2713
|
{
|
|
@@ -2483,26 +2719,26 @@ function xr({
|
|
|
2483
2719
|
paddingTop: 8,
|
|
2484
2720
|
borderTop: "1px solid #f0f0f0"
|
|
2485
2721
|
},
|
|
2486
|
-
children: e.map((
|
|
2487
|
-
const y =
|
|
2488
|
-
|
|
2489
|
-
),
|
|
2490
|
-
X(
|
|
2491
|
-
|
|
2492
|
-
n:
|
|
2722
|
+
children: e.map((c, u) => {
|
|
2723
|
+
const y = c.memoryTitle !== "" ? c.memoryTitle : c.memoryId, s = V(
|
|
2724
|
+
c.chunks
|
|
2725
|
+
), d = [
|
|
2726
|
+
X(c),
|
|
2727
|
+
v(n.scoreLabel, {
|
|
2728
|
+
n: c.matchingChunkScore.toFixed(2)
|
|
2493
2729
|
}),
|
|
2494
|
-
|
|
2730
|
+
s.length > 0 ? K(s, n) : n.pagesNotAvailable
|
|
2495
2731
|
].filter(
|
|
2496
2732
|
(f) => f != null && f !== ""
|
|
2497
2733
|
), m = {
|
|
2498
|
-
memoryId:
|
|
2499
|
-
memoryTitle:
|
|
2500
|
-
pageNumbers:
|
|
2501
|
-
memoryTypeId:
|
|
2502
|
-
memoryTypeName:
|
|
2503
|
-
query:
|
|
2504
|
-
}, g = `${
|
|
2505
|
-
return /* @__PURE__ */
|
|
2734
|
+
memoryId: c.memoryId,
|
|
2735
|
+
memoryTitle: c.memoryTitle,
|
|
2736
|
+
pageNumbers: s,
|
|
2737
|
+
memoryTypeId: r.memoryTypeId,
|
|
2738
|
+
memoryTypeName: r.memoryTypeName,
|
|
2739
|
+
query: r.query
|
|
2740
|
+
}, g = `${r.query}::${c.memoryId}::${u}`, p = i === g;
|
|
2741
|
+
return /* @__PURE__ */ h(
|
|
2506
2742
|
"div",
|
|
2507
2743
|
{
|
|
2508
2744
|
style: {
|
|
@@ -2516,7 +2752,7 @@ function xr({
|
|
|
2516
2752
|
minWidth: 0
|
|
2517
2753
|
},
|
|
2518
2754
|
children: [
|
|
2519
|
-
/* @__PURE__ */
|
|
2755
|
+
/* @__PURE__ */ h(
|
|
2520
2756
|
"div",
|
|
2521
2757
|
{
|
|
2522
2758
|
style: {
|
|
@@ -2549,7 +2785,7 @@ function xr({
|
|
|
2549
2785
|
wordBreak: "break-word"
|
|
2550
2786
|
},
|
|
2551
2787
|
children: q(
|
|
2552
|
-
|
|
2788
|
+
c.chunks
|
|
2553
2789
|
)
|
|
2554
2790
|
}
|
|
2555
2791
|
),
|
|
@@ -2562,26 +2798,26 @@ function xr({
|
|
|
2562
2798
|
color: "#94a3b8",
|
|
2563
2799
|
lineHeight: 1.35
|
|
2564
2800
|
},
|
|
2565
|
-
children:
|
|
2801
|
+
children: d.join(" · ")
|
|
2566
2802
|
}
|
|
2567
2803
|
)
|
|
2568
2804
|
]
|
|
2569
2805
|
}
|
|
2570
2806
|
),
|
|
2571
|
-
|
|
2807
|
+
a && /* @__PURE__ */ h(
|
|
2572
2808
|
"button",
|
|
2573
2809
|
{
|
|
2574
2810
|
type: "button",
|
|
2575
|
-
"aria-busy":
|
|
2576
|
-
disabled:
|
|
2811
|
+
"aria-busy": p,
|
|
2812
|
+
disabled: p,
|
|
2577
2813
|
onClick: async () => {
|
|
2578
|
-
|
|
2814
|
+
l(g);
|
|
2579
2815
|
try {
|
|
2580
2816
|
await t(
|
|
2581
2817
|
m
|
|
2582
2818
|
);
|
|
2583
2819
|
} finally {
|
|
2584
|
-
|
|
2820
|
+
l(null);
|
|
2585
2821
|
}
|
|
2586
2822
|
},
|
|
2587
2823
|
style: {
|
|
@@ -2594,56 +2830,56 @@ function xr({
|
|
|
2594
2830
|
background: "#eff6ff",
|
|
2595
2831
|
border: "1px solid #bfdbfe",
|
|
2596
2832
|
borderRadius: 6,
|
|
2597
|
-
cursor:
|
|
2833
|
+
cursor: p ? "wait" : "pointer",
|
|
2598
2834
|
fontFamily: "inherit",
|
|
2599
2835
|
display: "inline-flex",
|
|
2600
2836
|
alignItems: "center",
|
|
2601
2837
|
gap: 8
|
|
2602
2838
|
},
|
|
2603
2839
|
children: [
|
|
2604
|
-
|
|
2840
|
+
p && /* @__PURE__ */ o(
|
|
2605
2841
|
"span",
|
|
2606
2842
|
{
|
|
2607
2843
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
2608
2844
|
"aria-hidden": !0
|
|
2609
2845
|
}
|
|
2610
2846
|
),
|
|
2611
|
-
|
|
2847
|
+
n.viewButton
|
|
2612
2848
|
]
|
|
2613
2849
|
}
|
|
2614
2850
|
)
|
|
2615
2851
|
]
|
|
2616
2852
|
},
|
|
2617
|
-
`${
|
|
2853
|
+
`${c.memoryId}-${u}`
|
|
2618
2854
|
);
|
|
2619
2855
|
})
|
|
2620
2856
|
}
|
|
2621
2857
|
);
|
|
2622
2858
|
}
|
|
2623
|
-
function
|
|
2624
|
-
const
|
|
2625
|
-
return e.forEach((
|
|
2626
|
-
let
|
|
2627
|
-
|
|
2628
|
-
memoryTypeId:
|
|
2629
|
-
memoryTypeName:
|
|
2859
|
+
function kr(e) {
|
|
2860
|
+
const r = [], t = /* @__PURE__ */ new Map();
|
|
2861
|
+
return e.forEach((n, i) => {
|
|
2862
|
+
let l = t.get(n.memoryTypeId);
|
|
2863
|
+
l == null && (r.push(n.memoryTypeId), l = {
|
|
2864
|
+
memoryTypeId: n.memoryTypeId,
|
|
2865
|
+
memoryTypeName: n.memoryTypeName,
|
|
2630
2866
|
items: []
|
|
2631
|
-
}, t.set(
|
|
2632
|
-
}),
|
|
2867
|
+
}, t.set(n.memoryTypeId, l)), l.items.push({ item: n, flatIndex: i });
|
|
2868
|
+
}), r.map((n) => t.get(n));
|
|
2633
2869
|
}
|
|
2634
|
-
function
|
|
2870
|
+
function br({
|
|
2635
2871
|
group: e,
|
|
2636
|
-
t:
|
|
2872
|
+
t: r,
|
|
2637
2873
|
isLatest: t,
|
|
2638
|
-
expandedRows:
|
|
2639
|
-
toggleExpanded:
|
|
2640
|
-
onExploreQueryResultClick:
|
|
2874
|
+
expandedRows: n,
|
|
2875
|
+
toggleExpanded: i,
|
|
2876
|
+
onExploreQueryResultClick: l
|
|
2641
2877
|
}) {
|
|
2642
|
-
const
|
|
2878
|
+
const a = e.items.map((u) => u.item), c = a.some(
|
|
2643
2879
|
(u) => u.result == null && u.error == null
|
|
2644
2880
|
);
|
|
2645
|
-
return /* @__PURE__ */
|
|
2646
|
-
|
|
2881
|
+
return /* @__PURE__ */ h(
|
|
2882
|
+
C.div,
|
|
2647
2883
|
{
|
|
2648
2884
|
initial: { opacity: 0 },
|
|
2649
2885
|
animate: { opacity: 1 },
|
|
@@ -2654,7 +2890,7 @@ function Tr({
|
|
|
2654
2890
|
borderBottom: "1px solid #eee",
|
|
2655
2891
|
display: "flex",
|
|
2656
2892
|
flexDirection: "row",
|
|
2657
|
-
alignItems:
|
|
2893
|
+
alignItems: c ? "center" : "flex-start",
|
|
2658
2894
|
gap: "10px",
|
|
2659
2895
|
minWidth: 0
|
|
2660
2896
|
},
|
|
@@ -2668,12 +2904,12 @@ function Tr({
|
|
|
2668
2904
|
justifyContent: "center",
|
|
2669
2905
|
flexShrink: 0,
|
|
2670
2906
|
width: 32,
|
|
2671
|
-
...
|
|
2907
|
+
...c ? {} : { paddingTop: 2 }
|
|
2672
2908
|
},
|
|
2673
|
-
children:
|
|
2909
|
+
children: fr(a)
|
|
2674
2910
|
}
|
|
2675
2911
|
),
|
|
2676
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ h(
|
|
2677
2913
|
"div",
|
|
2678
2914
|
{
|
|
2679
2915
|
style: {
|
|
@@ -2691,15 +2927,15 @@ function Tr({
|
|
|
2691
2927
|
fontSize: 12,
|
|
2692
2928
|
color: "#888"
|
|
2693
2929
|
},
|
|
2694
|
-
children:
|
|
2930
|
+
children: v(r.memorySearchExploreQueryTypeLabel, {
|
|
2695
2931
|
name: e.memoryTypeName
|
|
2696
2932
|
})
|
|
2697
2933
|
}
|
|
2698
2934
|
),
|
|
2699
2935
|
e.items.map(({ item: u, flatIndex: y }) => {
|
|
2700
2936
|
var f;
|
|
2701
|
-
const
|
|
2702
|
-
return /* @__PURE__ */
|
|
2937
|
+
const s = u.result != null, d = u.error != null, m = t && !s && !d, g = n[y] === !0, p = ((f = u.result) == null ? void 0 : f.items) ?? [];
|
|
2938
|
+
return /* @__PURE__ */ h(
|
|
2703
2939
|
"div",
|
|
2704
2940
|
{
|
|
2705
2941
|
style: {
|
|
@@ -2709,7 +2945,7 @@ function Tr({
|
|
|
2709
2945
|
minWidth: 0
|
|
2710
2946
|
},
|
|
2711
2947
|
children: [
|
|
2712
|
-
/* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ h(
|
|
2713
2949
|
"div",
|
|
2714
2950
|
{
|
|
2715
2951
|
style: {
|
|
@@ -2744,7 +2980,7 @@ function Tr({
|
|
|
2744
2980
|
) : u.query
|
|
2745
2981
|
}
|
|
2746
2982
|
),
|
|
2747
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ h(
|
|
2748
2984
|
"div",
|
|
2749
2985
|
{
|
|
2750
2986
|
style: {
|
|
@@ -2755,12 +2991,12 @@ function Tr({
|
|
|
2755
2991
|
flexShrink: 0
|
|
2756
2992
|
},
|
|
2757
2993
|
children: [
|
|
2758
|
-
|
|
2759
|
-
|
|
2994
|
+
Sr(u, r),
|
|
2995
|
+
s && /* @__PURE__ */ o(
|
|
2760
2996
|
"button",
|
|
2761
2997
|
{
|
|
2762
2998
|
type: "button",
|
|
2763
|
-
onClick: () =>
|
|
2999
|
+
onClick: () => i(y),
|
|
2764
3000
|
style: {
|
|
2765
3001
|
border: "none",
|
|
2766
3002
|
background: "none",
|
|
@@ -2771,7 +3007,7 @@ function Tr({
|
|
|
2771
3007
|
textDecoration: "underline",
|
|
2772
3008
|
fontFamily: "inherit"
|
|
2773
3009
|
},
|
|
2774
|
-
children: g ?
|
|
3010
|
+
children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2775
3011
|
}
|
|
2776
3012
|
)
|
|
2777
3013
|
]
|
|
@@ -2780,13 +3016,13 @@ function Tr({
|
|
|
2780
3016
|
]
|
|
2781
3017
|
}
|
|
2782
3018
|
),
|
|
2783
|
-
|
|
3019
|
+
s && g && /* @__PURE__ */ o(
|
|
2784
3020
|
xr,
|
|
2785
3021
|
{
|
|
2786
|
-
items:
|
|
3022
|
+
items: p,
|
|
2787
3023
|
queryRow: u,
|
|
2788
|
-
onExploreQueryResultClick:
|
|
2789
|
-
t:
|
|
3024
|
+
onExploreQueryResultClick: l,
|
|
3025
|
+
t: r
|
|
2790
3026
|
}
|
|
2791
3027
|
)
|
|
2792
3028
|
]
|
|
@@ -2801,43 +3037,43 @@ function Tr({
|
|
|
2801
3037
|
}
|
|
2802
3038
|
);
|
|
2803
3039
|
}
|
|
2804
|
-
const
|
|
3040
|
+
const vr = ({
|
|
2805
3041
|
data: e,
|
|
2806
|
-
isLatest:
|
|
3042
|
+
isLatest: r = !1,
|
|
2807
3043
|
durationSeconds: t,
|
|
2808
|
-
onExploreQueryResultClick:
|
|
2809
|
-
t:
|
|
3044
|
+
onExploreQueryResultClick: n,
|
|
3045
|
+
t: i
|
|
2810
3046
|
}) => {
|
|
2811
|
-
const [
|
|
3047
|
+
const [l, a] = I(
|
|
2812
3048
|
{}
|
|
2813
|
-
),
|
|
2814
|
-
|
|
2815
|
-
...
|
|
2816
|
-
[y]: !
|
|
3049
|
+
), c = O((y) => {
|
|
3050
|
+
a((s) => ({
|
|
3051
|
+
...s,
|
|
3052
|
+
[y]: !s[y]
|
|
2817
3053
|
}));
|
|
2818
|
-
}, []), u =
|
|
2819
|
-
() =>
|
|
3054
|
+
}, []), u = B(
|
|
3055
|
+
() => kr(e.queries),
|
|
2820
3056
|
[e.queries]
|
|
2821
3057
|
);
|
|
2822
|
-
return /* @__PURE__ */
|
|
2823
|
-
|
|
3058
|
+
return /* @__PURE__ */ h("div", { style: { padding: "10px" }, children: [
|
|
3059
|
+
r && !t && e.queries.length === 0 ? /* @__PURE__ */ o(
|
|
2824
3060
|
M,
|
|
2825
3061
|
{
|
|
2826
|
-
text:
|
|
3062
|
+
text: i.memorySearchExploringQueries,
|
|
2827
3063
|
duration: 2.5,
|
|
2828
3064
|
repeat: !0,
|
|
2829
3065
|
color: "#999",
|
|
2830
3066
|
shimmerColor: "#000"
|
|
2831
3067
|
}
|
|
2832
3068
|
) : u.map((y) => /* @__PURE__ */ o(
|
|
2833
|
-
|
|
3069
|
+
br,
|
|
2834
3070
|
{
|
|
2835
3071
|
group: y,
|
|
2836
|
-
t:
|
|
2837
|
-
isLatest:
|
|
2838
|
-
expandedRows:
|
|
2839
|
-
toggleExpanded:
|
|
2840
|
-
onExploreQueryResultClick:
|
|
3072
|
+
t: i,
|
|
3073
|
+
isLatest: r,
|
|
3074
|
+
expandedRows: l,
|
|
3075
|
+
toggleExpanded: c,
|
|
3076
|
+
onExploreQueryResultClick: n
|
|
2841
3077
|
},
|
|
2842
3078
|
y.memoryTypeId
|
|
2843
3079
|
)),
|
|
@@ -2850,15 +3086,15 @@ const kr = ({
|
|
|
2850
3086
|
marginTop: "4px",
|
|
2851
3087
|
fontStyle: "italic"
|
|
2852
3088
|
},
|
|
2853
|
-
children:
|
|
3089
|
+
children: v(i.tookSeconds, { n: t })
|
|
2854
3090
|
}
|
|
2855
3091
|
)
|
|
2856
3092
|
] });
|
|
2857
|
-
},
|
|
2858
|
-
const
|
|
2859
|
-
return /* @__PURE__ */
|
|
3093
|
+
}, Tr = ({ data: e, onSearchResultClick: r, t }) => {
|
|
3094
|
+
const n = e.response.items, i = !!r, [l, a] = I(null);
|
|
3095
|
+
return /* @__PURE__ */ h("div", { style: { padding: "16px" }, children: [
|
|
2860
3096
|
/* @__PURE__ */ o(
|
|
2861
|
-
|
|
3097
|
+
C.div,
|
|
2862
3098
|
{
|
|
2863
3099
|
style: {
|
|
2864
3100
|
marginBottom: "12px",
|
|
@@ -2880,26 +3116,26 @@ const kr = ({
|
|
|
2880
3116
|
flexDirection: "column",
|
|
2881
3117
|
gap: 0
|
|
2882
3118
|
},
|
|
2883
|
-
children:
|
|
2884
|
-
const y =
|
|
2885
|
-
|
|
2886
|
-
),
|
|
2887
|
-
X(
|
|
2888
|
-
|
|
2889
|
-
n:
|
|
3119
|
+
children: n.map((c, u) => {
|
|
3120
|
+
const y = c.memoryTitle !== "" ? c.memoryTitle : c.memoryId, s = V(
|
|
3121
|
+
c.chunks
|
|
3122
|
+
), d = [
|
|
3123
|
+
X(c),
|
|
3124
|
+
v(t.scoreLabel, {
|
|
3125
|
+
n: c.matchingChunkScore.toFixed(2)
|
|
2890
3126
|
}),
|
|
2891
|
-
|
|
3127
|
+
s.length > 0 ? K(s, t) : t.pagesNotAvailable
|
|
2892
3128
|
].filter(
|
|
2893
3129
|
(f) => f != null && f !== ""
|
|
2894
3130
|
), m = {
|
|
2895
|
-
memoryId:
|
|
2896
|
-
memoryTitle:
|
|
2897
|
-
memoryTypeId:
|
|
2898
|
-
memoryTypeName:
|
|
2899
|
-
pageNumbers:
|
|
2900
|
-
}, g = `${
|
|
2901
|
-
return /* @__PURE__ */
|
|
2902
|
-
|
|
3131
|
+
memoryId: c.memoryId,
|
|
3132
|
+
memoryTitle: c.memoryTitle,
|
|
3133
|
+
memoryTypeId: c.memoryTypeId,
|
|
3134
|
+
memoryTypeName: c.memoryTypeName,
|
|
3135
|
+
pageNumbers: s
|
|
3136
|
+
}, g = `${c.memoryId}-${u}`, p = l === g;
|
|
3137
|
+
return /* @__PURE__ */ h(
|
|
3138
|
+
C.div,
|
|
2903
3139
|
{
|
|
2904
3140
|
initial: { opacity: 0 },
|
|
2905
3141
|
animate: { opacity: 1 },
|
|
@@ -2911,11 +3147,11 @@ const kr = ({
|
|
|
2911
3147
|
gap: "12px",
|
|
2912
3148
|
paddingTop: "12px",
|
|
2913
3149
|
paddingBottom: "12px",
|
|
2914
|
-
borderBottom: u <
|
|
3150
|
+
borderBottom: u < n.length - 1 ? "1px solid #eee" : void 0,
|
|
2915
3151
|
minWidth: 0
|
|
2916
3152
|
},
|
|
2917
3153
|
children: [
|
|
2918
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ h(
|
|
2919
3155
|
"div",
|
|
2920
3156
|
{
|
|
2921
3157
|
style: {
|
|
@@ -2947,7 +3183,7 @@ const kr = ({
|
|
|
2947
3183
|
whiteSpace: "pre-wrap",
|
|
2948
3184
|
wordBreak: "break-word"
|
|
2949
3185
|
},
|
|
2950
|
-
children: q(
|
|
3186
|
+
children: q(c.chunks)
|
|
2951
3187
|
}
|
|
2952
3188
|
),
|
|
2953
3189
|
/* @__PURE__ */ o(
|
|
@@ -2959,24 +3195,24 @@ const kr = ({
|
|
|
2959
3195
|
color: "#94a3b8",
|
|
2960
3196
|
lineHeight: 1.35
|
|
2961
3197
|
},
|
|
2962
|
-
children:
|
|
3198
|
+
children: d.join(" · ")
|
|
2963
3199
|
}
|
|
2964
3200
|
)
|
|
2965
3201
|
]
|
|
2966
3202
|
}
|
|
2967
3203
|
),
|
|
2968
|
-
|
|
3204
|
+
i && /* @__PURE__ */ h(
|
|
2969
3205
|
"button",
|
|
2970
3206
|
{
|
|
2971
3207
|
type: "button",
|
|
2972
|
-
"aria-busy":
|
|
2973
|
-
disabled:
|
|
3208
|
+
"aria-busy": p,
|
|
3209
|
+
disabled: p,
|
|
2974
3210
|
onClick: async () => {
|
|
2975
|
-
|
|
3211
|
+
a(g);
|
|
2976
3212
|
try {
|
|
2977
|
-
await
|
|
3213
|
+
await r(m);
|
|
2978
3214
|
} finally {
|
|
2979
|
-
|
|
3215
|
+
a(null);
|
|
2980
3216
|
}
|
|
2981
3217
|
},
|
|
2982
3218
|
style: {
|
|
@@ -2989,14 +3225,14 @@ const kr = ({
|
|
|
2989
3225
|
background: "#eff6ff",
|
|
2990
3226
|
border: "1px solid #bfdbfe",
|
|
2991
3227
|
borderRadius: 6,
|
|
2992
|
-
cursor:
|
|
3228
|
+
cursor: p ? "wait" : "pointer",
|
|
2993
3229
|
fontFamily: "inherit",
|
|
2994
3230
|
display: "inline-flex",
|
|
2995
3231
|
alignItems: "center",
|
|
2996
3232
|
gap: 8
|
|
2997
3233
|
},
|
|
2998
3234
|
children: [
|
|
2999
|
-
|
|
3235
|
+
p && /* @__PURE__ */ o(
|
|
3000
3236
|
"span",
|
|
3001
3237
|
{
|
|
3002
3238
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -3009,14 +3245,14 @@ const kr = ({
|
|
|
3009
3245
|
)
|
|
3010
3246
|
]
|
|
3011
3247
|
},
|
|
3012
|
-
`${
|
|
3248
|
+
`${c.memoryId}-${u}`
|
|
3013
3249
|
);
|
|
3014
3250
|
})
|
|
3015
3251
|
}
|
|
3016
3252
|
)
|
|
3017
3253
|
] });
|
|
3018
|
-
},
|
|
3019
|
-
|
|
3254
|
+
}, j = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
3255
|
+
C.div,
|
|
3020
3256
|
{
|
|
3021
3257
|
initial: { opacity: 0, y: -10 },
|
|
3022
3258
|
animate: { opacity: 1, y: 0 },
|
|
@@ -3038,94 +3274,94 @@ const kr = ({
|
|
|
3038
3274
|
}
|
|
3039
3275
|
)
|
|
3040
3276
|
}
|
|
3041
|
-
) }),
|
|
3277
|
+
) }), wr = ({
|
|
3042
3278
|
progressViewItems: e,
|
|
3043
|
-
loading:
|
|
3279
|
+
loading: r,
|
|
3044
3280
|
error: t,
|
|
3045
|
-
loadingText:
|
|
3046
|
-
t:
|
|
3047
|
-
onSourceClick:
|
|
3048
|
-
onSearchResultClick:
|
|
3049
|
-
onExploreQueryResultClick:
|
|
3281
|
+
loadingText: n,
|
|
3282
|
+
t: i,
|
|
3283
|
+
onSourceClick: l,
|
|
3284
|
+
onSearchResultClick: a,
|
|
3285
|
+
onExploreQueryResultClick: c
|
|
3050
3286
|
}) => {
|
|
3051
3287
|
const u = F(null);
|
|
3052
|
-
|
|
3288
|
+
A(() => {
|
|
3053
3289
|
u.current && (u.current.scrollTop = u.current.scrollHeight);
|
|
3054
3290
|
}, [e.length]);
|
|
3055
|
-
const y = (
|
|
3056
|
-
const m =
|
|
3291
|
+
const y = (d) => {
|
|
3292
|
+
const m = d.item.data;
|
|
3057
3293
|
if (m.taskType === "StreamingChatCompletion" && m.eventType === "Text")
|
|
3058
|
-
return /* @__PURE__ */ o(
|
|
3294
|
+
return /* @__PURE__ */ o(ne, { text: m.text });
|
|
3059
3295
|
if (m.taskType === "StructuredChatCompletion" && m.eventType === "Completed")
|
|
3060
|
-
return /* @__PURE__ */ o(
|
|
3296
|
+
return /* @__PURE__ */ o(Ne, { data: m });
|
|
3061
3297
|
if (m.taskType === "MemoryChat")
|
|
3062
3298
|
switch (m.eventType) {
|
|
3063
3299
|
case "Text":
|
|
3064
|
-
return /* @__PURE__ */ o(
|
|
3300
|
+
return /* @__PURE__ */ o(ne, { text: m.text });
|
|
3065
3301
|
case "FindMemories":
|
|
3066
3302
|
return /* @__PURE__ */ o(
|
|
3067
3303
|
_e,
|
|
3068
3304
|
{
|
|
3069
3305
|
data: m,
|
|
3070
|
-
isLatest:
|
|
3071
|
-
durationSeconds:
|
|
3072
|
-
t:
|
|
3306
|
+
isLatest: d.isLatest,
|
|
3307
|
+
durationSeconds: d.durationSeconds,
|
|
3308
|
+
t: i
|
|
3073
3309
|
}
|
|
3074
3310
|
);
|
|
3075
3311
|
case "FindMemoriesResult":
|
|
3076
3312
|
return /* @__PURE__ */ o(
|
|
3077
|
-
|
|
3313
|
+
je,
|
|
3078
3314
|
{
|
|
3079
3315
|
data: m,
|
|
3080
|
-
t:
|
|
3316
|
+
t: i
|
|
3081
3317
|
}
|
|
3082
3318
|
);
|
|
3083
3319
|
case "Search":
|
|
3084
3320
|
return /* @__PURE__ */ o(
|
|
3085
|
-
|
|
3321
|
+
Ue,
|
|
3086
3322
|
{
|
|
3087
3323
|
data: m,
|
|
3088
|
-
isLatest:
|
|
3089
|
-
durationSeconds:
|
|
3090
|
-
t:
|
|
3324
|
+
isLatest: d.isLatest,
|
|
3325
|
+
durationSeconds: d.durationSeconds,
|
|
3326
|
+
t: i
|
|
3091
3327
|
}
|
|
3092
3328
|
);
|
|
3093
3329
|
case "FindSources":
|
|
3094
3330
|
return /* @__PURE__ */ o(
|
|
3095
|
-
|
|
3331
|
+
Ge,
|
|
3096
3332
|
{
|
|
3097
3333
|
data: m,
|
|
3098
|
-
isLatest:
|
|
3099
|
-
durationSeconds:
|
|
3100
|
-
t:
|
|
3334
|
+
isLatest: d.isLatest,
|
|
3335
|
+
durationSeconds: d.durationSeconds,
|
|
3336
|
+
t: i
|
|
3101
3337
|
}
|
|
3102
3338
|
);
|
|
3103
3339
|
case "SourcesResult":
|
|
3104
3340
|
return /* @__PURE__ */ o(
|
|
3105
|
-
|
|
3341
|
+
qe,
|
|
3106
3342
|
{
|
|
3107
3343
|
data: m,
|
|
3108
|
-
onSourceClick:
|
|
3109
|
-
t:
|
|
3344
|
+
onSourceClick: l,
|
|
3345
|
+
t: i
|
|
3110
3346
|
}
|
|
3111
3347
|
);
|
|
3112
3348
|
case "ExploreMemories":
|
|
3113
3349
|
return /* @__PURE__ */ o(
|
|
3114
|
-
|
|
3350
|
+
Je,
|
|
3115
3351
|
{
|
|
3116
3352
|
data: m,
|
|
3117
|
-
completed:
|
|
3118
|
-
isLatest:
|
|
3119
|
-
t:
|
|
3353
|
+
completed: d.completed,
|
|
3354
|
+
isLatest: d.isLatest,
|
|
3355
|
+
t: i
|
|
3120
3356
|
}
|
|
3121
3357
|
);
|
|
3122
3358
|
case "ChunkResults":
|
|
3123
3359
|
return /* @__PURE__ */ o(
|
|
3124
|
-
|
|
3360
|
+
ir,
|
|
3125
3361
|
{
|
|
3126
3362
|
data: m,
|
|
3127
|
-
onSearchResultClick:
|
|
3128
|
-
t:
|
|
3363
|
+
onSearchResultClick: a,
|
|
3364
|
+
t: i
|
|
3129
3365
|
}
|
|
3130
3366
|
);
|
|
3131
3367
|
case "Completed":
|
|
@@ -3138,49 +3374,49 @@ const kr = ({
|
|
|
3138
3374
|
pr,
|
|
3139
3375
|
{
|
|
3140
3376
|
data: m,
|
|
3141
|
-
isLatest:
|
|
3142
|
-
durationSeconds:
|
|
3143
|
-
t:
|
|
3377
|
+
isLatest: d.isLatest,
|
|
3378
|
+
durationSeconds: d.durationSeconds,
|
|
3379
|
+
t: i
|
|
3144
3380
|
}
|
|
3145
3381
|
);
|
|
3146
3382
|
case "ExploreQueries":
|
|
3147
3383
|
return /* @__PURE__ */ o(
|
|
3148
|
-
|
|
3384
|
+
vr,
|
|
3149
3385
|
{
|
|
3150
3386
|
data: m,
|
|
3151
|
-
isLatest:
|
|
3152
|
-
durationSeconds:
|
|
3153
|
-
onExploreQueryResultClick:
|
|
3154
|
-
t:
|
|
3387
|
+
isLatest: d.isLatest,
|
|
3388
|
+
durationSeconds: d.durationSeconds,
|
|
3389
|
+
onExploreQueryResultClick: c,
|
|
3390
|
+
t: i
|
|
3155
3391
|
}
|
|
3156
3392
|
);
|
|
3157
3393
|
case "SearchMemoryTypes":
|
|
3158
3394
|
return /* @__PURE__ */ o(
|
|
3159
|
-
|
|
3395
|
+
cr,
|
|
3160
3396
|
{
|
|
3161
3397
|
data: m,
|
|
3162
|
-
isLatest:
|
|
3163
|
-
durationSeconds:
|
|
3164
|
-
t:
|
|
3398
|
+
isLatest: d.isLatest,
|
|
3399
|
+
durationSeconds: d.durationSeconds,
|
|
3400
|
+
t: i
|
|
3165
3401
|
}
|
|
3166
3402
|
);
|
|
3167
3403
|
case "Completed":
|
|
3168
3404
|
return /* @__PURE__ */ o(
|
|
3169
|
-
|
|
3405
|
+
Tr,
|
|
3170
3406
|
{
|
|
3171
3407
|
data: m,
|
|
3172
|
-
onSearchResultClick:
|
|
3173
|
-
t:
|
|
3408
|
+
onSearchResultClick: a,
|
|
3409
|
+
t: i
|
|
3174
3410
|
}
|
|
3175
3411
|
);
|
|
3176
3412
|
}
|
|
3177
|
-
return m.taskType === "StreamingChatCompletion" && m.eventType === "Completed" ? null : m.eventType === "Error" && "message" in m ? /* @__PURE__ */ o(
|
|
3413
|
+
return m.taskType === "StreamingChatCompletion" && m.eventType === "Completed" ? null : m.eventType === "Error" && "message" in m ? /* @__PURE__ */ o(j, { message: m.message }) : null;
|
|
3178
3414
|
};
|
|
3179
3415
|
if (e.length === 0)
|
|
3180
|
-
return t ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
|
|
3416
|
+
return t ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(j, { message: t.message }) }) : r ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
|
|
3181
3417
|
M,
|
|
3182
3418
|
{
|
|
3183
|
-
text:
|
|
3419
|
+
text: n ?? i.processingYourTask,
|
|
3184
3420
|
duration: 1.5,
|
|
3185
3421
|
repeat: !0,
|
|
3186
3422
|
repeatDelay: 0,
|
|
@@ -3188,23 +3424,23 @@ const kr = ({
|
|
|
3188
3424
|
shimmerColor: "#000"
|
|
3189
3425
|
}
|
|
3190
3426
|
) }) : null;
|
|
3191
|
-
const
|
|
3192
|
-
const g =
|
|
3427
|
+
const s = e.filter((d, m) => {
|
|
3428
|
+
const g = d.item.data;
|
|
3193
3429
|
return g.taskType === "MemoryChat" && g.eventType === "ExploreMemories" ? !e.slice(m + 1).some(
|
|
3194
|
-
(
|
|
3430
|
+
(S) => S.item.data.taskType === "MemoryChat" && S.item.data.eventType === "ExploreMemories"
|
|
3195
3431
|
) : g.taskType === "MemorySearch" && g.eventType === "GeneratingQueries" ? !e.slice(m + 1).some(
|
|
3196
|
-
(
|
|
3432
|
+
(S) => S.item.data.taskType === "MemorySearch" && S.item.data.eventType === "GeneratingQueries"
|
|
3197
3433
|
) : g.taskType === "MemorySearch" && g.eventType === "ExploreQueries" ? !e.slice(m + 1).some(
|
|
3198
|
-
(
|
|
3434
|
+
(S) => S.item.data.taskType === "MemorySearch" && S.item.data.eventType === "ExploreQueries"
|
|
3199
3435
|
) : g.taskType === "MemoryChat" && g.eventType === "ChunkResults" ? !e.slice(m + 1).some(
|
|
3200
|
-
(
|
|
3436
|
+
(S) => S.item.data.taskType === "MemoryChat" && S.item.data.eventType === "ChunkResults"
|
|
3201
3437
|
) : !0;
|
|
3202
3438
|
});
|
|
3203
|
-
return /* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */ o(
|
|
3205
|
-
|
|
3439
|
+
return /* @__PURE__ */ h("div", { id: "agent-task-progress-verbose", ref: u, children: [
|
|
3440
|
+
/* @__PURE__ */ o(fe, { children: s.map((d, m) => /* @__PURE__ */ o(
|
|
3441
|
+
C.div,
|
|
3206
3442
|
{
|
|
3207
|
-
id: `agent-task-progress-item-${
|
|
3443
|
+
id: `agent-task-progress-item-${d.item.progressItemId}`,
|
|
3208
3444
|
initial: { opacity: 0, y: -20 },
|
|
3209
3445
|
animate: { opacity: 1, y: 0 },
|
|
3210
3446
|
transition: {
|
|
@@ -3212,40 +3448,40 @@ const kr = ({
|
|
|
3212
3448
|
delay: m * 0.1,
|
|
3213
3449
|
ease: "easeOut"
|
|
3214
3450
|
},
|
|
3215
|
-
children: y(
|
|
3451
|
+
children: y(d)
|
|
3216
3452
|
},
|
|
3217
|
-
|
|
3453
|
+
d.item.progressItemId
|
|
3218
3454
|
)) }),
|
|
3219
|
-
t ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(
|
|
3455
|
+
t ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(j, { message: t.message }) }) : null
|
|
3220
3456
|
] });
|
|
3221
3457
|
}, Dr = ({
|
|
3222
3458
|
agentTask: e,
|
|
3223
|
-
language:
|
|
3459
|
+
language: r,
|
|
3224
3460
|
onSourceClick: t,
|
|
3225
|
-
onSearchResultClick:
|
|
3226
|
-
onExploreQueryResultClick:
|
|
3461
|
+
onSearchResultClick: n,
|
|
3462
|
+
onExploreQueryResultClick: i
|
|
3227
3463
|
}) => {
|
|
3228
|
-
const
|
|
3464
|
+
const l = ze(e), a = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : r ?? "en", c = He(a);
|
|
3229
3465
|
return /* @__PURE__ */ o(
|
|
3230
|
-
|
|
3466
|
+
wr,
|
|
3231
3467
|
{
|
|
3232
|
-
progressViewItems:
|
|
3468
|
+
progressViewItems: l,
|
|
3233
3469
|
loading: e.loading,
|
|
3234
3470
|
error: e.error,
|
|
3235
3471
|
loadingText: e.loadingText,
|
|
3236
|
-
t:
|
|
3472
|
+
t: c,
|
|
3237
3473
|
onSourceClick: t,
|
|
3238
|
-
onSearchResultClick:
|
|
3239
|
-
onExploreQueryResultClick:
|
|
3474
|
+
onSearchResultClick: n,
|
|
3475
|
+
onExploreQueryResultClick: i
|
|
3240
3476
|
}
|
|
3241
3477
|
);
|
|
3242
3478
|
};
|
|
3243
3479
|
export {
|
|
3244
3480
|
Dr as AgentTaskProgress,
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3481
|
+
D as Checkmark,
|
|
3482
|
+
Lr as FencyProvider,
|
|
3483
|
+
Tr as MemorySearchCompletedResults,
|
|
3484
|
+
Re as StreamEventManager,
|
|
3485
|
+
Q as XMark,
|
|
3250
3486
|
Pr as useAgentTasks
|
|
3251
3487
|
};
|