@fencyai/react 0.1.121 → 0.1.122
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/index.js +398 -396
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createAgentTask as G, createStream as J } from "@fencyai/js";
|
|
2
|
-
import { createContext as V, useContext as q, useState as
|
|
3
|
-
import { jsx as c, jsxs as x
|
|
4
|
-
import { useInView as
|
|
5
|
-
import
|
|
6
|
-
import { Prism as
|
|
7
|
-
import
|
|
2
|
+
import { createContext as V, useContext as q, useState as C, useRef as A, useEffect as E, useCallback as W, useMemo as B } from "react";
|
|
3
|
+
import { jsx as c, jsxs as x } from "react/jsx-runtime";
|
|
4
|
+
import { useInView as X, motion as v, AnimatePresence as L } from "motion/react";
|
|
5
|
+
import Q from "react-markdown";
|
|
6
|
+
import { Prism as $ } from "react-syntax-highlighter";
|
|
7
|
+
import Y from "remark-gfm";
|
|
8
8
|
import './assets/index.css';const _ = V(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
@@ -14,34 +14,34 @@ function N() {
|
|
|
14
14
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const Z = (e) => {
|
|
18
18
|
try {
|
|
19
19
|
const t = JSON.parse(e);
|
|
20
|
-
return
|
|
20
|
+
return ee(t);
|
|
21
21
|
} catch (t) {
|
|
22
22
|
return console.error("Error parsing message:", t), null;
|
|
23
23
|
}
|
|
24
|
-
},
|
|
24
|
+
}, ee = (e) => {
|
|
25
25
|
if (!(typeof e == "object" && e !== null && "type" in e && "streamId" in e && "timestamp" in e))
|
|
26
26
|
return null;
|
|
27
27
|
switch (e.type) {
|
|
28
28
|
case "StreamTimeout":
|
|
29
|
-
return
|
|
29
|
+
return te(e);
|
|
30
30
|
case "StreamNotFound":
|
|
31
|
-
return
|
|
31
|
+
return ne(e);
|
|
32
32
|
case "AgentTaskProgressItemUpdated":
|
|
33
|
-
return
|
|
33
|
+
return re(e);
|
|
34
34
|
}
|
|
35
35
|
return null;
|
|
36
|
-
},
|
|
36
|
+
}, te = (e) => ({
|
|
37
37
|
type: "StreamTimeout",
|
|
38
38
|
streamId: e.streamId,
|
|
39
39
|
timestamp: e.timestamp
|
|
40
|
-
}),
|
|
40
|
+
}), ne = (e) => ({
|
|
41
41
|
type: "StreamNotFound",
|
|
42
42
|
streamId: e.streamId,
|
|
43
43
|
timestamp: e.timestamp
|
|
44
|
-
}),
|
|
44
|
+
}), re = (e) => ({
|
|
45
45
|
type: "AgentTaskProgressItemUpdated",
|
|
46
46
|
streamId: e.streamId,
|
|
47
47
|
agentTaskId: e.agentTaskId,
|
|
@@ -49,18 +49,18 @@ const ee = (e) => {
|
|
|
49
49
|
timestamp: e.timestamp,
|
|
50
50
|
createdAt: e.createdAt,
|
|
51
51
|
data: JSON.parse(e.data)
|
|
52
|
-
}),
|
|
53
|
-
const t = N(), [
|
|
52
|
+
}), ae = (e) => {
|
|
53
|
+
const t = N(), [r, n] = C(null), o = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
54
54
|
return E(() => {
|
|
55
55
|
if (!t.eventManager) return;
|
|
56
56
|
const s = {
|
|
57
|
-
onMessage: (d,
|
|
58
|
-
var
|
|
59
|
-
const i =
|
|
57
|
+
onMessage: (d, a) => {
|
|
58
|
+
var g, u, S, y, T, f, h, b, I, w;
|
|
59
|
+
const i = Z(d);
|
|
60
60
|
if (i)
|
|
61
61
|
switch (i.type) {
|
|
62
62
|
case "NewChatCompletionStreamChunk":
|
|
63
|
-
(
|
|
63
|
+
(g = e == null ? void 0 : e.onNewChatCompletionStreamChunk) == null || g.call(e, i);
|
|
64
64
|
break;
|
|
65
65
|
case "ChatCompletionStreamCompleted":
|
|
66
66
|
(u = e == null ? void 0 : e.onChatCompletionStreamCompleted) == null || u.call(e, i);
|
|
@@ -92,8 +92,8 @@ const ee = (e) => {
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
onError: (d) => {
|
|
95
|
-
var
|
|
96
|
-
(
|
|
95
|
+
var a;
|
|
96
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
|
|
97
97
|
streamId: d,
|
|
98
98
|
error: {
|
|
99
99
|
code: "UnknownError",
|
|
@@ -103,14 +103,14 @@ const ee = (e) => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
return t.eventManager.subscribe(
|
|
106
|
-
|
|
106
|
+
o.current,
|
|
107
107
|
s
|
|
108
108
|
);
|
|
109
109
|
}, [t.eventManager, e]), {
|
|
110
110
|
createStream: async () => {
|
|
111
111
|
try {
|
|
112
112
|
const s = await t.getOrCreateStream(3e4);
|
|
113
|
-
return
|
|
113
|
+
return n(s), {
|
|
114
114
|
type: "success",
|
|
115
115
|
stream: s
|
|
116
116
|
};
|
|
@@ -124,110 +124,110 @@ const ee = (e) => {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
|
-
stream:
|
|
127
|
+
stream: r
|
|
128
128
|
};
|
|
129
|
-
},
|
|
130
|
-
const t = N(), [
|
|
131
|
-
onAgentTaskProgressItemUpdated: (
|
|
129
|
+
}, Oe = (e) => {
|
|
130
|
+
const t = N(), [r, n] = C([]), o = A(/* @__PURE__ */ new Set()), m = A(/* @__PURE__ */ new Map()), { createStream: s } = ae({
|
|
131
|
+
onAgentTaskProgressItemUpdated: (a) => {
|
|
132
132
|
var u;
|
|
133
|
-
if (!
|
|
134
|
-
const i =
|
|
133
|
+
if (!o.current.has(a.agentTaskId)) return;
|
|
134
|
+
const i = a.data;
|
|
135
135
|
if (i.taskType === "StreamingChatCompletion" && i.eventType === "Completed" || i.taskType === "StructuredChatCompletion" && i.eventType === "Completed" || i.taskType === "StreamingMemoryTypeChatCompletion" && i.eventType === "Completed") {
|
|
136
|
-
const S =
|
|
137
|
-
|
|
136
|
+
const S = m.current.get(
|
|
137
|
+
a.agentTaskId
|
|
138
138
|
);
|
|
139
|
-
S && (
|
|
139
|
+
S && (m.current.delete(a.agentTaskId), S(i));
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
(u = e.onAgentTaskProgressItemUpdated) == null || u.call(e,
|
|
142
|
+
(u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, a), n(
|
|
143
143
|
(S) => S.map((y) => {
|
|
144
144
|
var h;
|
|
145
|
-
if (((h = y.confirmedData) == null ? void 0 : h.taskId) !==
|
|
145
|
+
if (((h = y.confirmedData) == null ? void 0 : h.taskId) !== a.agentTaskId)
|
|
146
146
|
return y;
|
|
147
147
|
const f = y.progressItems.some(
|
|
148
|
-
(b) => b.progressItemId ===
|
|
148
|
+
(b) => b.progressItemId === a.progressItemId
|
|
149
149
|
) ? y.progressItems.map(
|
|
150
|
-
(b) => b.progressItemId ===
|
|
151
|
-
) : [...y.progressItems,
|
|
150
|
+
(b) => b.progressItemId === a.progressItemId ? a : b
|
|
151
|
+
) : [...y.progressItems, a];
|
|
152
152
|
return { ...y, progressItems: f };
|
|
153
153
|
})
|
|
154
154
|
);
|
|
155
155
|
},
|
|
156
|
-
onStreamError: (
|
|
156
|
+
onStreamError: (a) => {
|
|
157
157
|
var i;
|
|
158
|
-
(i = e == null ? void 0 : e.onStreamError) == null || i.call(e,
|
|
159
|
-
const u =
|
|
158
|
+
(i = e == null ? void 0 : e.onStreamError) == null || i.call(e, a), n((g) => {
|
|
159
|
+
const u = g.find((S) => S.streamId === a.streamId);
|
|
160
160
|
return u ? [
|
|
161
|
-
...
|
|
161
|
+
...g.filter((S) => S.streamId !== a.streamId),
|
|
162
162
|
{
|
|
163
163
|
...u,
|
|
164
164
|
loading: !1,
|
|
165
|
-
error:
|
|
165
|
+
error: a.error
|
|
166
166
|
}
|
|
167
|
-
] :
|
|
167
|
+
] : g;
|
|
168
168
|
});
|
|
169
169
|
},
|
|
170
|
-
onStreamNotFound: (
|
|
170
|
+
onStreamNotFound: (a) => {
|
|
171
171
|
var i;
|
|
172
|
-
(i = e == null ? void 0 : e.onStreamNotFound) == null || i.call(e,
|
|
172
|
+
(i = e == null ? void 0 : e.onStreamNotFound) == null || i.call(e, a);
|
|
173
173
|
},
|
|
174
|
-
onStreamTimeout: (
|
|
174
|
+
onStreamTimeout: (a) => {
|
|
175
175
|
var i;
|
|
176
|
-
(i = e == null ? void 0 : e.onStreamTimeout) == null || i.call(e,
|
|
176
|
+
(i = e == null ? void 0 : e.onStreamTimeout) == null || i.call(e, a);
|
|
177
177
|
}
|
|
178
178
|
}), l = W(
|
|
179
|
-
async (
|
|
180
|
-
const
|
|
179
|
+
async (a, i) => {
|
|
180
|
+
const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await s();
|
|
181
181
|
if (u.type === "success") {
|
|
182
|
-
|
|
183
|
-
...
|
|
182
|
+
n([
|
|
183
|
+
...r,
|
|
184
184
|
{
|
|
185
|
-
taskKey:
|
|
185
|
+
taskKey: g,
|
|
186
186
|
streamId: u.stream.id,
|
|
187
187
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
188
188
|
confirmedData: null,
|
|
189
189
|
error: null,
|
|
190
|
-
params:
|
|
190
|
+
params: a,
|
|
191
191
|
progressItems: [],
|
|
192
192
|
loading: !0,
|
|
193
193
|
doneStreaming: !1,
|
|
194
194
|
loadingText: i == null ? void 0 : i.loadingText
|
|
195
195
|
}
|
|
196
196
|
]);
|
|
197
|
-
const { clientToken: S } = await e.fetchCreateAgentTaskClientToken(
|
|
197
|
+
const { clientToken: S } = await e.fetchCreateAgentTaskClientToken(a.type), y = await G({
|
|
198
198
|
pk: t.fency.publishableKey,
|
|
199
199
|
baseUrl: t.fency.baseUrl,
|
|
200
200
|
clientToken: S,
|
|
201
201
|
streamToken: u.stream.token,
|
|
202
202
|
request: {
|
|
203
|
-
streamingChatCompletionTask:
|
|
204
|
-
messages:
|
|
205
|
-
model:
|
|
203
|
+
streamingChatCompletionTask: a.type === "streamingChatCompletion" ? {
|
|
204
|
+
messages: a.messages,
|
|
205
|
+
model: a.model
|
|
206
206
|
} : void 0,
|
|
207
|
-
structuredChatCompletionTask:
|
|
208
|
-
messages:
|
|
209
|
-
jsonSchema:
|
|
210
|
-
model:
|
|
207
|
+
structuredChatCompletionTask: a.type === "structuredChatCompletion" ? {
|
|
208
|
+
messages: a.messages,
|
|
209
|
+
jsonSchema: a.jsonSchema,
|
|
210
|
+
model: a.model
|
|
211
211
|
} : void 0,
|
|
212
|
-
streamingMemoryTypeChatCompletionTask:
|
|
213
|
-
messages:
|
|
214
|
-
model:
|
|
212
|
+
streamingMemoryTypeChatCompletionTask: a.type === "streamingMemoryTypeChatCompletion" ? {
|
|
213
|
+
messages: a.messages,
|
|
214
|
+
model: a.model
|
|
215
215
|
} : void 0
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
if (y.type === "success" && y.agentTask) {
|
|
219
|
-
|
|
219
|
+
o.current.add(
|
|
220
220
|
y.agentTask.id
|
|
221
|
-
),
|
|
222
|
-
...f.filter((h) => h.taskKey !==
|
|
221
|
+
), n((f) => [
|
|
222
|
+
...f.filter((h) => h.taskKey !== g),
|
|
223
223
|
{
|
|
224
|
-
taskKey:
|
|
224
|
+
taskKey: g,
|
|
225
225
|
streamId: u.stream.id,
|
|
226
226
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
227
227
|
taskId: y.agentTask.id,
|
|
228
228
|
createdAt: y.agentTask.createdAt,
|
|
229
229
|
error: null,
|
|
230
|
-
params:
|
|
230
|
+
params: a,
|
|
231
231
|
progressItems: [],
|
|
232
232
|
doneStreaming: !1,
|
|
233
233
|
loading: !0,
|
|
@@ -239,7 +239,7 @@ const ee = (e) => {
|
|
|
239
239
|
}
|
|
240
240
|
]);
|
|
241
241
|
const T = await new Promise((f) => {
|
|
242
|
-
|
|
242
|
+
m.current.set(
|
|
243
243
|
y.agentTask.id,
|
|
244
244
|
f
|
|
245
245
|
);
|
|
@@ -252,13 +252,13 @@ const ee = (e) => {
|
|
|
252
252
|
};
|
|
253
253
|
} else {
|
|
254
254
|
if (y.type === "error")
|
|
255
|
-
return
|
|
256
|
-
...T.filter((f) => f.taskKey !==
|
|
255
|
+
return n((T) => [
|
|
256
|
+
...T.filter((f) => f.taskKey !== g),
|
|
257
257
|
{
|
|
258
|
-
taskKey:
|
|
258
|
+
taskKey: g,
|
|
259
259
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
260
260
|
streamId: u.stream.id,
|
|
261
|
-
params:
|
|
261
|
+
params: a,
|
|
262
262
|
error: y.error,
|
|
263
263
|
progressItems: [],
|
|
264
264
|
loading: !1,
|
|
@@ -275,14 +275,14 @@ const ee = (e) => {
|
|
|
275
275
|
message: "No response received",
|
|
276
276
|
code: "UnknownError"
|
|
277
277
|
};
|
|
278
|
-
return
|
|
279
|
-
...f.filter((h) => h.taskKey !==
|
|
278
|
+
return n((f) => [
|
|
279
|
+
...f.filter((h) => h.taskKey !== g),
|
|
280
280
|
{
|
|
281
|
-
taskKey:
|
|
281
|
+
taskKey: g,
|
|
282
282
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
283
283
|
streamId: u.stream.id,
|
|
284
284
|
error: T,
|
|
285
|
-
params:
|
|
285
|
+
params: a,
|
|
286
286
|
progressItems: [],
|
|
287
287
|
loading: !1,
|
|
288
288
|
doneStreaming: !1,
|
|
@@ -298,82 +298,82 @@ const ee = (e) => {
|
|
|
298
298
|
} else
|
|
299
299
|
return console.error(u.error), u;
|
|
300
300
|
},
|
|
301
|
-
[t,
|
|
302
|
-
), d =
|
|
303
|
-
if (
|
|
304
|
-
return [...
|
|
305
|
-
}, [
|
|
301
|
+
[t, r, s]
|
|
302
|
+
), d = B(() => {
|
|
303
|
+
if (r.length !== 0)
|
|
304
|
+
return [...r].sort((a, i) => new Date(i.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
|
|
305
|
+
}, [r]);
|
|
306
306
|
return E(() => () => {
|
|
307
|
-
|
|
307
|
+
o.current.clear(), m.current.clear();
|
|
308
308
|
}, []), {
|
|
309
|
-
agentTasks:
|
|
309
|
+
agentTasks: r,
|
|
310
310
|
createAgentTask: l,
|
|
311
311
|
latest: d
|
|
312
312
|
};
|
|
313
313
|
};
|
|
314
|
-
async function
|
|
315
|
-
const
|
|
316
|
-
let
|
|
317
|
-
for (; !(
|
|
318
|
-
t(
|
|
314
|
+
async function oe(e, t) {
|
|
315
|
+
const r = e.getReader();
|
|
316
|
+
let n;
|
|
317
|
+
for (; !(n = await r.read()).done; )
|
|
318
|
+
t(n.value);
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
let t,
|
|
320
|
+
function ie(e) {
|
|
321
|
+
let t, r, n, o = !1;
|
|
322
322
|
return function(s) {
|
|
323
|
-
t === void 0 ? (t = s,
|
|
323
|
+
t === void 0 ? (t = s, r = 0, n = -1) : t = ce(t, s);
|
|
324
324
|
const l = t.length;
|
|
325
325
|
let d = 0;
|
|
326
|
-
for (;
|
|
327
|
-
|
|
328
|
-
let
|
|
329
|
-
for (;
|
|
330
|
-
switch (t[
|
|
326
|
+
for (; r < l; ) {
|
|
327
|
+
o && (t[r] === 10 && (d = ++r), o = !1);
|
|
328
|
+
let a = -1;
|
|
329
|
+
for (; r < l && a === -1; ++r)
|
|
330
|
+
switch (t[r]) {
|
|
331
331
|
case 58:
|
|
332
|
-
|
|
332
|
+
n === -1 && (n = r - d);
|
|
333
333
|
break;
|
|
334
334
|
case 13:
|
|
335
|
-
|
|
335
|
+
o = !0;
|
|
336
336
|
case 10:
|
|
337
|
-
|
|
337
|
+
a = r;
|
|
338
338
|
break;
|
|
339
339
|
}
|
|
340
|
-
if (
|
|
340
|
+
if (a === -1)
|
|
341
341
|
break;
|
|
342
|
-
e(t.subarray(d,
|
|
342
|
+
e(t.subarray(d, a), n), d = r, n = -1;
|
|
343
343
|
}
|
|
344
|
-
d === l ? t = void 0 : d !== 0 && (t = t.subarray(d),
|
|
344
|
+
d === l ? t = void 0 : d !== 0 && (t = t.subarray(d), r -= d);
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
let
|
|
349
|
-
const
|
|
347
|
+
function se(e, t, r) {
|
|
348
|
+
let n = O();
|
|
349
|
+
const o = new TextDecoder();
|
|
350
350
|
return function(s, l) {
|
|
351
351
|
if (s.length === 0)
|
|
352
|
-
|
|
352
|
+
r == null || r(n), n = O();
|
|
353
353
|
else if (l > 0) {
|
|
354
|
-
const d =
|
|
354
|
+
const d = o.decode(s.subarray(0, l)), a = l + (s[l + 1] === 32 ? 2 : 1), i = o.decode(s.subarray(a));
|
|
355
355
|
switch (d) {
|
|
356
356
|
case "data":
|
|
357
|
-
|
|
357
|
+
n.data = n.data ? n.data + `
|
|
358
358
|
` + i : i;
|
|
359
359
|
break;
|
|
360
360
|
case "event":
|
|
361
|
-
|
|
361
|
+
n.event = i;
|
|
362
362
|
break;
|
|
363
363
|
case "id":
|
|
364
|
-
e(
|
|
364
|
+
e(n.id = i);
|
|
365
365
|
break;
|
|
366
366
|
case "retry":
|
|
367
|
-
const
|
|
368
|
-
isNaN(
|
|
367
|
+
const g = parseInt(i, 10);
|
|
368
|
+
isNaN(g) || t(n.retry = g);
|
|
369
369
|
break;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
|
-
function
|
|
375
|
-
const
|
|
376
|
-
return
|
|
374
|
+
function ce(e, t) {
|
|
375
|
+
const r = new Uint8Array(e.length + t.length);
|
|
376
|
+
return r.set(e), r.set(t, e.length), r;
|
|
377
377
|
}
|
|
378
378
|
function O() {
|
|
379
379
|
return {
|
|
@@ -383,106 +383,106 @@ function O() {
|
|
|
383
383
|
retry: void 0
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
|
-
var
|
|
387
|
-
var
|
|
388
|
-
for (var
|
|
386
|
+
var le = function(e, t) {
|
|
387
|
+
var r = {};
|
|
388
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
389
389
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
390
|
-
for (var
|
|
391
|
-
t.indexOf(
|
|
392
|
-
return
|
|
390
|
+
for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
|
|
391
|
+
t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
|
|
392
|
+
return r;
|
|
393
393
|
};
|
|
394
|
-
const F = "text/event-stream",
|
|
394
|
+
const F = "text/event-stream", de = 1e3, D = "last-event-id";
|
|
395
395
|
function j(e, t) {
|
|
396
|
-
var { signal:
|
|
397
|
-
return new Promise((
|
|
398
|
-
const S = Object.assign({},
|
|
396
|
+
var { signal: r, headers: n, onopen: o, onmessage: m, onclose: s, onerror: l, openWhenHidden: d, fetch: a } = t, i = le(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
397
|
+
return new Promise((g, u) => {
|
|
398
|
+
const S = Object.assign({}, n);
|
|
399
399
|
S.accept || (S.accept = F);
|
|
400
400
|
let y;
|
|
401
401
|
function T() {
|
|
402
|
-
y.abort(), document.hidden ||
|
|
402
|
+
y.abort(), document.hidden || p();
|
|
403
403
|
}
|
|
404
404
|
d || document.addEventListener("visibilitychange", T);
|
|
405
|
-
let f =
|
|
405
|
+
let f = de, h = 0;
|
|
406
406
|
function b() {
|
|
407
407
|
document.removeEventListener("visibilitychange", T), window.clearTimeout(h), y.abort();
|
|
408
408
|
}
|
|
409
|
-
|
|
410
|
-
b(),
|
|
409
|
+
r == null || r.addEventListener("abort", () => {
|
|
410
|
+
b(), g();
|
|
411
411
|
});
|
|
412
|
-
const I =
|
|
413
|
-
async function
|
|
412
|
+
const I = a ?? window.fetch, w = o ?? ue;
|
|
413
|
+
async function p() {
|
|
414
414
|
var M;
|
|
415
415
|
y = new AbortController();
|
|
416
416
|
try {
|
|
417
417
|
const P = await I(e, Object.assign(Object.assign({}, i), { headers: S, signal: y.signal }));
|
|
418
|
-
await w(P), await
|
|
419
|
-
|
|
420
|
-
}, (
|
|
421
|
-
f =
|
|
422
|
-
},
|
|
418
|
+
await w(P), await oe(P.body, ie(se((k) => {
|
|
419
|
+
k ? S[D] = k : delete S[D];
|
|
420
|
+
}, (k) => {
|
|
421
|
+
f = k;
|
|
422
|
+
}, m))), s == null || s(), b(), g();
|
|
423
423
|
} catch (P) {
|
|
424
424
|
if (!y.signal.aborted)
|
|
425
425
|
try {
|
|
426
|
-
const
|
|
427
|
-
window.clearTimeout(h), h = window.setTimeout(
|
|
428
|
-
} catch (
|
|
429
|
-
b(), u(
|
|
426
|
+
const k = (M = l == null ? void 0 : l(P)) !== null && M !== void 0 ? M : f;
|
|
427
|
+
window.clearTimeout(h), h = window.setTimeout(p, k);
|
|
428
|
+
} catch (k) {
|
|
429
|
+
b(), u(k);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
p();
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function ue(e) {
|
|
437
437
|
const t = e.headers.get("content-type");
|
|
438
438
|
if (!(t != null && t.startsWith(F)))
|
|
439
439
|
throw new Error(`Expected content-type to be ${F}, Actual: ${t}`);
|
|
440
440
|
}
|
|
441
|
-
function
|
|
442
|
-
const [t,
|
|
441
|
+
function De(e) {
|
|
442
|
+
const [t, r] = C(null);
|
|
443
443
|
return E(() => {
|
|
444
444
|
if (!t)
|
|
445
445
|
return;
|
|
446
|
-
const
|
|
446
|
+
const n = new AbortController();
|
|
447
447
|
return j(t, {
|
|
448
448
|
headers: e == null ? void 0 : e.headers,
|
|
449
|
-
signal:
|
|
450
|
-
async onopen(
|
|
451
|
-
if (!
|
|
452
|
-
throw new Error(`Client error ${
|
|
449
|
+
signal: n.signal,
|
|
450
|
+
async onopen(o) {
|
|
451
|
+
if (!o.ok && o.status >= 400 && o.status < 500 && o.status !== 429)
|
|
452
|
+
throw new Error(`Client error ${o.status}`);
|
|
453
453
|
},
|
|
454
|
-
onmessage(
|
|
455
|
-
|
|
454
|
+
onmessage(o) {
|
|
455
|
+
o.data && (e == null || e.onMessage({
|
|
456
456
|
url: t,
|
|
457
|
-
data: H(
|
|
457
|
+
data: H(o.data)
|
|
458
458
|
}));
|
|
459
459
|
},
|
|
460
|
-
onerror(
|
|
461
|
-
throw console.error("EventSource error:",
|
|
460
|
+
onerror(o) {
|
|
461
|
+
throw console.error("EventSource error:", o), e == null || e.onError(t), r(null), o;
|
|
462
462
|
},
|
|
463
463
|
onclose() {
|
|
464
464
|
}
|
|
465
465
|
}), () => {
|
|
466
|
-
|
|
466
|
+
n.abort();
|
|
467
467
|
};
|
|
468
468
|
}, [t, e == null ? void 0 : e.headers]), {
|
|
469
|
-
setSourceUrl:
|
|
469
|
+
setSourceUrl: r,
|
|
470
470
|
sourceUrl: t
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
473
|
function H(e) {
|
|
474
|
-
const t = atob(e),
|
|
475
|
-
for (let
|
|
476
|
-
n
|
|
477
|
-
return new TextDecoder("utf-8").decode(
|
|
474
|
+
const t = atob(e), r = new Uint8Array(t.length);
|
|
475
|
+
for (let n = 0; n < t.length; n++)
|
|
476
|
+
r[n] = t.charCodeAt(n);
|
|
477
|
+
return new TextDecoder("utf-8").decode(r);
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
const [
|
|
479
|
+
function Ue(e, t) {
|
|
480
|
+
const [r, n] = C(
|
|
481
481
|
null
|
|
482
|
-
), [
|
|
482
|
+
), [o, m] = C(
|
|
483
483
|
null
|
|
484
|
-
), s = N(), l = async (
|
|
485
|
-
const u = await
|
|
484
|
+
), s = N(), l = async (g) => {
|
|
485
|
+
const u = await g.fetchTokens(), { fetchTokens: S, nextPageToken: y, previousPageToken: T, ...f } = g, h = await e({
|
|
486
486
|
pk: s.fency.publishableKey,
|
|
487
487
|
clientToken: u.clientToken,
|
|
488
488
|
streamToken: u.streamToken,
|
|
@@ -513,16 +513,16 @@ function $e(e, t) {
|
|
|
513
513
|
};
|
|
514
514
|
};
|
|
515
515
|
return {
|
|
516
|
-
fetchFirstPage: async (
|
|
516
|
+
fetchFirstPage: async (g) => {
|
|
517
517
|
const u = await l({
|
|
518
|
-
...
|
|
518
|
+
...g,
|
|
519
519
|
nextPageToken: void 0,
|
|
520
520
|
previousPageToken: void 0
|
|
521
521
|
});
|
|
522
|
-
return u.type === "success" && (
|
|
522
|
+
return u.type === "success" && (m(u.page), n(g)), u;
|
|
523
523
|
},
|
|
524
|
-
fetchNextPage: async (
|
|
525
|
-
if (
|
|
524
|
+
fetchNextPage: async (g) => {
|
|
525
|
+
if (o == null)
|
|
526
526
|
return {
|
|
527
527
|
type: "error",
|
|
528
528
|
error: {
|
|
@@ -530,7 +530,7 @@ function $e(e, t) {
|
|
|
530
530
|
message: "No current page"
|
|
531
531
|
}
|
|
532
532
|
};
|
|
533
|
-
if (
|
|
533
|
+
if (o.pagination.nextPageToken == null)
|
|
534
534
|
return {
|
|
535
535
|
type: "error",
|
|
536
536
|
error: {
|
|
@@ -539,14 +539,14 @@ function $e(e, t) {
|
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
541
|
const u = await l({
|
|
542
|
-
...
|
|
543
|
-
nextPageToken:
|
|
542
|
+
...g,
|
|
543
|
+
nextPageToken: o.pagination.nextPageToken,
|
|
544
544
|
previousPageToken: void 0
|
|
545
545
|
});
|
|
546
|
-
return u.type === "success" && (
|
|
546
|
+
return u.type === "success" && (m(u.page), n(g)), u;
|
|
547
547
|
},
|
|
548
|
-
fetchPreviousPage: async (
|
|
549
|
-
if (
|
|
548
|
+
fetchPreviousPage: async (g) => {
|
|
549
|
+
if (o == null)
|
|
550
550
|
return {
|
|
551
551
|
type: "error",
|
|
552
552
|
error: {
|
|
@@ -554,7 +554,7 @@ function $e(e, t) {
|
|
|
554
554
|
message: "No current page"
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
|
-
if (
|
|
557
|
+
if (o.pagination.previousPageToken == null)
|
|
558
558
|
return {
|
|
559
559
|
type: "error",
|
|
560
560
|
error: {
|
|
@@ -563,59 +563,59 @@ function $e(e, t) {
|
|
|
563
563
|
}
|
|
564
564
|
};
|
|
565
565
|
const u = await l({
|
|
566
|
-
...
|
|
566
|
+
...g,
|
|
567
567
|
nextPageToken: void 0,
|
|
568
|
-
previousPageToken:
|
|
568
|
+
previousPageToken: o.pagination.previousPageToken
|
|
569
569
|
});
|
|
570
|
-
return u.type === "success" && (
|
|
570
|
+
return u.type === "success" && (m(u.page), n(g)), u;
|
|
571
571
|
},
|
|
572
|
-
refetchCurrentPage: async () =>
|
|
572
|
+
refetchCurrentPage: async () => r == null ? {
|
|
573
573
|
type: "error",
|
|
574
574
|
error: {
|
|
575
575
|
code: "NO_CURRENT_PAGE",
|
|
576
576
|
message: "No current page, please call fetchFirstPage first."
|
|
577
577
|
}
|
|
578
|
-
} : l(
|
|
579
|
-
currentPage:
|
|
578
|
+
} : l(r),
|
|
579
|
+
currentPage: o
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
|
-
function
|
|
583
|
-
return e.progressItems.map((t,
|
|
584
|
-
const
|
|
585
|
-
let
|
|
586
|
-
if (
|
|
587
|
-
const s = new Date(t.createdAt).getTime(), l = new Date(
|
|
588
|
-
|
|
582
|
+
function me(e) {
|
|
583
|
+
return e.progressItems.map((t, r) => {
|
|
584
|
+
const n = e.progressItems[r + 1], o = n != null;
|
|
585
|
+
let m;
|
|
586
|
+
if (n != null && n.createdAt) {
|
|
587
|
+
const s = new Date(t.createdAt).getTime(), l = new Date(n.createdAt).getTime();
|
|
588
|
+
m = Math.round((l - s) / 1e3);
|
|
589
589
|
}
|
|
590
590
|
return {
|
|
591
591
|
item: t,
|
|
592
|
-
completed:
|
|
593
|
-
isLatest:
|
|
594
|
-
durationSeconds:
|
|
592
|
+
completed: o,
|
|
593
|
+
isLatest: r === e.progressItems.length - 1,
|
|
594
|
+
durationSeconds: m
|
|
595
595
|
};
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
function R({
|
|
599
599
|
text: e,
|
|
600
600
|
duration: t = 2,
|
|
601
|
-
delay:
|
|
602
|
-
repeat:
|
|
603
|
-
repeatDelay:
|
|
604
|
-
className:
|
|
601
|
+
delay: r = 0,
|
|
602
|
+
repeat: n = !0,
|
|
603
|
+
repeatDelay: o = 0.5,
|
|
604
|
+
className: m,
|
|
605
605
|
startOnView: s = !1,
|
|
606
606
|
once: l = !1,
|
|
607
607
|
inViewMargin: d,
|
|
608
|
-
spread:
|
|
608
|
+
spread: a = 2,
|
|
609
609
|
color: i = "#999",
|
|
610
|
-
shimmerColor:
|
|
610
|
+
shimmerColor: g = "#000",
|
|
611
611
|
direction: u = "fromBottom"
|
|
612
612
|
}) {
|
|
613
|
-
const S =
|
|
613
|
+
const S = A(null), y = X(S, { once: l, margin: d }), T = B(() => e.length * a, [e, a]), f = !s || y, h = u === "fromBottom" ? "100% center" : "-100% center", b = u === "fromBottom" ? "0% center" : "200% center";
|
|
614
614
|
return /* @__PURE__ */ c(
|
|
615
615
|
v.span,
|
|
616
616
|
{
|
|
617
617
|
ref: S,
|
|
618
|
-
className:
|
|
618
|
+
className: m,
|
|
619
619
|
style: {
|
|
620
620
|
position: "relative",
|
|
621
621
|
display: "inline-block",
|
|
@@ -627,7 +627,7 @@ function R({
|
|
|
627
627
|
backgroundRepeat: "no-repeat, padding-box",
|
|
628
628
|
"--spread": `${T}px`,
|
|
629
629
|
"--base-color": i,
|
|
630
|
-
"--shimmer-color":
|
|
630
|
+
"--shimmer-color": g,
|
|
631
631
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
632
632
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
633
633
|
},
|
|
@@ -641,22 +641,22 @@ function R({
|
|
|
641
641
|
} : {},
|
|
642
642
|
transition: {
|
|
643
643
|
backgroundPosition: {
|
|
644
|
-
repeat:
|
|
644
|
+
repeat: n ? 1 / 0 : 0,
|
|
645
645
|
duration: t,
|
|
646
|
-
delay:
|
|
647
|
-
repeatDelay:
|
|
646
|
+
delay: r,
|
|
647
|
+
repeatDelay: o,
|
|
648
648
|
ease: "linear"
|
|
649
649
|
},
|
|
650
650
|
opacity: {
|
|
651
651
|
duration: 0.3,
|
|
652
|
-
delay:
|
|
652
|
+
delay: r
|
|
653
653
|
}
|
|
654
654
|
},
|
|
655
655
|
children: e
|
|
656
656
|
}
|
|
657
657
|
);
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function ge(e) {
|
|
660
660
|
const t = e.item.data;
|
|
661
661
|
if (t.taskType === "StreamingChatCompletion") {
|
|
662
662
|
if (t.eventType === "Text") return "Streaming...";
|
|
@@ -687,11 +687,11 @@ function ye(e) {
|
|
|
687
687
|
}
|
|
688
688
|
return "Processing...";
|
|
689
689
|
}
|
|
690
|
-
const
|
|
690
|
+
const ye = ({ progressViewItems: e }) => {
|
|
691
691
|
const t = e[e.length - 1];
|
|
692
692
|
if (!t) return null;
|
|
693
|
-
const
|
|
694
|
-
return /* @__PURE__ */ c("div", { className: "simple-mode-container", children: /* @__PURE__ */ c(
|
|
693
|
+
const r = ge(t);
|
|
694
|
+
return /* @__PURE__ */ c("div", { className: "simple-mode-container", children: /* @__PURE__ */ c(L, { mode: "wait", children: /* @__PURE__ */ c(
|
|
695
695
|
v.div,
|
|
696
696
|
{
|
|
697
697
|
initial: { opacity: 0, y: 10 },
|
|
@@ -703,12 +703,12 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
703
703
|
{
|
|
704
704
|
className: "simple-mode-title",
|
|
705
705
|
style: { color: "#666" },
|
|
706
|
-
children:
|
|
706
|
+
children: r
|
|
707
707
|
}
|
|
708
708
|
) : /* @__PURE__ */ c(
|
|
709
709
|
R,
|
|
710
710
|
{
|
|
711
|
-
text:
|
|
711
|
+
text: r,
|
|
712
712
|
className: "simple-mode-title",
|
|
713
713
|
duration: 2.5,
|
|
714
714
|
repeat: !0,
|
|
@@ -880,29 +880,29 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
880
880
|
animate: { opacity: 1, y: 0 },
|
|
881
881
|
transition: { duration: 0.3, delay: 0 },
|
|
882
882
|
children: /* @__PURE__ */ c(
|
|
883
|
-
|
|
883
|
+
Q,
|
|
884
884
|
{
|
|
885
|
-
remarkPlugins: [
|
|
885
|
+
remarkPlugins: [Y],
|
|
886
886
|
components: {
|
|
887
887
|
code(t) {
|
|
888
|
-
const { children:
|
|
888
|
+
const { children: r, className: n, node: o, ref: m, ...s } = t, l = /language-(\w+)/.exec(n || "");
|
|
889
889
|
return l ? /* @__PURE__ */ c(
|
|
890
|
-
|
|
890
|
+
$,
|
|
891
891
|
{
|
|
892
892
|
...s,
|
|
893
893
|
PreTag: "div",
|
|
894
|
-
children: String(
|
|
894
|
+
children: String(r).replace(/\n$/, ""),
|
|
895
895
|
language: l[1],
|
|
896
896
|
style: K
|
|
897
897
|
}
|
|
898
|
-
) : /* @__PURE__ */ c("code", { ...s, className:
|
|
898
|
+
) : /* @__PURE__ */ c("code", { ...s, className: n, children: String(r) });
|
|
899
899
|
}
|
|
900
900
|
},
|
|
901
901
|
children: e
|
|
902
902
|
}
|
|
903
903
|
)
|
|
904
904
|
}
|
|
905
|
-
) }),
|
|
905
|
+
) }), fe = ({ data: e }) => {
|
|
906
906
|
const t = JSON.stringify(e.json, null, 2);
|
|
907
907
|
return /* @__PURE__ */ c("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ c(
|
|
908
908
|
v.div,
|
|
@@ -910,11 +910,11 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
910
910
|
initial: { opacity: 0, y: -10 },
|
|
911
911
|
animate: { opacity: 1, y: 0 },
|
|
912
912
|
transition: { duration: 0.3, delay: 0 },
|
|
913
|
-
children: /* @__PURE__ */ c(
|
|
913
|
+
children: /* @__PURE__ */ c($, { language: "json", style: K, PreTag: "div", children: t })
|
|
914
914
|
}
|
|
915
915
|
) });
|
|
916
|
-
},
|
|
917
|
-
const
|
|
916
|
+
}, he = ({ data: e, isLatest: t = !1, durationSeconds: r }) => {
|
|
917
|
+
const n = `Searching: ${e.queryDescription}`;
|
|
918
918
|
return /* @__PURE__ */ x("div", { style: { padding: "16px" }, children: [
|
|
919
919
|
/* @__PURE__ */ c(
|
|
920
920
|
v.div,
|
|
@@ -928,19 +928,19 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
928
928
|
initial: { opacity: 0, y: -10 },
|
|
929
929
|
animate: { opacity: 1, y: 0 },
|
|
930
930
|
transition: { duration: 0.3, delay: 0 },
|
|
931
|
-
children: t && !
|
|
931
|
+
children: t && !r ? /* @__PURE__ */ c(
|
|
932
932
|
R,
|
|
933
933
|
{
|
|
934
|
-
text:
|
|
934
|
+
text: n,
|
|
935
935
|
duration: 2.5,
|
|
936
936
|
repeat: !0,
|
|
937
937
|
color: "#999",
|
|
938
938
|
shimmerColor: "#000"
|
|
939
939
|
}
|
|
940
|
-
) : /* @__PURE__ */ c("span", { style: { color: "#666" }, children:
|
|
940
|
+
) : /* @__PURE__ */ c("span", { style: { color: "#666" }, children: n })
|
|
941
941
|
}
|
|
942
942
|
),
|
|
943
|
-
|
|
943
|
+
r !== void 0 && /* @__PURE__ */ x(
|
|
944
944
|
"div",
|
|
945
945
|
{
|
|
946
946
|
style: {
|
|
@@ -951,14 +951,14 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
951
951
|
},
|
|
952
952
|
children: [
|
|
953
953
|
"Took ",
|
|
954
|
-
|
|
954
|
+
r,
|
|
955
955
|
" seconds"
|
|
956
956
|
]
|
|
957
957
|
}
|
|
958
958
|
)
|
|
959
959
|
] });
|
|
960
|
-
},
|
|
961
|
-
const
|
|
960
|
+
}, Se = ({ isLatest: e = !1, durationSeconds: t }) => {
|
|
961
|
+
const r = "Adding sources...";
|
|
962
962
|
return /* @__PURE__ */ x("div", { style: { padding: "16px" }, children: [
|
|
963
963
|
/* @__PURE__ */ c(
|
|
964
964
|
v.div,
|
|
@@ -975,13 +975,13 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
975
975
|
children: e && !t ? /* @__PURE__ */ c(
|
|
976
976
|
R,
|
|
977
977
|
{
|
|
978
|
-
text:
|
|
978
|
+
text: r,
|
|
979
979
|
duration: 2.5,
|
|
980
980
|
repeat: !0,
|
|
981
981
|
color: "#999",
|
|
982
982
|
shimmerColor: "#000"
|
|
983
983
|
}
|
|
984
|
-
) : /* @__PURE__ */ c("span", { style: { color: "#666" }, children:
|
|
984
|
+
) : /* @__PURE__ */ c("span", { style: { color: "#666" }, children: r })
|
|
985
985
|
}
|
|
986
986
|
),
|
|
987
987
|
t !== void 0 && /* @__PURE__ */ x(
|
|
@@ -1001,118 +1001,120 @@ const fe = ({ progressViewItems: e }) => {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
)
|
|
1003
1003
|
] });
|
|
1004
|
-
},
|
|
1004
|
+
}, Te = ({ data: e, onSourceClick: t }) => /* @__PURE__ */ x("div", { style: { padding: "16px" }, children: [
|
|
1005
1005
|
/* @__PURE__ */ c(
|
|
1006
1006
|
v.div,
|
|
1007
1007
|
{
|
|
1008
|
-
style: {
|
|
1008
|
+
style: {
|
|
1009
|
+
marginBottom: "10px",
|
|
1010
|
+
fontSize: "11px",
|
|
1011
|
+
fontWeight: 500,
|
|
1012
|
+
letterSpacing: "0.05em",
|
|
1013
|
+
textTransform: "uppercase",
|
|
1014
|
+
color: "#999"
|
|
1015
|
+
},
|
|
1009
1016
|
initial: { opacity: 0, y: -10 },
|
|
1010
1017
|
animate: { opacity: 1, y: 0 },
|
|
1011
1018
|
transition: { duration: 0.3, delay: 0 },
|
|
1012
1019
|
children: "Sources"
|
|
1013
1020
|
}
|
|
1014
1021
|
),
|
|
1015
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ c("span", { style: { fontSize: "13px", color: "#888" }, children: "No sources" }) : e.sources.map((
|
|
1022
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ c("span", { style: { fontSize: "13px", color: "#888" }, children: "No sources" }) : e.sources.map((r, n) => /* @__PURE__ */ c(
|
|
1016
1023
|
Ce,
|
|
1017
1024
|
{
|
|
1018
|
-
source:
|
|
1019
|
-
index:
|
|
1025
|
+
source: r,
|
|
1026
|
+
index: n,
|
|
1020
1027
|
onSourceClick: t
|
|
1021
1028
|
},
|
|
1022
|
-
|
|
1029
|
+
r.memoryId
|
|
1023
1030
|
)) })
|
|
1024
1031
|
] });
|
|
1025
|
-
function
|
|
1026
|
-
if (
|
|
1027
|
-
if (
|
|
1028
|
-
if (
|
|
1029
|
-
return
|
|
1030
|
-
const
|
|
1031
|
-
return
|
|
1032
|
+
function be(e) {
|
|
1033
|
+
if (e.length === 0) return "";
|
|
1034
|
+
if (e.length === 1) return `page ${e[0]}`;
|
|
1035
|
+
if (e.length === 2)
|
|
1036
|
+
return `pages ${e[0]} and ${e[1]}`;
|
|
1037
|
+
const t = e[e.length - 1];
|
|
1038
|
+
return `pages ${e.slice(0, -1).join(", ")} and ${t}`;
|
|
1032
1039
|
}
|
|
1033
|
-
const Ce = ({ source: e, index: t, onSourceClick:
|
|
1034
|
-
const [
|
|
1035
|
-
return /* @__PURE__ */
|
|
1040
|
+
const Ce = ({ source: e, index: t, onSourceClick: r }) => {
|
|
1041
|
+
const [n, o] = C(!1), m = !!r, s = e.pageNumbers ?? [], l = be(s);
|
|
1042
|
+
return /* @__PURE__ */ x(
|
|
1036
1043
|
v.div,
|
|
1037
1044
|
{
|
|
1038
1045
|
initial: { opacity: 0, scale: 0.9 },
|
|
1039
1046
|
animate: { opacity: 1, scale: 1 },
|
|
1040
1047
|
transition: { duration: 0.25, delay: t * 0.05 },
|
|
1041
|
-
onClick:
|
|
1042
|
-
onMouseEnter:
|
|
1043
|
-
onMouseLeave:
|
|
1048
|
+
onClick: m ? () => r(e.memoryId) : void 0,
|
|
1049
|
+
onMouseEnter: m ? () => o(!0) : void 0,
|
|
1050
|
+
onMouseLeave: m ? () => o(!1) : void 0,
|
|
1044
1051
|
style: {
|
|
1045
1052
|
display: "inline-flex",
|
|
1046
1053
|
flexDirection: "column",
|
|
1047
1054
|
gap: "4px",
|
|
1048
1055
|
padding: "8px 12px",
|
|
1049
|
-
borderRadius: "
|
|
1056
|
+
borderRadius: "6px",
|
|
1050
1057
|
border: "1px solid #e0e0e0",
|
|
1051
|
-
backgroundColor:
|
|
1052
|
-
cursor:
|
|
1058
|
+
backgroundColor: n ? "#f5f5f5" : "transparent",
|
|
1059
|
+
cursor: m ? "pointer" : "default",
|
|
1053
1060
|
transition: "background-color 0.15s ease",
|
|
1054
1061
|
userSelect: "none"
|
|
1055
1062
|
},
|
|
1056
|
-
children:
|
|
1063
|
+
children: [
|
|
1064
|
+
/* @__PURE__ */ c("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1065
|
+
l && /* @__PURE__ */ c("span", { style: { fontSize: "12px", color: "#666" }, children: l })
|
|
1066
|
+
]
|
|
1057
1067
|
}
|
|
1058
1068
|
);
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1069
|
+
};
|
|
1070
|
+
function ke({
|
|
1071
|
+
eventType: e,
|
|
1072
|
+
completed: t
|
|
1073
|
+
}) {
|
|
1074
|
+
return e === "ExploreMemoryError" ? /* @__PURE__ */ c("span", { style: { color: "#c62828", fontSize: 14, fontWeight: 600 }, children: "✗" }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ c("span", { style: { color: "#999", fontSize: 14, fontWeight: 600 }, children: "✓" }) : e === "ExploreMemoryStart" && t ? /* @__PURE__ */ c("span", { style: { color: "#999", fontSize: 14, fontWeight: 600 }, children: "✓" }) : null;
|
|
1062
1075
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
/* @__PURE__ */ c(
|
|
1076
|
+
const z = 80, ve = ({ data: e, completed: t, isLatest: r = !1 }) => {
|
|
1077
|
+
const [n, o] = C(!1), m = e.eventType === "ExploreMemoryResult" ? e.result : void 0, s = m != null && m.length > z, l = m != null ? n || !s ? m : `${m.slice(0, z)}...` : void 0, d = s;
|
|
1078
|
+
if (e.eventType === "ExploreMemoryStart" && !t) {
|
|
1079
|
+
const i = `Exploring ${e.memoryTitle}...`;
|
|
1080
|
+
return /* @__PURE__ */ c(
|
|
1068
1081
|
"div",
|
|
1069
1082
|
{
|
|
1070
1083
|
style: {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1084
|
+
padding: "16px",
|
|
1085
|
+
display: "flex",
|
|
1086
|
+
alignItems: "center"
|
|
1087
|
+
},
|
|
1088
|
+
children: r ? /* @__PURE__ */ c(
|
|
1089
|
+
R,
|
|
1090
|
+
{
|
|
1091
|
+
text: i,
|
|
1092
|
+
duration: 2.5,
|
|
1093
|
+
repeat: !0,
|
|
1094
|
+
color: "#999",
|
|
1095
|
+
shimmerColor: "#000"
|
|
1096
|
+
}
|
|
1097
|
+
) : /* @__PURE__ */ c("span", { style: { fontSize: 13, color: "#999" }, children: i })
|
|
1078
1098
|
}
|
|
1079
|
-
)
|
|
1080
|
-
|
|
1081
|
-
}
|
|
1082
|
-
function we({
|
|
1083
|
-
eventType: e,
|
|
1084
|
-
completed: t
|
|
1085
|
-
}) {
|
|
1086
|
-
return e === "ExploreMemoryError" ? /* @__PURE__ */ c("span", { style: { color: "#c62828", fontSize: 14, fontWeight: 600 }, children: "✗" }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ c("span", { style: { color: "#2e7d32", fontSize: 14, fontWeight: 600 }, children: "✓" }) : e === "ExploreMemoryStart" ? t ? /* @__PURE__ */ c("span", { style: { color: "#2e7d32", fontSize: 14, fontWeight: 600 }, children: "✓" }) : /* @__PURE__ */ c(xe, {}) : null;
|
|
1087
|
-
}
|
|
1088
|
-
const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
1089
|
-
const [n, r] = k(!1), a = e.eventType === "ExploreMemoryResult" ? e.result : void 0, g = a != null && a.length > z, s = a != null ? n || !g ? a : `${a.slice(0, z)}...` : void 0, l = g;
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1090
1101
|
return /* @__PURE__ */ c("div", { style: { padding: "16px" }, children: /* @__PURE__ */ x(
|
|
1091
1102
|
v.div,
|
|
1092
1103
|
{
|
|
1093
|
-
initial: { opacity: 0
|
|
1094
|
-
animate: { opacity: 1
|
|
1095
|
-
transition: { duration: 0.25
|
|
1096
|
-
onClick:
|
|
1104
|
+
initial: { opacity: 0 },
|
|
1105
|
+
animate: { opacity: 1 },
|
|
1106
|
+
transition: { duration: 0.25 },
|
|
1107
|
+
onClick: d ? () => o((i) => !i) : void 0,
|
|
1097
1108
|
style: {
|
|
1098
|
-
|
|
1109
|
+
paddingBottom: "12px",
|
|
1110
|
+
borderBottom: "1px solid #eee",
|
|
1111
|
+
display: "flex",
|
|
1099
1112
|
flexDirection: "row",
|
|
1100
1113
|
alignItems: "flex-start",
|
|
1101
1114
|
gap: "10px",
|
|
1102
|
-
padding: "8px 12px",
|
|
1103
|
-
borderRadius: "8px",
|
|
1104
|
-
border: "1px solid #e0e0e0",
|
|
1105
|
-
backgroundColor: "#f9f9f9",
|
|
1106
1115
|
minWidth: 0,
|
|
1107
|
-
cursor:
|
|
1108
|
-
transition: "background-color 0.15s ease"
|
|
1116
|
+
cursor: d ? "pointer" : "default"
|
|
1109
1117
|
},
|
|
1110
|
-
onMouseEnter: l ? (d) => {
|
|
1111
|
-
d.currentTarget.style.backgroundColor = "#f0f0f0";
|
|
1112
|
-
} : void 0,
|
|
1113
|
-
onMouseLeave: l ? (d) => {
|
|
1114
|
-
d.currentTarget.style.backgroundColor = "#f9f9f9";
|
|
1115
|
-
} : void 0,
|
|
1116
1118
|
children: [
|
|
1117
1119
|
/* @__PURE__ */ c(
|
|
1118
1120
|
"div",
|
|
@@ -1124,7 +1126,7 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1124
1126
|
flexShrink: 0,
|
|
1125
1127
|
width: 20
|
|
1126
1128
|
},
|
|
1127
|
-
children: /* @__PURE__ */ c(
|
|
1129
|
+
children: /* @__PURE__ */ c(ke, { eventType: e.eventType, completed: t })
|
|
1128
1130
|
}
|
|
1129
1131
|
),
|
|
1130
1132
|
/* @__PURE__ */ x(
|
|
@@ -1138,7 +1140,7 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1138
1140
|
},
|
|
1139
1141
|
children: [
|
|
1140
1142
|
/* @__PURE__ */ c("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1141
|
-
|
|
1143
|
+
l != null && /* @__PURE__ */ c(
|
|
1142
1144
|
"span",
|
|
1143
1145
|
{
|
|
1144
1146
|
style: {
|
|
@@ -1147,10 +1149,10 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1147
1149
|
lineHeight: 1.4,
|
|
1148
1150
|
whiteSpace: n ? "pre-wrap" : void 0
|
|
1149
1151
|
},
|
|
1150
|
-
children:
|
|
1152
|
+
children: l
|
|
1151
1153
|
}
|
|
1152
1154
|
),
|
|
1153
|
-
|
|
1155
|
+
d && /* @__PURE__ */ c(
|
|
1154
1156
|
"span",
|
|
1155
1157
|
{
|
|
1156
1158
|
style: {
|
|
@@ -1167,30 +1169,30 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1167
1169
|
]
|
|
1168
1170
|
}
|
|
1169
1171
|
) });
|
|
1170
|
-
},
|
|
1172
|
+
}, xe = ({
|
|
1171
1173
|
progressViewItems: e,
|
|
1172
1174
|
streamToken: t,
|
|
1173
|
-
fetchClientToken:
|
|
1174
|
-
loadingText:
|
|
1175
|
-
onSourceClick:
|
|
1175
|
+
fetchClientToken: r,
|
|
1176
|
+
loadingText: n,
|
|
1177
|
+
onSourceClick: o
|
|
1176
1178
|
}) => {
|
|
1177
|
-
const
|
|
1179
|
+
const m = A(null);
|
|
1178
1180
|
E(() => {
|
|
1179
|
-
|
|
1181
|
+
m.current && (m.current.scrollTop = m.current.scrollHeight);
|
|
1180
1182
|
}, [e.length]);
|
|
1181
1183
|
const s = (l) => {
|
|
1182
1184
|
const d = l.item.data;
|
|
1183
1185
|
if (d.taskType === "StreamingChatCompletion" && d.eventType === "Text")
|
|
1184
1186
|
return /* @__PURE__ */ c(U, { text: d.text });
|
|
1185
1187
|
if (d.taskType === "StructuredChatCompletion" && d.eventType === "Json")
|
|
1186
|
-
return /* @__PURE__ */ c(
|
|
1188
|
+
return /* @__PURE__ */ c(fe, { data: d });
|
|
1187
1189
|
if (d.taskType === "StreamingMemoryTypeChatCompletion")
|
|
1188
1190
|
switch (d.eventType) {
|
|
1189
1191
|
case "Text":
|
|
1190
1192
|
return /* @__PURE__ */ c(U, { text: d.text });
|
|
1191
1193
|
case "Search":
|
|
1192
1194
|
return /* @__PURE__ */ c(
|
|
1193
|
-
|
|
1195
|
+
he,
|
|
1194
1196
|
{
|
|
1195
1197
|
data: d,
|
|
1196
1198
|
isLatest: l.isLatest,
|
|
@@ -1199,7 +1201,7 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1199
1201
|
);
|
|
1200
1202
|
case "FindSources":
|
|
1201
1203
|
return /* @__PURE__ */ c(
|
|
1202
|
-
|
|
1204
|
+
Se,
|
|
1203
1205
|
{
|
|
1204
1206
|
data: d,
|
|
1205
1207
|
isLatest: l.isLatest,
|
|
@@ -1208,17 +1210,17 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1208
1210
|
);
|
|
1209
1211
|
case "SourcesResult":
|
|
1210
1212
|
return /* @__PURE__ */ c(
|
|
1211
|
-
|
|
1213
|
+
Te,
|
|
1212
1214
|
{
|
|
1213
1215
|
data: d,
|
|
1214
|
-
onSourceClick:
|
|
1216
|
+
onSourceClick: o
|
|
1215
1217
|
}
|
|
1216
1218
|
);
|
|
1217
1219
|
case "ExploreMemoryStart":
|
|
1218
1220
|
case "ExploreMemoryResult":
|
|
1219
1221
|
case "ExploreMemoryError":
|
|
1220
1222
|
return /* @__PURE__ */ c(
|
|
1221
|
-
|
|
1223
|
+
ve,
|
|
1222
1224
|
{
|
|
1223
1225
|
data: d,
|
|
1224
1226
|
completed: l.completed,
|
|
@@ -1233,14 +1235,14 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1233
1235
|
return e.length === 0 ? /* @__PURE__ */ c("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ c(
|
|
1234
1236
|
R,
|
|
1235
1237
|
{
|
|
1236
|
-
text:
|
|
1238
|
+
text: n ?? "Processing your task...",
|
|
1237
1239
|
duration: 1.5,
|
|
1238
1240
|
repeat: !0,
|
|
1239
1241
|
repeatDelay: 0,
|
|
1240
1242
|
color: "#999",
|
|
1241
1243
|
shimmerColor: "#000"
|
|
1242
1244
|
}
|
|
1243
|
-
) }) : /* @__PURE__ */ c("div", { id: "agent-task-progress-verbose", ref:
|
|
1245
|
+
) }) : /* @__PURE__ */ c("div", { id: "agent-task-progress-verbose", ref: m, children: /* @__PURE__ */ c(L, { children: e.map((l, d) => /* @__PURE__ */ c(
|
|
1244
1246
|
v.div,
|
|
1245
1247
|
{
|
|
1246
1248
|
id: `agent-task-progress-item-${l.item.progressItemId}`,
|
|
@@ -1255,26 +1257,26 @@ const z = 80, Ee = ({ data: e, completed: t }) => {
|
|
|
1255
1257
|
},
|
|
1256
1258
|
l.item.progressItemId
|
|
1257
1259
|
)) }) });
|
|
1258
|
-
},
|
|
1260
|
+
}, ze = ({
|
|
1259
1261
|
agentTask: e,
|
|
1260
1262
|
mode: t = "verbose",
|
|
1261
|
-
streamToken:
|
|
1262
|
-
fetchClientToken:
|
|
1263
|
-
onSourceClick:
|
|
1263
|
+
streamToken: r,
|
|
1264
|
+
fetchClientToken: n,
|
|
1265
|
+
onSourceClick: o
|
|
1264
1266
|
}) => {
|
|
1265
|
-
const
|
|
1266
|
-
return t === "simple" ? /* @__PURE__ */ c(
|
|
1267
|
-
|
|
1267
|
+
const m = me(e);
|
|
1268
|
+
return t === "simple" ? /* @__PURE__ */ c(ye, { progressViewItems: m }) : /* @__PURE__ */ c(
|
|
1269
|
+
xe,
|
|
1268
1270
|
{
|
|
1269
|
-
progressViewItems:
|
|
1270
|
-
streamToken:
|
|
1271
|
-
fetchClientToken:
|
|
1271
|
+
progressViewItems: m,
|
|
1272
|
+
streamToken: r,
|
|
1273
|
+
fetchClientToken: n,
|
|
1272
1274
|
loadingText: e.loadingText,
|
|
1273
|
-
onSourceClick:
|
|
1275
|
+
onSourceClick: o
|
|
1274
1276
|
}
|
|
1275
1277
|
);
|
|
1276
1278
|
};
|
|
1277
|
-
class
|
|
1279
|
+
class we {
|
|
1278
1280
|
constructor(t) {
|
|
1279
1281
|
this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = t;
|
|
1280
1282
|
}
|
|
@@ -1283,25 +1285,25 @@ class Ae {
|
|
|
1283
1285
|
* Creates new connections and removes old ones.
|
|
1284
1286
|
*/
|
|
1285
1287
|
updateStreams(t) {
|
|
1286
|
-
t.forEach((
|
|
1287
|
-
const
|
|
1288
|
-
this.eventSources.has(
|
|
1288
|
+
t.forEach((n) => {
|
|
1289
|
+
const o = n.stream.id;
|
|
1290
|
+
this.eventSources.has(o) || this.connectStream(n);
|
|
1289
1291
|
});
|
|
1290
|
-
const
|
|
1291
|
-
this.eventSources.forEach((
|
|
1292
|
-
|
|
1292
|
+
const r = new Set(t.map((n) => n.stream.id));
|
|
1293
|
+
this.eventSources.forEach((n, o) => {
|
|
1294
|
+
r.has(o) || (n.abort(), this.eventSources.delete(o));
|
|
1293
1295
|
});
|
|
1294
1296
|
}
|
|
1295
1297
|
connectStream(t) {
|
|
1296
|
-
const
|
|
1297
|
-
this.eventSources.set(
|
|
1298
|
-
const
|
|
1298
|
+
const r = t.stream.id, n = new AbortController();
|
|
1299
|
+
this.eventSources.set(r, n);
|
|
1300
|
+
const o = `${this.fency.baseUrl}/sse/streams/${r}`, m = {
|
|
1299
1301
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
1300
1302
|
"X-Fency-Stream-Token": t.stream.token
|
|
1301
1303
|
};
|
|
1302
|
-
j(
|
|
1303
|
-
headers:
|
|
1304
|
-
signal:
|
|
1304
|
+
j(o, {
|
|
1305
|
+
headers: m,
|
|
1306
|
+
signal: n.signal,
|
|
1305
1307
|
async onopen(s) {
|
|
1306
1308
|
if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
|
|
1307
1309
|
throw new Error(`Client error ${s.status}`);
|
|
@@ -1309,11 +1311,11 @@ class Ae {
|
|
|
1309
1311
|
onmessage: (s) => {
|
|
1310
1312
|
if (s.data) {
|
|
1311
1313
|
const l = H(s.data);
|
|
1312
|
-
this.broadcast(l,
|
|
1314
|
+
this.broadcast(l, r);
|
|
1313
1315
|
}
|
|
1314
1316
|
},
|
|
1315
1317
|
onerror: (s) => {
|
|
1316
|
-
throw console.error("EventSource error for stream",
|
|
1318
|
+
throw console.error("EventSource error for stream", r, ":", s), this.broadcastError(r), s;
|
|
1317
1319
|
},
|
|
1318
1320
|
onclose() {
|
|
1319
1321
|
}
|
|
@@ -1323,19 +1325,19 @@ class Ae {
|
|
|
1323
1325
|
* Subscribe to events from all active streams.
|
|
1324
1326
|
* Returns an unsubscribe function.
|
|
1325
1327
|
*/
|
|
1326
|
-
subscribe(t,
|
|
1327
|
-
return this.subscribers.set(t,
|
|
1328
|
+
subscribe(t, r) {
|
|
1329
|
+
return this.subscribers.set(t, r), () => {
|
|
1328
1330
|
this.subscribers.delete(t);
|
|
1329
1331
|
};
|
|
1330
1332
|
}
|
|
1331
|
-
broadcast(t,
|
|
1332
|
-
this.subscribers.forEach((
|
|
1333
|
-
|
|
1333
|
+
broadcast(t, r) {
|
|
1334
|
+
this.subscribers.forEach((n) => {
|
|
1335
|
+
n.onMessage(t, r);
|
|
1334
1336
|
});
|
|
1335
1337
|
}
|
|
1336
1338
|
broadcastError(t) {
|
|
1337
|
-
this.subscribers.forEach((
|
|
1338
|
-
|
|
1339
|
+
this.subscribers.forEach((r) => {
|
|
1340
|
+
r.onError(t);
|
|
1339
1341
|
});
|
|
1340
1342
|
}
|
|
1341
1343
|
/**
|
|
@@ -1345,92 +1347,92 @@ class Ae {
|
|
|
1345
1347
|
this.eventSources.forEach((t) => t.abort()), this.eventSources.clear(), this.subscribers.clear();
|
|
1346
1348
|
}
|
|
1347
1349
|
}
|
|
1348
|
-
const
|
|
1350
|
+
const Ee = 12e4, Ie = (e) => {
|
|
1349
1351
|
const t = Date.now();
|
|
1350
|
-
return e.filter((
|
|
1352
|
+
return e.filter((r) => t - r.createdAt < Ee);
|
|
1351
1353
|
};
|
|
1352
|
-
function
|
|
1353
|
-
const [
|
|
1354
|
+
function We({ fency: e, fetchCreateStreamClientToken: t, children: r }) {
|
|
1355
|
+
const [n, o] = C(
|
|
1354
1356
|
null
|
|
1355
|
-
), [
|
|
1357
|
+
), [m, s] = C(!0), [l, d] = C(null), [a, i] = C([]), g = A(null), u = A(null);
|
|
1356
1358
|
E(() => {
|
|
1357
1359
|
e.then((f) => {
|
|
1358
|
-
|
|
1360
|
+
o(f), s(!1);
|
|
1359
1361
|
}).catch((f) => {
|
|
1360
1362
|
d(f), s(!1);
|
|
1361
1363
|
});
|
|
1362
1364
|
}, [e]), E(() => {
|
|
1363
|
-
|
|
1364
|
-
}, [
|
|
1365
|
-
u.current && u.current.updateStreams(
|
|
1366
|
-
}, [
|
|
1365
|
+
n && !u.current && (u.current = new we(n));
|
|
1366
|
+
}, [n]), E(() => {
|
|
1367
|
+
u.current && u.current.updateStreams(a);
|
|
1368
|
+
}, [a]), E(() => () => {
|
|
1367
1369
|
var f;
|
|
1368
1370
|
(f = u.current) == null || f.cleanup();
|
|
1369
1371
|
}, []);
|
|
1370
1372
|
const S = W(
|
|
1371
1373
|
async (f = 3e4) => {
|
|
1372
|
-
if (
|
|
1373
|
-
return
|
|
1374
|
-
const h = Date.now(), b =
|
|
1374
|
+
if (g.current)
|
|
1375
|
+
return g.current;
|
|
1376
|
+
const h = Date.now(), b = a.length > 0 ? a[a.length - 1] : null;
|
|
1375
1377
|
if (b && h - b.createdAt < f)
|
|
1376
1378
|
return b.stream;
|
|
1377
1379
|
const I = (async () => {
|
|
1378
|
-
if (!
|
|
1380
|
+
if (!n)
|
|
1379
1381
|
throw new Error("Fency instance not initialized");
|
|
1380
|
-
const w = await t(),
|
|
1381
|
-
pk:
|
|
1382
|
-
baseUrl:
|
|
1382
|
+
const w = await t(), p = await J({
|
|
1383
|
+
pk: n.publishableKey,
|
|
1384
|
+
baseUrl: n.baseUrl,
|
|
1383
1385
|
clientToken: (w == null ? void 0 : w.clientToken) ?? ""
|
|
1384
1386
|
});
|
|
1385
|
-
if (
|
|
1387
|
+
if (p.type === "success") {
|
|
1386
1388
|
const M = {
|
|
1387
|
-
stream:
|
|
1389
|
+
stream: p.stream,
|
|
1388
1390
|
createdAt: Date.now()
|
|
1389
1391
|
};
|
|
1390
1392
|
return i((P) => {
|
|
1391
|
-
const
|
|
1392
|
-
return
|
|
1393
|
-
}),
|
|
1393
|
+
const k = [...P, M];
|
|
1394
|
+
return Ie(k);
|
|
1395
|
+
}), g.current = null, p.stream;
|
|
1394
1396
|
} else
|
|
1395
|
-
throw
|
|
1397
|
+
throw g.current = null, new Error("Failed to create stream");
|
|
1396
1398
|
})();
|
|
1397
|
-
return
|
|
1399
|
+
return g.current = I, I;
|
|
1398
1400
|
},
|
|
1399
|
-
[
|
|
1401
|
+
[n, a]
|
|
1400
1402
|
);
|
|
1401
1403
|
if (l)
|
|
1402
1404
|
return /* @__PURE__ */ x("div", { children: [
|
|
1403
1405
|
"Fency error: ",
|
|
1404
1406
|
l.message
|
|
1405
1407
|
] });
|
|
1406
|
-
if (!
|
|
1408
|
+
if (!n)
|
|
1407
1409
|
return null;
|
|
1408
|
-
const y =
|
|
1409
|
-
fency:
|
|
1410
|
-
loading:
|
|
1410
|
+
const y = a.length > 0 ? a[a.length - 1] : null, T = {
|
|
1411
|
+
fency: n,
|
|
1412
|
+
loading: m,
|
|
1411
1413
|
error: l,
|
|
1412
|
-
activeStreams:
|
|
1414
|
+
activeStreams: a,
|
|
1413
1415
|
latestStream: y,
|
|
1414
1416
|
eventManager: u.current,
|
|
1415
1417
|
getOrCreateStream: S
|
|
1416
1418
|
};
|
|
1417
|
-
return /* @__PURE__ */ c(_.Provider, { value: T, children:
|
|
1419
|
+
return /* @__PURE__ */ c(_.Provider, { value: T, children: r });
|
|
1418
1420
|
}
|
|
1419
1421
|
export {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1422
|
+
ze as AgentTaskProgress,
|
|
1423
|
+
ye as AgentTaskProgressSimple,
|
|
1424
|
+
xe as AgentTaskProgressVerbose,
|
|
1425
|
+
We as FencyProvider,
|
|
1424
1426
|
R as ShimmeringText,
|
|
1425
1427
|
U as StreamingChatCompletionText,
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1428
|
+
ve as StreamingMemoryTypeChatCompletionExploreMemory,
|
|
1429
|
+
Se as StreamingMemoryTypeChatCompletionFindSources,
|
|
1430
|
+
he as StreamingMemoryTypeChatCompletionSearch,
|
|
1431
|
+
Te as StreamingMemoryTypeChatCompletionSourcesResult,
|
|
1432
|
+
fe as StructuredChatCompletionJson,
|
|
1433
|
+
Oe as useAgentTasks,
|
|
1432
1434
|
N as useFencyContext,
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1435
|
+
De as useFencyEventSource,
|
|
1436
|
+
Ue as usePaginatedQuery,
|
|
1437
|
+
ae as useStream
|
|
1436
1438
|
};
|