@fencyai/react 0.1.124 → 0.1.126
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/data-types/MemoryChatCompletionExploreMemory.d.ts +14 -0
- package/dist/agent-task/data-types/MemoryChatCompletionExploreMemory.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatCompletionFindSources.d.ts +12 -0
- package/dist/agent-task/data-types/MemoryChatCompletionFindSources.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatCompletionSearch.d.ts +12 -0
- package/dist/agent-task/data-types/MemoryChatCompletionSearch.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatCompletionSourcesResult.d.ts +11 -0
- package/dist/agent-task/data-types/MemoryChatCompletionSourcesResult.d.ts.map +1 -0
- package/dist/hooks/useAgentTasks/index.d.ts.map +1 -1
- package/dist/hooks/useStream/index.d.ts.map +1 -1
- package/dist/index.js +456 -481
- package/dist/types/AgentTask.d.ts +0 -1
- package/dist/types/AgentTask.d.ts.map +1 -1
- package/dist/types/CreateAgentTaskParams.d.ts +3 -3
- package/dist/types/CreateAgentTaskParams.d.ts.map +1 -1
- package/dist/types/CreateAgentTaskResponse.d.ts +1 -1
- package/dist/types/CreateAgentTaskResponse.d.ts.map +1 -1
- package/dist/types/StreamData.d.ts +1 -48
- package/dist/types/StreamData.d.ts.map +1 -1
- package/dist/types/UseAgentTasksProps.d.ts +1 -1
- package/dist/types/UseAgentTasksProps.d.ts.map +1 -1
- package/dist/types/UseStreamProps.d.ts +2 -9
- package/dist/types/UseStreamProps.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionExploreMemory.d.ts +0 -14
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionExploreMemory.d.ts.map +0 -1
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionFindSources.d.ts +0 -12
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionFindSources.d.ts.map +0 -1
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionSearch.d.ts +0 -12
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionSearch.d.ts.map +0 -1
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionSourcesResult.d.ts +0 -11
- package/dist/agent-task/data-types/StreamingMemoryTypeChatCompletionSourcesResult.d.ts.map +0 -1
- package/dist/types/AgentTaskData.d.ts +0 -6
- package/dist/types/AgentTaskData.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as C, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { createStream as K, isStreamTimeoutEvent as _, isStreamNotFoundEvent as J, isAgentTaskProgressItemUpdatedEvent as V, createAgentTask as q } from "@fencyai/js";
|
|
3
|
-
import { createContext as G, useState as
|
|
4
|
-
import { useInView as Q, motion as
|
|
3
|
+
import { createContext as G, useState as k, useRef as E, useEffect as w, useCallback as L, useContext as X, useMemo as U } from "react";
|
|
4
|
+
import { useInView as Q, motion as T, AnimatePresence as W } from "motion/react";
|
|
5
5
|
import Y from "react-markdown";
|
|
6
6
|
import { Prism as $ } from "react-syntax-highlighter";
|
|
7
7
|
import Z from "remark-gfm";
|
|
@@ -9,70 +9,70 @@ import './assets/index.css';const N = G(
|
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
11
|
async function ee(e, t) {
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
t(
|
|
12
|
+
const n = e.getReader();
|
|
13
|
+
let r;
|
|
14
|
+
for (; !(r = await n.read()).done; )
|
|
15
|
+
t(r.value);
|
|
16
16
|
}
|
|
17
17
|
function te(e) {
|
|
18
|
-
let t,
|
|
19
|
-
return function(
|
|
20
|
-
t === void 0 ? (t =
|
|
21
|
-
const
|
|
18
|
+
let t, n, r, c = !1;
|
|
19
|
+
return function(i) {
|
|
20
|
+
t === void 0 ? (t = i, n = 0, r = -1) : t = ne(t, i);
|
|
21
|
+
const l = t.length;
|
|
22
22
|
let d = 0;
|
|
23
|
-
for (;
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
for (;
|
|
27
|
-
switch (t[
|
|
23
|
+
for (; n < l; ) {
|
|
24
|
+
c && (t[n] === 10 && (d = ++n), c = !1);
|
|
25
|
+
let o = -1;
|
|
26
|
+
for (; n < l && o === -1; ++n)
|
|
27
|
+
switch (t[n]) {
|
|
28
28
|
case 58:
|
|
29
|
-
|
|
29
|
+
r === -1 && (r = n - d);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
|
-
|
|
32
|
+
c = !0;
|
|
33
33
|
case 10:
|
|
34
|
-
|
|
34
|
+
o = n;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
if (
|
|
37
|
+
if (o === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(t.subarray(d,
|
|
39
|
+
e(t.subarray(d, o), r), d = n, r = -1;
|
|
40
40
|
}
|
|
41
|
-
d ===
|
|
41
|
+
d === l ? t = void 0 : d !== 0 && (t = t.subarray(d), n -= d);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
return function(
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
else if (
|
|
51
|
-
const d =
|
|
44
|
+
function re(e, t, n) {
|
|
45
|
+
let r = F();
|
|
46
|
+
const c = new TextDecoder();
|
|
47
|
+
return function(i, l) {
|
|
48
|
+
if (i.length === 0)
|
|
49
|
+
n == null || n(r), r = F();
|
|
50
|
+
else if (l > 0) {
|
|
51
|
+
const d = c.decode(i.subarray(0, l)), o = l + (i[l + 1] === 32 ? 2 : 1), a = c.decode(i.subarray(o));
|
|
52
52
|
switch (d) {
|
|
53
53
|
case "data":
|
|
54
|
-
|
|
55
|
-
` +
|
|
54
|
+
r.data = r.data ? r.data + `
|
|
55
|
+
` + a : a;
|
|
56
56
|
break;
|
|
57
57
|
case "event":
|
|
58
|
-
|
|
58
|
+
r.event = a;
|
|
59
59
|
break;
|
|
60
60
|
case "id":
|
|
61
|
-
e(
|
|
61
|
+
e(r.id = a);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
64
|
+
const g = parseInt(a, 10);
|
|
65
|
+
isNaN(g) || t(r.retry = g);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
return
|
|
71
|
+
function ne(e, t) {
|
|
72
|
+
const n = new Uint8Array(e.length + t.length);
|
|
73
|
+
return n.set(e), n.set(t, e.length), n;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function F() {
|
|
76
76
|
return {
|
|
77
77
|
data: "",
|
|
78
78
|
event: "",
|
|
@@ -80,68 +80,68 @@ function P() {
|
|
|
80
80
|
retry: void 0
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
for (var
|
|
83
|
+
var oe = function(e, t) {
|
|
84
|
+
var n = {};
|
|
85
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
86
86
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
87
|
-
for (var
|
|
88
|
-
t.indexOf(
|
|
89
|
-
return
|
|
87
|
+
for (var c = 0, r = Object.getOwnPropertySymbols(e); c < r.length; c++)
|
|
88
|
+
t.indexOf(r[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[c]) && (n[r[c]] = e[r[c]]);
|
|
89
|
+
return n;
|
|
90
90
|
};
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
var { signal:
|
|
94
|
-
return new Promise((
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
|
|
91
|
+
const O = "text/event-stream", ae = 1e3, R = "last-event-id";
|
|
92
|
+
function se(e, t) {
|
|
93
|
+
var { signal: n, headers: r, onopen: c, onmessage: u, onclose: i, onerror: l, openWhenHidden: d, fetch: o } = t, a = oe(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((g, m) => {
|
|
95
|
+
const f = Object.assign({}, r);
|
|
96
|
+
f.accept || (f.accept = O);
|
|
97
|
+
let y;
|
|
98
|
+
function p() {
|
|
99
|
+
y.abort(), document.hidden || x();
|
|
100
100
|
}
|
|
101
|
-
d || document.addEventListener("visibilitychange",
|
|
102
|
-
let
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange",
|
|
101
|
+
d || document.addEventListener("visibilitychange", p);
|
|
102
|
+
let h = ae, S = 0;
|
|
103
|
+
function b() {
|
|
104
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), y.abort();
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
n == null || n.addEventListener("abort", () => {
|
|
107
|
+
b(), g();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
110
|
-
async function
|
|
111
|
-
var
|
|
112
|
-
|
|
109
|
+
const P = o ?? window.fetch, A = c ?? ie;
|
|
110
|
+
async function x() {
|
|
111
|
+
var M;
|
|
112
|
+
y = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
|
|
119
|
-
}, u))),
|
|
120
|
-
} catch (
|
|
121
|
-
if (!
|
|
114
|
+
const I = await P(e, Object.assign(Object.assign({}, a), { headers: f, signal: y.signal }));
|
|
115
|
+
await A(I), await ee(I.body, te(re((v) => {
|
|
116
|
+
v ? f[R] = v : delete f[R];
|
|
117
|
+
}, (v) => {
|
|
118
|
+
h = v;
|
|
119
|
+
}, u))), i == null || i(), b(), g();
|
|
120
|
+
} catch (I) {
|
|
121
|
+
if (!y.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
|
|
123
|
+
const v = (M = l == null ? void 0 : l(I)) !== null && M !== void 0 ? M : h;
|
|
124
|
+
window.clearTimeout(S), S = window.setTimeout(x, v);
|
|
125
|
+
} catch (v) {
|
|
126
|
+
b(), m(v);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
x();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function ie(e) {
|
|
134
134
|
const t = e.headers.get("content-type");
|
|
135
|
-
if (!(t != null && t.startsWith(
|
|
136
|
-
throw new Error(`Expected content-type to be ${
|
|
135
|
+
if (!(t != null && t.startsWith(O)))
|
|
136
|
+
throw new Error(`Expected content-type to be ${O}, Actual: ${t}`);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const t = atob(e),
|
|
140
|
-
for (let
|
|
141
|
-
r
|
|
142
|
-
return new TextDecoder("utf-8").decode(
|
|
138
|
+
function ce(e) {
|
|
139
|
+
const t = atob(e), n = new Uint8Array(t.length);
|
|
140
|
+
for (let r = 0; r < t.length; r++)
|
|
141
|
+
n[r] = t.charCodeAt(r);
|
|
142
|
+
return new TextDecoder("utf-8").decode(n);
|
|
143
143
|
}
|
|
144
|
-
class
|
|
144
|
+
class le {
|
|
145
145
|
constructor(t) {
|
|
146
146
|
this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = t;
|
|
147
147
|
}
|
|
@@ -150,37 +150,37 @@ class ce {
|
|
|
150
150
|
* Creates new connections and removes old ones.
|
|
151
151
|
*/
|
|
152
152
|
updateStreams(t) {
|
|
153
|
-
t.forEach((
|
|
154
|
-
const
|
|
155
|
-
this.eventSources.has(
|
|
153
|
+
t.forEach((r) => {
|
|
154
|
+
const c = r.stream.id;
|
|
155
|
+
this.eventSources.has(c) || this.connectStream(r);
|
|
156
156
|
});
|
|
157
|
-
const
|
|
158
|
-
this.eventSources.forEach((
|
|
159
|
-
|
|
157
|
+
const n = new Set(t.map((r) => r.stream.id));
|
|
158
|
+
this.eventSources.forEach((r, c) => {
|
|
159
|
+
n.has(c) || (r.abort(), this.eventSources.delete(c));
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
connectStream(t) {
|
|
163
|
-
const
|
|
164
|
-
this.eventSources.set(
|
|
165
|
-
const
|
|
163
|
+
const n = t.stream.id, r = new AbortController();
|
|
164
|
+
this.eventSources.set(n, r);
|
|
165
|
+
const c = `${this.fency.baseUrl}/sse/streams/${n}`, u = {
|
|
166
166
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
167
167
|
"X-Fency-Stream-Token": t.stream.token
|
|
168
168
|
};
|
|
169
|
-
|
|
169
|
+
se(c, {
|
|
170
170
|
headers: u,
|
|
171
|
-
signal:
|
|
172
|
-
async onopen(
|
|
173
|
-
if (!
|
|
174
|
-
throw new Error(`Client error ${
|
|
171
|
+
signal: r.signal,
|
|
172
|
+
async onopen(i) {
|
|
173
|
+
if (!i.ok && i.status >= 400 && i.status < 500 && i.status !== 429)
|
|
174
|
+
throw new Error(`Client error ${i.status}`);
|
|
175
175
|
},
|
|
176
|
-
onmessage: (
|
|
177
|
-
if (
|
|
178
|
-
const
|
|
179
|
-
this.broadcast(
|
|
176
|
+
onmessage: (i) => {
|
|
177
|
+
if (i.data) {
|
|
178
|
+
const l = ce(i.data);
|
|
179
|
+
this.broadcast(l, n);
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
onerror: (
|
|
183
|
-
throw console.error("EventSource error for stream",
|
|
182
|
+
onerror: (i) => {
|
|
183
|
+
throw console.error("EventSource error for stream", n, ":", i), this.broadcastError(n), i;
|
|
184
184
|
},
|
|
185
185
|
onclose() {
|
|
186
186
|
}
|
|
@@ -190,19 +190,19 @@ class ce {
|
|
|
190
190
|
* Subscribe to events from all active streams.
|
|
191
191
|
* Returns an unsubscribe function.
|
|
192
192
|
*/
|
|
193
|
-
subscribe(t,
|
|
194
|
-
return this.subscribers.set(t,
|
|
193
|
+
subscribe(t, n) {
|
|
194
|
+
return this.subscribers.set(t, n), () => {
|
|
195
195
|
this.subscribers.delete(t);
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
broadcast(t,
|
|
199
|
-
this.subscribers.forEach((
|
|
200
|
-
|
|
198
|
+
broadcast(t, n) {
|
|
199
|
+
this.subscribers.forEach((r) => {
|
|
200
|
+
r.onMessage(t, n);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
broadcastError(t) {
|
|
204
|
-
this.subscribers.forEach((
|
|
205
|
-
|
|
204
|
+
this.subscribers.forEach((n) => {
|
|
205
|
+
n.onError(t);
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -214,76 +214,76 @@ class ce {
|
|
|
214
214
|
}
|
|
215
215
|
const de = 12e4, ue = (e) => {
|
|
216
216
|
const t = Date.now();
|
|
217
|
-
return e.filter((
|
|
217
|
+
return e.filter((n) => t - n.createdAt < de);
|
|
218
218
|
};
|
|
219
|
-
function
|
|
220
|
-
const [
|
|
219
|
+
function Le({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
|
|
220
|
+
const [r, c] = k(
|
|
221
221
|
null
|
|
222
|
-
), [u,
|
|
223
|
-
|
|
224
|
-
e.then((
|
|
225
|
-
|
|
226
|
-
}).catch((
|
|
227
|
-
d(
|
|
222
|
+
), [u, i] = k(!0), [l, d] = k(null), [o, a] = k([]), g = E(null), m = E(null);
|
|
223
|
+
w(() => {
|
|
224
|
+
e.then((h) => {
|
|
225
|
+
c(h), i(!1);
|
|
226
|
+
}).catch((h) => {
|
|
227
|
+
d(h), i(!1);
|
|
228
228
|
});
|
|
229
|
-
}, [e]),
|
|
230
|
-
|
|
231
|
-
}, [
|
|
232
|
-
|
|
233
|
-
}, [
|
|
234
|
-
var
|
|
235
|
-
(
|
|
229
|
+
}, [e]), w(() => {
|
|
230
|
+
r && !m.current && (m.current = new le(r));
|
|
231
|
+
}, [r]), w(() => {
|
|
232
|
+
m.current && m.current.updateStreams(o);
|
|
233
|
+
}, [o]), w(() => () => {
|
|
234
|
+
var h;
|
|
235
|
+
(h = m.current) == null || h.cleanup();
|
|
236
236
|
}, []);
|
|
237
|
-
const
|
|
238
|
-
async (
|
|
239
|
-
if (
|
|
240
|
-
return
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
237
|
+
const f = L(
|
|
238
|
+
async (h = 3e4) => {
|
|
239
|
+
if (g.current)
|
|
240
|
+
return g.current;
|
|
241
|
+
const S = Date.now(), b = o.length > 0 ? o[o.length - 1] : null;
|
|
242
|
+
if (b && S - b.createdAt < h)
|
|
243
|
+
return b.stream;
|
|
244
|
+
const P = (async () => {
|
|
245
|
+
if (!r)
|
|
246
246
|
throw new Error("Fency instance not initialized");
|
|
247
|
-
const
|
|
248
|
-
pk:
|
|
249
|
-
baseUrl:
|
|
250
|
-
clientToken: (
|
|
247
|
+
const A = await t(), x = await K({
|
|
248
|
+
pk: r.publishableKey,
|
|
249
|
+
baseUrl: r.baseUrl,
|
|
250
|
+
clientToken: (A == null ? void 0 : A.clientToken) ?? ""
|
|
251
251
|
});
|
|
252
|
-
if (
|
|
253
|
-
const
|
|
254
|
-
stream:
|
|
252
|
+
if (x.type === "success") {
|
|
253
|
+
const M = {
|
|
254
|
+
stream: x.stream,
|
|
255
255
|
createdAt: Date.now()
|
|
256
256
|
};
|
|
257
|
-
return
|
|
258
|
-
const
|
|
259
|
-
return ue(
|
|
260
|
-
}),
|
|
257
|
+
return a((I) => {
|
|
258
|
+
const v = [...I, M];
|
|
259
|
+
return ue(v);
|
|
260
|
+
}), g.current = null, x.stream;
|
|
261
261
|
} else
|
|
262
|
-
throw
|
|
262
|
+
throw g.current = null, new Error("Failed to create stream");
|
|
263
263
|
})();
|
|
264
|
-
return
|
|
264
|
+
return g.current = P, P;
|
|
265
265
|
},
|
|
266
|
-
[
|
|
266
|
+
[r, o]
|
|
267
267
|
);
|
|
268
|
-
if (
|
|
269
|
-
return /* @__PURE__ */
|
|
268
|
+
if (l)
|
|
269
|
+
return /* @__PURE__ */ C("div", { children: [
|
|
270
270
|
"Fency error: ",
|
|
271
|
-
|
|
271
|
+
l.message
|
|
272
272
|
] });
|
|
273
|
-
if (!
|
|
273
|
+
if (!r)
|
|
274
274
|
return null;
|
|
275
|
-
const
|
|
276
|
-
fency:
|
|
275
|
+
const y = o.length > 0 ? o[o.length - 1] : null, p = {
|
|
276
|
+
fency: r,
|
|
277
277
|
loading: u,
|
|
278
|
-
error:
|
|
279
|
-
activeStreams:
|
|
280
|
-
latestStream:
|
|
281
|
-
eventManager:
|
|
282
|
-
getOrCreateStream:
|
|
278
|
+
error: l,
|
|
279
|
+
activeStreams: o,
|
|
280
|
+
latestStream: y,
|
|
281
|
+
eventManager: m.current,
|
|
282
|
+
getOrCreateStream: f
|
|
283
283
|
};
|
|
284
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ s(N.Provider, { value: p, children: n });
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function j() {
|
|
287
287
|
const e = X(N);
|
|
288
288
|
if (e === void 0)
|
|
289
289
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
@@ -312,51 +312,30 @@ const me = (e) => {
|
|
|
312
312
|
timestamp: e.timestamp,
|
|
313
313
|
createdAt: e.createdAt,
|
|
314
314
|
data: JSON.parse(e.data)
|
|
315
|
-
}),
|
|
316
|
-
const t =
|
|
317
|
-
return
|
|
315
|
+
}), pe = (e) => {
|
|
316
|
+
const t = j(), [n, r] = k(null), c = E(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
317
|
+
return w(() => {
|
|
318
318
|
if (!t.eventManager) return;
|
|
319
|
-
const
|
|
320
|
-
onMessage: (d,
|
|
321
|
-
var
|
|
322
|
-
const
|
|
323
|
-
if (
|
|
324
|
-
switch (
|
|
325
|
-
case "NewChatCompletionStreamChunk":
|
|
326
|
-
(y = e == null ? void 0 : e.onNewChatCompletionStreamChunk) == null || y.call(e, o);
|
|
327
|
-
break;
|
|
328
|
-
case "ChatCompletionStreamCompleted":
|
|
329
|
-
(g = e == null ? void 0 : e.onChatCompletionStreamCompleted) == null || g.call(e, o);
|
|
330
|
-
break;
|
|
319
|
+
const i = {
|
|
320
|
+
onMessage: (d, o) => {
|
|
321
|
+
var g, m, f;
|
|
322
|
+
const a = me(d);
|
|
323
|
+
if (a)
|
|
324
|
+
switch (a.type) {
|
|
331
325
|
case "StreamTimeout":
|
|
332
|
-
(
|
|
326
|
+
(g = e == null ? void 0 : e.onStreamTimeout) == null || g.call(e, a);
|
|
333
327
|
break;
|
|
334
328
|
case "StreamNotFound":
|
|
335
|
-
(m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e,
|
|
336
|
-
break;
|
|
337
|
-
case "FileUploadCompleted":
|
|
338
|
-
(S = e == null ? void 0 : e.onFileUploadCompleted) == null || S.call(e, o);
|
|
339
|
-
break;
|
|
340
|
-
case "FileTextContentReady":
|
|
341
|
-
(f = e == null ? void 0 : e.onFileTextContentReady) == null || f.call(e, o);
|
|
342
|
-
break;
|
|
343
|
-
case "WebsiteHtmlContentReady":
|
|
344
|
-
(b = e == null ? void 0 : e.onWebsiteHtmlContentReady) == null || b.call(e, o);
|
|
345
|
-
break;
|
|
346
|
-
case "WebsiteTextContentReady":
|
|
347
|
-
(C = e == null ? void 0 : e.onWebsiteTextContentReady) == null || C.call(e, o);
|
|
348
|
-
break;
|
|
349
|
-
case "FileSearchIndexReady":
|
|
350
|
-
(p = e == null ? void 0 : e.onFileSearchIndexReady) == null || p.call(e, o);
|
|
329
|
+
(m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, a);
|
|
351
330
|
break;
|
|
352
331
|
case "AgentTaskProgressItemUpdated":
|
|
353
|
-
(
|
|
332
|
+
(f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
|
|
354
333
|
break;
|
|
355
334
|
}
|
|
356
335
|
},
|
|
357
336
|
onError: (d) => {
|
|
358
|
-
var
|
|
359
|
-
(
|
|
337
|
+
var o;
|
|
338
|
+
(o = e == null ? void 0 : e.onStreamError) == null || o.call(e, {
|
|
360
339
|
streamId: d,
|
|
361
340
|
error: {
|
|
362
341
|
code: "UnknownError",
|
|
@@ -366,250 +345,246 @@ const me = (e) => {
|
|
|
366
345
|
}
|
|
367
346
|
};
|
|
368
347
|
return t.eventManager.subscribe(
|
|
369
|
-
|
|
370
|
-
|
|
348
|
+
c.current,
|
|
349
|
+
i
|
|
371
350
|
);
|
|
372
351
|
}, [t.eventManager, e]), {
|
|
373
352
|
createStream: async () => {
|
|
374
353
|
try {
|
|
375
|
-
const
|
|
376
|
-
return
|
|
354
|
+
const i = await t.getOrCreateStream(3e4);
|
|
355
|
+
return r(i), {
|
|
377
356
|
type: "success",
|
|
378
|
-
stream:
|
|
357
|
+
stream: i
|
|
379
358
|
};
|
|
380
|
-
} catch (
|
|
359
|
+
} catch (i) {
|
|
381
360
|
return {
|
|
382
361
|
type: "error",
|
|
383
362
|
error: {
|
|
384
363
|
code: "UnknownError",
|
|
385
|
-
message:
|
|
364
|
+
message: i instanceof Error ? i.message : "Failed to create stream"
|
|
386
365
|
}
|
|
387
366
|
};
|
|
388
367
|
}
|
|
389
368
|
},
|
|
390
|
-
stream:
|
|
369
|
+
stream: n
|
|
391
370
|
};
|
|
392
371
|
}, Ue = (e) => {
|
|
393
|
-
const t =
|
|
394
|
-
onAgentTaskProgressItemUpdated: (
|
|
395
|
-
var
|
|
396
|
-
if (!
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const
|
|
400
|
-
|
|
372
|
+
const t = j(), [n, r] = k([]), c = E(/* @__PURE__ */ new Set()), u = E(/* @__PURE__ */ new Map()), { createStream: i } = pe({
|
|
373
|
+
onAgentTaskProgressItemUpdated: (o) => {
|
|
374
|
+
var m;
|
|
375
|
+
if (!c.current.has(o.agentTaskId)) return;
|
|
376
|
+
const a = o.data;
|
|
377
|
+
if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChatCompletion" && a.eventType === "Completed") {
|
|
378
|
+
const f = u.current.get(
|
|
379
|
+
o.agentTaskId
|
|
401
380
|
);
|
|
402
|
-
|
|
381
|
+
f && (u.current.delete(o.agentTaskId), f(a));
|
|
403
382
|
return;
|
|
404
383
|
}
|
|
405
|
-
(
|
|
406
|
-
(
|
|
407
|
-
var
|
|
408
|
-
if (((
|
|
409
|
-
return
|
|
410
|
-
const
|
|
411
|
-
(
|
|
412
|
-
) ?
|
|
413
|
-
(
|
|
414
|
-
) : [...
|
|
415
|
-
return { ...
|
|
384
|
+
(m = e.onAgentTaskProgressItemUpdated) == null || m.call(e, o), r(
|
|
385
|
+
(f) => f.map((y) => {
|
|
386
|
+
var S;
|
|
387
|
+
if (((S = y.confirmedData) == null ? void 0 : S.taskId) !== o.agentTaskId)
|
|
388
|
+
return y;
|
|
389
|
+
const h = y.progressItems.some(
|
|
390
|
+
(b) => b.progressItemId === o.progressItemId
|
|
391
|
+
) ? y.progressItems.map(
|
|
392
|
+
(b) => b.progressItemId === o.progressItemId ? o : b
|
|
393
|
+
) : [...y.progressItems, o];
|
|
394
|
+
return { ...y, progressItems: h };
|
|
416
395
|
})
|
|
417
396
|
);
|
|
418
397
|
},
|
|
419
|
-
onStreamError: (
|
|
420
|
-
var
|
|
421
|
-
(
|
|
422
|
-
const
|
|
423
|
-
return
|
|
424
|
-
...
|
|
398
|
+
onStreamError: (o) => {
|
|
399
|
+
var a;
|
|
400
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), r((g) => {
|
|
401
|
+
const m = g.find((f) => f.streamId === o.streamId);
|
|
402
|
+
return m ? [
|
|
403
|
+
...g.filter((f) => f.streamId !== o.streamId),
|
|
425
404
|
{
|
|
426
|
-
...
|
|
405
|
+
...m,
|
|
427
406
|
loading: !1,
|
|
428
|
-
error:
|
|
407
|
+
error: o.error
|
|
429
408
|
}
|
|
430
|
-
] :
|
|
409
|
+
] : g;
|
|
431
410
|
});
|
|
432
411
|
},
|
|
433
|
-
onStreamNotFound: (
|
|
434
|
-
var
|
|
435
|
-
(
|
|
412
|
+
onStreamNotFound: (o) => {
|
|
413
|
+
var a;
|
|
414
|
+
(a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, o);
|
|
436
415
|
},
|
|
437
|
-
onStreamTimeout: (
|
|
438
|
-
var
|
|
439
|
-
(
|
|
416
|
+
onStreamTimeout: (o) => {
|
|
417
|
+
var a;
|
|
418
|
+
(a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, o);
|
|
440
419
|
}
|
|
441
|
-
}),
|
|
442
|
-
async (
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
445
|
-
|
|
446
|
-
...
|
|
420
|
+
}), l = L(
|
|
421
|
+
async (o, a) => {
|
|
422
|
+
const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, m = await i();
|
|
423
|
+
if (m.type === "success") {
|
|
424
|
+
r([
|
|
425
|
+
...n,
|
|
447
426
|
{
|
|
448
|
-
taskKey:
|
|
449
|
-
streamId:
|
|
427
|
+
taskKey: g,
|
|
428
|
+
streamId: m.stream.id,
|
|
450
429
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
451
430
|
confirmedData: null,
|
|
452
431
|
error: null,
|
|
453
|
-
params:
|
|
432
|
+
params: o,
|
|
454
433
|
progressItems: [],
|
|
455
434
|
loading: !0,
|
|
456
|
-
|
|
457
|
-
loadingText: o == null ? void 0 : o.loadingText
|
|
435
|
+
loadingText: a == null ? void 0 : a.loadingText
|
|
458
436
|
}
|
|
459
437
|
]);
|
|
460
|
-
const { clientToken:
|
|
438
|
+
const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), y = await q({
|
|
461
439
|
pk: t.fency.publishableKey,
|
|
462
440
|
baseUrl: t.fency.baseUrl,
|
|
463
|
-
clientToken:
|
|
464
|
-
streamToken:
|
|
441
|
+
clientToken: f,
|
|
442
|
+
streamToken: m.stream.token,
|
|
465
443
|
request: {
|
|
466
|
-
streamingChatCompletionTask:
|
|
467
|
-
messages:
|
|
468
|
-
model:
|
|
444
|
+
streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
|
|
445
|
+
messages: o.messages,
|
|
446
|
+
model: o.model
|
|
469
447
|
} : void 0,
|
|
470
|
-
structuredChatCompletionTask:
|
|
471
|
-
messages:
|
|
472
|
-
jsonSchema:
|
|
473
|
-
model:
|
|
448
|
+
structuredChatCompletionTask: o.type === "StructuredChatCompletion" ? {
|
|
449
|
+
messages: o.messages,
|
|
450
|
+
jsonSchema: o.jsonSchema,
|
|
451
|
+
model: o.model
|
|
474
452
|
} : void 0,
|
|
475
|
-
|
|
476
|
-
messages:
|
|
477
|
-
model:
|
|
453
|
+
memoryChatCompletionTask: o.type === "MemoryChatCompletion" ? {
|
|
454
|
+
messages: o.messages,
|
|
455
|
+
model: o.model
|
|
478
456
|
} : void 0
|
|
479
457
|
}
|
|
480
458
|
});
|
|
481
|
-
if (
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
),
|
|
485
|
-
...
|
|
459
|
+
if (y.type === "success" && y.agentTask) {
|
|
460
|
+
c.current.add(
|
|
461
|
+
y.agentTask.id
|
|
462
|
+
), r((h) => [
|
|
463
|
+
...h.filter((S) => S.taskKey !== g),
|
|
486
464
|
{
|
|
487
|
-
taskKey:
|
|
488
|
-
streamId:
|
|
465
|
+
taskKey: g,
|
|
466
|
+
streamId: m.stream.id,
|
|
489
467
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
490
|
-
taskId:
|
|
491
|
-
createdAt:
|
|
468
|
+
taskId: y.agentTask.id,
|
|
469
|
+
createdAt: y.agentTask.createdAt,
|
|
492
470
|
error: null,
|
|
493
|
-
params:
|
|
471
|
+
params: o,
|
|
494
472
|
progressItems: [],
|
|
495
|
-
doneStreaming: !1,
|
|
496
473
|
loading: !0,
|
|
497
|
-
loadingText:
|
|
474
|
+
loadingText: a == null ? void 0 : a.loadingText,
|
|
498
475
|
confirmedData: {
|
|
499
|
-
taskId:
|
|
500
|
-
createdAt:
|
|
476
|
+
taskId: y.agentTask.id,
|
|
477
|
+
createdAt: y.agentTask.createdAt
|
|
501
478
|
}
|
|
502
479
|
}
|
|
503
480
|
]);
|
|
504
|
-
const
|
|
481
|
+
const p = await new Promise((h) => {
|
|
505
482
|
u.current.set(
|
|
506
|
-
|
|
507
|
-
|
|
483
|
+
y.agentTask.id,
|
|
484
|
+
h
|
|
508
485
|
);
|
|
509
486
|
});
|
|
510
487
|
return {
|
|
511
488
|
type: "success",
|
|
512
|
-
streamId:
|
|
513
|
-
agentTaskId:
|
|
514
|
-
response:
|
|
489
|
+
streamId: m.stream.id,
|
|
490
|
+
agentTaskId: y.agentTask.id,
|
|
491
|
+
response: p
|
|
515
492
|
};
|
|
516
493
|
} else {
|
|
517
|
-
if (
|
|
518
|
-
return
|
|
519
|
-
...
|
|
494
|
+
if (y.type === "error")
|
|
495
|
+
return r((p) => [
|
|
496
|
+
...p.filter((h) => h.taskKey !== g),
|
|
520
497
|
{
|
|
521
|
-
taskKey:
|
|
498
|
+
taskKey: g,
|
|
522
499
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
523
|
-
streamId:
|
|
524
|
-
params:
|
|
525
|
-
error:
|
|
500
|
+
streamId: m.stream.id,
|
|
501
|
+
params: o,
|
|
502
|
+
error: y.error,
|
|
526
503
|
progressItems: [],
|
|
527
504
|
loading: !1,
|
|
528
|
-
|
|
529
|
-
loadingText: o == null ? void 0 : o.loadingText,
|
|
505
|
+
loadingText: a == null ? void 0 : a.loadingText,
|
|
530
506
|
confirmedData: null
|
|
531
507
|
}
|
|
532
508
|
]), {
|
|
533
509
|
type: "error",
|
|
534
|
-
error:
|
|
510
|
+
error: y.error
|
|
535
511
|
};
|
|
536
512
|
{
|
|
537
|
-
const
|
|
513
|
+
const p = {
|
|
538
514
|
message: "No response received",
|
|
539
515
|
code: "UnknownError"
|
|
540
516
|
};
|
|
541
|
-
return
|
|
542
|
-
...
|
|
517
|
+
return r((h) => [
|
|
518
|
+
...h.filter((S) => S.taskKey !== g),
|
|
543
519
|
{
|
|
544
|
-
taskKey:
|
|
520
|
+
taskKey: g,
|
|
545
521
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
546
|
-
streamId:
|
|
547
|
-
error:
|
|
548
|
-
params:
|
|
522
|
+
streamId: m.stream.id,
|
|
523
|
+
error: p,
|
|
524
|
+
params: o,
|
|
549
525
|
progressItems: [],
|
|
550
526
|
loading: !1,
|
|
551
|
-
|
|
552
|
-
loadingText: o == null ? void 0 : o.loadingText,
|
|
527
|
+
loadingText: a == null ? void 0 : a.loadingText,
|
|
553
528
|
confirmedData: null
|
|
554
529
|
}
|
|
555
530
|
]), {
|
|
556
531
|
type: "error",
|
|
557
|
-
error:
|
|
532
|
+
error: p
|
|
558
533
|
};
|
|
559
534
|
}
|
|
560
535
|
}
|
|
561
536
|
} else
|
|
562
|
-
return console.error(
|
|
537
|
+
return console.error(m.error), m;
|
|
563
538
|
},
|
|
564
|
-
[t,
|
|
539
|
+
[t, n, i]
|
|
565
540
|
), d = U(() => {
|
|
566
|
-
if (
|
|
567
|
-
return [...
|
|
568
|
-
}, [
|
|
569
|
-
return
|
|
570
|
-
|
|
541
|
+
if (n.length !== 0)
|
|
542
|
+
return [...n].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
|
|
543
|
+
}, [n]);
|
|
544
|
+
return w(() => () => {
|
|
545
|
+
c.current.clear(), u.current.clear();
|
|
571
546
|
}, []), {
|
|
572
|
-
agentTasks:
|
|
573
|
-
createAgentTask:
|
|
547
|
+
agentTasks: n,
|
|
548
|
+
createAgentTask: l,
|
|
574
549
|
latest: d
|
|
575
550
|
};
|
|
576
551
|
};
|
|
577
|
-
function
|
|
578
|
-
return e.progressItems.map((t,
|
|
579
|
-
const
|
|
552
|
+
function Se(e) {
|
|
553
|
+
return e.progressItems.map((t, n) => {
|
|
554
|
+
const r = e.progressItems[n + 1], c = r != null;
|
|
580
555
|
let u;
|
|
581
|
-
if (
|
|
582
|
-
const
|
|
583
|
-
u = Math.round((
|
|
556
|
+
if (r != null && r.createdAt) {
|
|
557
|
+
const i = new Date(t.createdAt).getTime(), l = new Date(r.createdAt).getTime();
|
|
558
|
+
u = Math.round((l - i) / 1e3);
|
|
584
559
|
}
|
|
585
560
|
return {
|
|
586
561
|
item: t,
|
|
587
|
-
completed:
|
|
588
|
-
isLatest:
|
|
562
|
+
completed: c,
|
|
563
|
+
isLatest: n === e.progressItems.length - 1,
|
|
589
564
|
durationSeconds: u
|
|
590
565
|
};
|
|
591
566
|
});
|
|
592
567
|
}
|
|
593
|
-
function
|
|
568
|
+
function D({
|
|
594
569
|
text: e,
|
|
595
570
|
duration: t = 2,
|
|
596
|
-
delay:
|
|
597
|
-
repeat:
|
|
598
|
-
repeatDelay:
|
|
571
|
+
delay: n = 0,
|
|
572
|
+
repeat: r = !0,
|
|
573
|
+
repeatDelay: c = 0.5,
|
|
599
574
|
className: u,
|
|
600
|
-
startOnView:
|
|
601
|
-
once:
|
|
575
|
+
startOnView: i = !1,
|
|
576
|
+
once: l = !1,
|
|
602
577
|
inViewMargin: d,
|
|
603
|
-
spread:
|
|
604
|
-
color:
|
|
605
|
-
shimmerColor:
|
|
606
|
-
direction:
|
|
578
|
+
spread: o = 2,
|
|
579
|
+
color: a = "#999",
|
|
580
|
+
shimmerColor: g = "#000",
|
|
581
|
+
direction: m = "fromBottom"
|
|
607
582
|
}) {
|
|
608
|
-
const
|
|
609
|
-
return /* @__PURE__ */
|
|
610
|
-
|
|
583
|
+
const f = E(null), y = Q(f, { once: l, margin: d }), p = U(() => e.length * o, [e, o]), h = !i || y, S = m === "fromBottom" ? "100% center" : "-100% center", b = m === "fromBottom" ? "0% center" : "200% center";
|
|
584
|
+
return /* @__PURE__ */ s(
|
|
585
|
+
T.span,
|
|
611
586
|
{
|
|
612
|
-
ref:
|
|
587
|
+
ref: f,
|
|
613
588
|
className: u,
|
|
614
589
|
style: {
|
|
615
590
|
position: "relative",
|
|
@@ -620,38 +595,38 @@ function F({
|
|
|
620
595
|
color: "transparent",
|
|
621
596
|
WebkitTextFillColor: "transparent",
|
|
622
597
|
backgroundRepeat: "no-repeat, padding-box",
|
|
623
|
-
"--spread": `${
|
|
624
|
-
"--base-color":
|
|
625
|
-
"--shimmer-color":
|
|
598
|
+
"--spread": `${p}px`,
|
|
599
|
+
"--base-color": a,
|
|
600
|
+
"--shimmer-color": g,
|
|
626
601
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
627
602
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
628
603
|
},
|
|
629
604
|
initial: {
|
|
630
|
-
backgroundPosition:
|
|
605
|
+
backgroundPosition: S,
|
|
631
606
|
opacity: 0
|
|
632
607
|
},
|
|
633
|
-
animate:
|
|
634
|
-
backgroundPosition:
|
|
608
|
+
animate: h ? {
|
|
609
|
+
backgroundPosition: b,
|
|
635
610
|
opacity: 1
|
|
636
611
|
} : {},
|
|
637
612
|
transition: {
|
|
638
613
|
backgroundPosition: {
|
|
639
|
-
repeat:
|
|
614
|
+
repeat: r ? 1 / 0 : 0,
|
|
640
615
|
duration: t,
|
|
641
|
-
delay:
|
|
642
|
-
repeatDelay:
|
|
616
|
+
delay: n,
|
|
617
|
+
repeatDelay: c,
|
|
643
618
|
ease: "linear"
|
|
644
619
|
},
|
|
645
620
|
opacity: {
|
|
646
621
|
duration: 0.3,
|
|
647
|
-
delay:
|
|
622
|
+
delay: n
|
|
648
623
|
}
|
|
649
624
|
},
|
|
650
625
|
children: e
|
|
651
626
|
}
|
|
652
627
|
);
|
|
653
628
|
}
|
|
654
|
-
function
|
|
629
|
+
function be(e) {
|
|
655
630
|
const t = e.item.data;
|
|
656
631
|
if (t.taskType === "StreamingChatCompletion") {
|
|
657
632
|
if (t.eventType === "Text") return "Streaming...";
|
|
@@ -661,7 +636,7 @@ function Ce(e) {
|
|
|
661
636
|
if (t.eventType === "Json") return "Generating...";
|
|
662
637
|
if (t.eventType === "Completed") return "Completed";
|
|
663
638
|
}
|
|
664
|
-
if (t.taskType === "
|
|
639
|
+
if (t.taskType === "MemoryChatCompletion")
|
|
665
640
|
switch (t.eventType) {
|
|
666
641
|
case "Text":
|
|
667
642
|
return "Streaming...";
|
|
@@ -682,28 +657,28 @@ function Ce(e) {
|
|
|
682
657
|
}
|
|
683
658
|
return "Processing...";
|
|
684
659
|
}
|
|
685
|
-
const
|
|
660
|
+
const ve = ({ progressViewItems: e }) => {
|
|
686
661
|
const t = e[e.length - 1];
|
|
687
662
|
if (!t) return null;
|
|
688
|
-
const
|
|
689
|
-
return /* @__PURE__ */
|
|
690
|
-
|
|
663
|
+
const n = be(t);
|
|
664
|
+
return /* @__PURE__ */ s("div", { className: "simple-mode-container", children: /* @__PURE__ */ s(W, { mode: "wait", children: /* @__PURE__ */ s(
|
|
665
|
+
T.div,
|
|
691
666
|
{
|
|
692
667
|
initial: { opacity: 0, y: 10 },
|
|
693
668
|
animate: { opacity: 1, y: 0 },
|
|
694
669
|
exit: { opacity: 0, y: -10 },
|
|
695
670
|
transition: { duration: 0.3 },
|
|
696
|
-
children: t.completed ? /* @__PURE__ */
|
|
671
|
+
children: t.completed ? /* @__PURE__ */ s(
|
|
697
672
|
"div",
|
|
698
673
|
{
|
|
699
674
|
className: "simple-mode-title",
|
|
700
675
|
style: { color: "#666" },
|
|
701
|
-
children:
|
|
676
|
+
children: n
|
|
702
677
|
}
|
|
703
|
-
) : /* @__PURE__ */
|
|
704
|
-
|
|
678
|
+
) : /* @__PURE__ */ s(
|
|
679
|
+
D,
|
|
705
680
|
{
|
|
706
|
-
text:
|
|
681
|
+
text: n,
|
|
707
682
|
className: "simple-mode-title",
|
|
708
683
|
duration: 2.5,
|
|
709
684
|
repeat: !0,
|
|
@@ -714,7 +689,7 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
714
689
|
},
|
|
715
690
|
t.item.progressItemId
|
|
716
691
|
) }) });
|
|
717
|
-
},
|
|
692
|
+
}, H = {
|
|
718
693
|
'code[class*="language-"]': {
|
|
719
694
|
color: "#f8f8f2",
|
|
720
695
|
background: "none",
|
|
@@ -867,52 +842,52 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
867
842
|
}
|
|
868
843
|
}, z = ({
|
|
869
844
|
text: e
|
|
870
|
-
}) => /* @__PURE__ */
|
|
871
|
-
|
|
845
|
+
}) => /* @__PURE__ */ s("div", { style: { padding: "16px" }, children: /* @__PURE__ */ s(
|
|
846
|
+
T.div,
|
|
872
847
|
{
|
|
873
848
|
className: "fency-markdown-body-raw",
|
|
874
849
|
initial: { opacity: 0, y: -10 },
|
|
875
850
|
animate: { opacity: 1, y: 0 },
|
|
876
851
|
transition: { duration: 0.3, delay: 0 },
|
|
877
|
-
children: /* @__PURE__ */
|
|
852
|
+
children: /* @__PURE__ */ s(
|
|
878
853
|
Y,
|
|
879
854
|
{
|
|
880
855
|
remarkPlugins: [Z],
|
|
881
856
|
components: {
|
|
882
857
|
code(t) {
|
|
883
|
-
const { children:
|
|
884
|
-
return
|
|
858
|
+
const { children: n, className: r, node: c, ref: u, ...i } = t, l = /language-(\w+)/.exec(r || "");
|
|
859
|
+
return l ? /* @__PURE__ */ s(
|
|
885
860
|
$,
|
|
886
861
|
{
|
|
887
|
-
...
|
|
862
|
+
...i,
|
|
888
863
|
PreTag: "div",
|
|
889
|
-
children: String(
|
|
890
|
-
language:
|
|
891
|
-
style:
|
|
864
|
+
children: String(n).replace(/\n$/, ""),
|
|
865
|
+
language: l[1],
|
|
866
|
+
style: H
|
|
892
867
|
}
|
|
893
|
-
) : /* @__PURE__ */
|
|
868
|
+
) : /* @__PURE__ */ s("code", { ...i, className: r, children: String(n) });
|
|
894
869
|
}
|
|
895
870
|
},
|
|
896
871
|
children: e
|
|
897
872
|
}
|
|
898
873
|
)
|
|
899
874
|
}
|
|
900
|
-
) }),
|
|
875
|
+
) }), Te = ({ data: e }) => {
|
|
901
876
|
const t = JSON.stringify(e.json, null, 2);
|
|
902
|
-
return /* @__PURE__ */
|
|
903
|
-
|
|
877
|
+
return /* @__PURE__ */ s("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ s(
|
|
878
|
+
T.div,
|
|
904
879
|
{
|
|
905
880
|
initial: { opacity: 0, y: -10 },
|
|
906
881
|
animate: { opacity: 1, y: 0 },
|
|
907
882
|
transition: { duration: 0.3, delay: 0 },
|
|
908
|
-
children: /* @__PURE__ */
|
|
883
|
+
children: /* @__PURE__ */ s($, { language: "json", style: H, PreTag: "div", children: t })
|
|
909
884
|
}
|
|
910
885
|
) });
|
|
911
|
-
},
|
|
912
|
-
const
|
|
913
|
-
return /* @__PURE__ */
|
|
914
|
-
/* @__PURE__ */
|
|
915
|
-
|
|
886
|
+
}, Ce = ({ data: e, isLatest: t = !1, durationSeconds: n }) => {
|
|
887
|
+
const r = `Searching: ${e.queryDescription}`;
|
|
888
|
+
return /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
|
|
889
|
+
/* @__PURE__ */ s(
|
|
890
|
+
T.div,
|
|
916
891
|
{
|
|
917
892
|
style: {
|
|
918
893
|
display: "flex",
|
|
@@ -923,19 +898,19 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
923
898
|
initial: { opacity: 0, y: -10 },
|
|
924
899
|
animate: { opacity: 1, y: 0 },
|
|
925
900
|
transition: { duration: 0.3, delay: 0 },
|
|
926
|
-
children: t && !
|
|
927
|
-
|
|
901
|
+
children: t && !n ? /* @__PURE__ */ s(
|
|
902
|
+
D,
|
|
928
903
|
{
|
|
929
|
-
text:
|
|
904
|
+
text: r,
|
|
930
905
|
duration: 2.5,
|
|
931
906
|
repeat: !0,
|
|
932
907
|
color: "#999",
|
|
933
908
|
shimmerColor: "#000"
|
|
934
909
|
}
|
|
935
|
-
) : /* @__PURE__ */
|
|
910
|
+
) : /* @__PURE__ */ s("span", { style: { color: "#666" }, children: r })
|
|
936
911
|
}
|
|
937
912
|
),
|
|
938
|
-
|
|
913
|
+
n !== void 0 && /* @__PURE__ */ C(
|
|
939
914
|
"div",
|
|
940
915
|
{
|
|
941
916
|
style: {
|
|
@@ -946,17 +921,17 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
946
921
|
},
|
|
947
922
|
children: [
|
|
948
923
|
"Took ",
|
|
949
|
-
|
|
924
|
+
n,
|
|
950
925
|
" seconds"
|
|
951
926
|
]
|
|
952
927
|
}
|
|
953
928
|
)
|
|
954
929
|
] });
|
|
955
|
-
},
|
|
956
|
-
const
|
|
957
|
-
return /* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
|
|
930
|
+
}, ke = ({ isLatest: e = !1, durationSeconds: t }) => {
|
|
931
|
+
const n = "Adding sources...";
|
|
932
|
+
return /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
|
|
933
|
+
/* @__PURE__ */ s(
|
|
934
|
+
T.div,
|
|
960
935
|
{
|
|
961
936
|
style: {
|
|
962
937
|
display: "flex",
|
|
@@ -967,19 +942,19 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
967
942
|
initial: { opacity: 0, y: -10 },
|
|
968
943
|
animate: { opacity: 1, y: 0 },
|
|
969
944
|
transition: { duration: 0.3, delay: 0 },
|
|
970
|
-
children: e && !t ? /* @__PURE__ */
|
|
971
|
-
|
|
945
|
+
children: e && !t ? /* @__PURE__ */ s(
|
|
946
|
+
D,
|
|
972
947
|
{
|
|
973
|
-
text:
|
|
948
|
+
text: n,
|
|
974
949
|
duration: 2.5,
|
|
975
950
|
repeat: !0,
|
|
976
951
|
color: "#999",
|
|
977
952
|
shimmerColor: "#000"
|
|
978
953
|
}
|
|
979
|
-
) : /* @__PURE__ */
|
|
954
|
+
) : /* @__PURE__ */ s("span", { style: { color: "#666" }, children: n })
|
|
980
955
|
}
|
|
981
956
|
),
|
|
982
|
-
t !== void 0 && /* @__PURE__ */
|
|
957
|
+
t !== void 0 && /* @__PURE__ */ C(
|
|
983
958
|
"div",
|
|
984
959
|
{
|
|
985
960
|
style: {
|
|
@@ -996,9 +971,9 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
996
971
|
}
|
|
997
972
|
)
|
|
998
973
|
] });
|
|
999
|
-
},
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
|
|
974
|
+
}, xe = ({ data: e, onSourceClick: t }) => /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
|
|
975
|
+
/* @__PURE__ */ s(
|
|
976
|
+
T.div,
|
|
1002
977
|
{
|
|
1003
978
|
style: {
|
|
1004
979
|
marginBottom: "10px",
|
|
@@ -1014,17 +989,17 @@ const Te = ({ progressViewItems: e }) => {
|
|
|
1014
989
|
children: "Sources"
|
|
1015
990
|
}
|
|
1016
991
|
),
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
|
|
992
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ s("span", { style: { fontSize: "13px", color: "#888" }, children: "No sources" }) : e.sources.map((n, r) => /* @__PURE__ */ s(
|
|
993
|
+
Ee,
|
|
1019
994
|
{
|
|
1020
|
-
source:
|
|
1021
|
-
index:
|
|
995
|
+
source: n,
|
|
996
|
+
index: r,
|
|
1022
997
|
onSourceClick: t
|
|
1023
998
|
},
|
|
1024
|
-
|
|
999
|
+
n.memoryId
|
|
1025
1000
|
)) })
|
|
1026
1001
|
] });
|
|
1027
|
-
function
|
|
1002
|
+
function we(e) {
|
|
1028
1003
|
if (e.length === 0) return "";
|
|
1029
1004
|
if (e.length === 1) return `page ${e[0]}`;
|
|
1030
1005
|
if (e.length === 2)
|
|
@@ -1032,17 +1007,17 @@ function pe(e) {
|
|
|
1032
1007
|
const t = e[e.length - 1];
|
|
1033
1008
|
return `pages ${e.slice(0, -1).join(", ")} and ${t}`;
|
|
1034
1009
|
}
|
|
1035
|
-
const
|
|
1036
|
-
const [
|
|
1037
|
-
return /* @__PURE__ */
|
|
1038
|
-
|
|
1010
|
+
const Ee = ({ source: e, index: t, onSourceClick: n }) => {
|
|
1011
|
+
const [r, c] = k(!1), u = !!n, i = e.pageNumbers ?? [], l = we(i);
|
|
1012
|
+
return /* @__PURE__ */ C(
|
|
1013
|
+
T.div,
|
|
1039
1014
|
{
|
|
1040
1015
|
initial: { opacity: 0, scale: 0.9 },
|
|
1041
1016
|
animate: { opacity: 1, scale: 1 },
|
|
1042
1017
|
transition: { duration: 0.25, delay: t * 0.05 },
|
|
1043
|
-
onClick: u ? () =>
|
|
1044
|
-
onMouseEnter: u ? () =>
|
|
1045
|
-
onMouseLeave: u ? () =>
|
|
1018
|
+
onClick: u ? () => n(e.memoryId) : void 0,
|
|
1019
|
+
onMouseEnter: u ? () => c(!0) : void 0,
|
|
1020
|
+
onMouseLeave: u ? () => c(!1) : void 0,
|
|
1046
1021
|
style: {
|
|
1047
1022
|
display: "inline-flex",
|
|
1048
1023
|
flexDirection: "column",
|
|
@@ -1050,29 +1025,29 @@ const Ie = ({ source: e, index: t, onSourceClick: r }) => {
|
|
|
1050
1025
|
padding: "8px 12px",
|
|
1051
1026
|
borderRadius: "6px",
|
|
1052
1027
|
border: "1px solid #e0e0e0",
|
|
1053
|
-
backgroundColor:
|
|
1028
|
+
backgroundColor: r ? "#f5f5f5" : "transparent",
|
|
1054
1029
|
cursor: u ? "pointer" : "default",
|
|
1055
1030
|
transition: "background-color 0.15s ease",
|
|
1056
1031
|
userSelect: "none"
|
|
1057
1032
|
},
|
|
1058
1033
|
children: [
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
|
|
1034
|
+
/* @__PURE__ */ s("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1035
|
+
l && /* @__PURE__ */ s("span", { style: { fontSize: "12px", color: "#666" }, children: l })
|
|
1061
1036
|
]
|
|
1062
1037
|
}
|
|
1063
1038
|
);
|
|
1064
1039
|
};
|
|
1065
|
-
function
|
|
1040
|
+
function Ie({
|
|
1066
1041
|
eventType: e,
|
|
1067
1042
|
completed: t
|
|
1068
1043
|
}) {
|
|
1069
|
-
return e === "ExploreMemoryError" ? /* @__PURE__ */
|
|
1044
|
+
return e === "ExploreMemoryError" ? /* @__PURE__ */ s("span", { style: { color: "#c62828", fontSize: 14, fontWeight: 600 }, children: "✗" }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ s("span", { style: { color: "#999", fontSize: 14, fontWeight: 600 }, children: "✓" }) : e === "ExploreMemoryStart" && t ? /* @__PURE__ */ s("span", { style: { color: "#999", fontSize: 14, fontWeight: 600 }, children: "✓" }) : null;
|
|
1070
1045
|
}
|
|
1071
|
-
const B = 80, Ae = ({ data: e, completed: t, isLatest:
|
|
1072
|
-
const [
|
|
1046
|
+
const B = 80, Ae = ({ data: e, completed: t, isLatest: n = !1 }) => {
|
|
1047
|
+
const [r, c] = k(!1), u = e.eventType === "ExploreMemoryResult" ? e.result : void 0, i = u != null && u.length > B, l = u != null ? r || !i ? u : `${u.slice(0, B)}...` : void 0, d = i;
|
|
1073
1048
|
if (e.eventType === "ExploreMemoryStart" && !t) {
|
|
1074
|
-
const
|
|
1075
|
-
return /* @__PURE__ */
|
|
1049
|
+
const a = `Exploring ${e.memoryTitle}...`;
|
|
1050
|
+
return /* @__PURE__ */ s(
|
|
1076
1051
|
"div",
|
|
1077
1052
|
{
|
|
1078
1053
|
style: {
|
|
@@ -1080,26 +1055,26 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1080
1055
|
display: "flex",
|
|
1081
1056
|
alignItems: "center"
|
|
1082
1057
|
},
|
|
1083
|
-
children:
|
|
1084
|
-
|
|
1058
|
+
children: n ? /* @__PURE__ */ s(
|
|
1059
|
+
D,
|
|
1085
1060
|
{
|
|
1086
|
-
text:
|
|
1061
|
+
text: a,
|
|
1087
1062
|
duration: 2.5,
|
|
1088
1063
|
repeat: !0,
|
|
1089
1064
|
color: "#999",
|
|
1090
1065
|
shimmerColor: "#000"
|
|
1091
1066
|
}
|
|
1092
|
-
) : /* @__PURE__ */
|
|
1067
|
+
) : /* @__PURE__ */ s("span", { style: { fontSize: 13, color: "#999" }, children: a })
|
|
1093
1068
|
}
|
|
1094
1069
|
);
|
|
1095
1070
|
}
|
|
1096
|
-
return /* @__PURE__ */
|
|
1097
|
-
|
|
1071
|
+
return /* @__PURE__ */ s("div", { style: { padding: "16px" }, children: /* @__PURE__ */ C(
|
|
1072
|
+
T.div,
|
|
1098
1073
|
{
|
|
1099
1074
|
initial: { opacity: 0 },
|
|
1100
1075
|
animate: { opacity: 1 },
|
|
1101
1076
|
transition: { duration: 0.25 },
|
|
1102
|
-
onClick: d ? () =>
|
|
1077
|
+
onClick: d ? () => c((a) => !a) : void 0,
|
|
1103
1078
|
style: {
|
|
1104
1079
|
paddingBottom: "12px",
|
|
1105
1080
|
borderBottom: "1px solid #eee",
|
|
@@ -1111,7 +1086,7 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1111
1086
|
cursor: d ? "pointer" : "default"
|
|
1112
1087
|
},
|
|
1113
1088
|
children: [
|
|
1114
|
-
/* @__PURE__ */
|
|
1089
|
+
/* @__PURE__ */ s(
|
|
1115
1090
|
"div",
|
|
1116
1091
|
{
|
|
1117
1092
|
style: {
|
|
@@ -1121,10 +1096,10 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1121
1096
|
flexShrink: 0,
|
|
1122
1097
|
width: 20
|
|
1123
1098
|
},
|
|
1124
|
-
children: /* @__PURE__ */
|
|
1099
|
+
children: /* @__PURE__ */ s(Ie, { eventType: e.eventType, completed: t })
|
|
1125
1100
|
}
|
|
1126
1101
|
),
|
|
1127
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ C(
|
|
1128
1103
|
"div",
|
|
1129
1104
|
{
|
|
1130
1105
|
style: {
|
|
@@ -1134,20 +1109,20 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1134
1109
|
minWidth: 0
|
|
1135
1110
|
},
|
|
1136
1111
|
children: [
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
|
|
1112
|
+
/* @__PURE__ */ s("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1113
|
+
l != null && /* @__PURE__ */ s(
|
|
1139
1114
|
"span",
|
|
1140
1115
|
{
|
|
1141
1116
|
style: {
|
|
1142
1117
|
fontSize: 12,
|
|
1143
1118
|
color: "#666",
|
|
1144
1119
|
lineHeight: 1.4,
|
|
1145
|
-
whiteSpace:
|
|
1120
|
+
whiteSpace: r ? "pre-wrap" : void 0
|
|
1146
1121
|
},
|
|
1147
|
-
children:
|
|
1122
|
+
children: l
|
|
1148
1123
|
}
|
|
1149
1124
|
),
|
|
1150
|
-
d && /* @__PURE__ */
|
|
1125
|
+
d && /* @__PURE__ */ s(
|
|
1151
1126
|
"span",
|
|
1152
1127
|
{
|
|
1153
1128
|
style: {
|
|
@@ -1155,7 +1130,7 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1155
1130
|
color: "#999",
|
|
1156
1131
|
marginTop: 2
|
|
1157
1132
|
},
|
|
1158
|
-
children:
|
|
1133
|
+
children: r ? "Click to collapse" : "Click to expand"
|
|
1159
1134
|
}
|
|
1160
1135
|
)
|
|
1161
1136
|
]
|
|
@@ -1167,59 +1142,59 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1167
1142
|
}, Me = ({
|
|
1168
1143
|
progressViewItems: e,
|
|
1169
1144
|
streamToken: t,
|
|
1170
|
-
fetchClientToken:
|
|
1171
|
-
loadingText:
|
|
1172
|
-
onSourceClick:
|
|
1145
|
+
fetchClientToken: n,
|
|
1146
|
+
loadingText: r,
|
|
1147
|
+
onSourceClick: c
|
|
1173
1148
|
}) => {
|
|
1174
|
-
const u =
|
|
1175
|
-
|
|
1149
|
+
const u = E(null);
|
|
1150
|
+
w(() => {
|
|
1176
1151
|
u.current && (u.current.scrollTop = u.current.scrollHeight);
|
|
1177
1152
|
}, [e.length]);
|
|
1178
|
-
const
|
|
1179
|
-
const d =
|
|
1153
|
+
const i = (l) => {
|
|
1154
|
+
const d = l.item.data;
|
|
1180
1155
|
if (d.taskType === "StreamingChatCompletion" && d.eventType === "Text")
|
|
1181
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ s(z, { text: d.text });
|
|
1182
1157
|
if (d.taskType === "StructuredChatCompletion" && d.eventType === "Json")
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
if (d.taskType === "
|
|
1158
|
+
return /* @__PURE__ */ s(Te, { data: d });
|
|
1159
|
+
if (d.taskType === "MemoryChatCompletion")
|
|
1185
1160
|
switch (d.eventType) {
|
|
1186
1161
|
case "Text":
|
|
1187
|
-
return /* @__PURE__ */
|
|
1162
|
+
return /* @__PURE__ */ s(z, { text: d.text });
|
|
1188
1163
|
case "Search":
|
|
1189
|
-
return /* @__PURE__ */
|
|
1190
|
-
|
|
1164
|
+
return /* @__PURE__ */ s(
|
|
1165
|
+
Ce,
|
|
1191
1166
|
{
|
|
1192
1167
|
data: d,
|
|
1193
|
-
isLatest:
|
|
1194
|
-
durationSeconds:
|
|
1168
|
+
isLatest: l.isLatest,
|
|
1169
|
+
durationSeconds: l.durationSeconds
|
|
1195
1170
|
}
|
|
1196
1171
|
);
|
|
1197
1172
|
case "FindSources":
|
|
1198
|
-
return /* @__PURE__ */
|
|
1199
|
-
|
|
1173
|
+
return /* @__PURE__ */ s(
|
|
1174
|
+
ke,
|
|
1200
1175
|
{
|
|
1201
1176
|
data: d,
|
|
1202
|
-
isLatest:
|
|
1203
|
-
durationSeconds:
|
|
1177
|
+
isLatest: l.isLatest,
|
|
1178
|
+
durationSeconds: l.durationSeconds
|
|
1204
1179
|
}
|
|
1205
1180
|
);
|
|
1206
1181
|
case "SourcesResult":
|
|
1207
|
-
return /* @__PURE__ */
|
|
1208
|
-
|
|
1182
|
+
return /* @__PURE__ */ s(
|
|
1183
|
+
xe,
|
|
1209
1184
|
{
|
|
1210
1185
|
data: d,
|
|
1211
|
-
onSourceClick:
|
|
1186
|
+
onSourceClick: c
|
|
1212
1187
|
}
|
|
1213
1188
|
);
|
|
1214
1189
|
case "ExploreMemoryStart":
|
|
1215
1190
|
case "ExploreMemoryResult":
|
|
1216
1191
|
case "ExploreMemoryError":
|
|
1217
|
-
return /* @__PURE__ */
|
|
1192
|
+
return /* @__PURE__ */ s(
|
|
1218
1193
|
Ae,
|
|
1219
1194
|
{
|
|
1220
1195
|
data: d,
|
|
1221
|
-
completed:
|
|
1222
|
-
isLatest:
|
|
1196
|
+
completed: l.completed,
|
|
1197
|
+
isLatest: l.isLatest
|
|
1223
1198
|
}
|
|
1224
1199
|
);
|
|
1225
1200
|
case "Completed":
|
|
@@ -1227,20 +1202,20 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1227
1202
|
}
|
|
1228
1203
|
return d.taskType === "StreamingChatCompletion" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed", null;
|
|
1229
1204
|
};
|
|
1230
|
-
return e.length === 0 ? /* @__PURE__ */
|
|
1231
|
-
|
|
1205
|
+
return e.length === 0 ? /* @__PURE__ */ s("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ s(
|
|
1206
|
+
D,
|
|
1232
1207
|
{
|
|
1233
|
-
text:
|
|
1208
|
+
text: r ?? "Processing your task...",
|
|
1234
1209
|
duration: 1.5,
|
|
1235
1210
|
repeat: !0,
|
|
1236
1211
|
repeatDelay: 0,
|
|
1237
1212
|
color: "#999",
|
|
1238
1213
|
shimmerColor: "#000"
|
|
1239
1214
|
}
|
|
1240
|
-
) }) : /* @__PURE__ */
|
|
1241
|
-
|
|
1215
|
+
) }) : /* @__PURE__ */ s("div", { id: "agent-task-progress-verbose", ref: u, children: /* @__PURE__ */ s(W, { children: e.map((l, d) => /* @__PURE__ */ s(
|
|
1216
|
+
T.div,
|
|
1242
1217
|
{
|
|
1243
|
-
id: `agent-task-progress-item-${
|
|
1218
|
+
id: `agent-task-progress-item-${l.item.progressItemId}`,
|
|
1244
1219
|
initial: { opacity: 0, y: -20 },
|
|
1245
1220
|
animate: { opacity: 1, y: 0 },
|
|
1246
1221
|
transition: {
|
|
@@ -1248,31 +1223,31 @@ const B = 80, Ae = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
|
1248
1223
|
delay: d * 0.1,
|
|
1249
1224
|
ease: "easeOut"
|
|
1250
1225
|
},
|
|
1251
|
-
children:
|
|
1226
|
+
children: i(l)
|
|
1252
1227
|
},
|
|
1253
|
-
|
|
1228
|
+
l.item.progressItemId
|
|
1254
1229
|
)) }) });
|
|
1255
|
-
},
|
|
1230
|
+
}, We = ({
|
|
1256
1231
|
agentTask: e,
|
|
1257
1232
|
mode: t = "verbose",
|
|
1258
|
-
streamToken:
|
|
1259
|
-
fetchClientToken:
|
|
1260
|
-
onSourceClick:
|
|
1233
|
+
streamToken: n,
|
|
1234
|
+
fetchClientToken: r,
|
|
1235
|
+
onSourceClick: c
|
|
1261
1236
|
}) => {
|
|
1262
|
-
const u =
|
|
1263
|
-
return t === "simple" ? /* @__PURE__ */
|
|
1237
|
+
const u = Se(e);
|
|
1238
|
+
return t === "simple" ? /* @__PURE__ */ s(ve, { progressViewItems: u }) : /* @__PURE__ */ s(
|
|
1264
1239
|
Me,
|
|
1265
1240
|
{
|
|
1266
1241
|
progressViewItems: u,
|
|
1267
|
-
streamToken:
|
|
1268
|
-
fetchClientToken:
|
|
1242
|
+
streamToken: n,
|
|
1243
|
+
fetchClientToken: r,
|
|
1269
1244
|
loadingText: e.loadingText,
|
|
1270
|
-
onSourceClick:
|
|
1245
|
+
onSourceClick: c
|
|
1271
1246
|
}
|
|
1272
1247
|
);
|
|
1273
1248
|
};
|
|
1274
1249
|
export {
|
|
1275
|
-
|
|
1276
|
-
|
|
1250
|
+
We as AgentTaskProgress,
|
|
1251
|
+
Le as FencyProvider,
|
|
1277
1252
|
Ue as useAgentTasks
|
|
1278
1253
|
};
|