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