@glodon-aiot/agent-cli-ui 3.3.5-alpha.28 → 3.3.5-alpha.29
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/es/Dialog/AgentChat/index.mjs +104 -103
- package/dist/es/components/Recommend/index.mjs +52 -34
- package/dist/es/constant.mjs +7 -3
- package/dist/es/index.mjs +117 -109
- package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/style.css +1 -1
- package/dist/es/src/style10.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style19.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style21.css +1 -1
- package/dist/es/src/style23.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style4.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +36 -36
- package/dist/src/components/Recommend/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +3 -3
|
@@ -11,7 +11,7 @@ var Ie = (L, o, v) => o in L ? Wt(L, o, { enumerable: !0, configurable: !0, writ
|
|
|
11
11
|
return L;
|
|
12
12
|
}, st = (L, o) => Qt(L, _t(o));
|
|
13
13
|
var D = (L, o, v) => (Ie(L, typeof o != "symbol" ? o + "" : o, v), v);
|
|
14
|
-
var
|
|
14
|
+
var j = (L, o, v) => new Promise((e, w) => {
|
|
15
15
|
var ue = (x) => {
|
|
16
16
|
try {
|
|
17
17
|
H(v.next(x));
|
|
@@ -27,8 +27,8 @@ var z = (L, o, v) => new Promise((e, w) => {
|
|
|
27
27
|
}, H = (x) => x.done ? e(x.value) : Promise.resolve(x.value).then(ue, b);
|
|
28
28
|
H((v = v.apply(L, o)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as c, jsxs as
|
|
31
|
-
import { memo as Zt, useState as m, useRef as
|
|
30
|
+
import { jsx as c, jsxs as $ } from "react/jsx-runtime";
|
|
31
|
+
import { memo as Zt, useState as m, useRef as q, useContext as Jt, useEffect as F, useMemo as St } from "react";
|
|
32
32
|
/* empty css */import { Divider as en, Spin as tn, Button as _, Space as de, Upload as nn, Tooltip as on, notification as ce, message as u } from "antd";
|
|
33
33
|
import fe from "../../components/Iconfont/index.mjs";
|
|
34
34
|
import { IHistoryRole as G, ChatMessageRole as rt, PromptVariableType as ge } from "@glodon-aiot/apis";
|
|
@@ -85,7 +85,7 @@ const lt = 10, ei = (L) => {
|
|
|
85
85
|
setCurrentSession: b,
|
|
86
86
|
networkStatus: H,
|
|
87
87
|
setNetworkStatus: x
|
|
88
|
-
} = L, [h, C] = m([]), [gt, ee] = m(), [he, Ce] = m(), R =
|
|
88
|
+
} = L, [h, C] = m([]), [gt, ee] = m(), [he, Ce] = m(), R = q(null), {
|
|
89
89
|
service: P,
|
|
90
90
|
agentClient: N,
|
|
91
91
|
depId: ut,
|
|
@@ -94,13 +94,13 @@ const lt = 10, ei = (L) => {
|
|
|
94
94
|
defaultInput: me,
|
|
95
95
|
onMessage: te,
|
|
96
96
|
onHistoryLoad: Ne,
|
|
97
|
-
beforeMessageSend:
|
|
97
|
+
beforeMessageSend: z,
|
|
98
98
|
bodyStyle: mt,
|
|
99
99
|
disabled: M,
|
|
100
|
-
features:
|
|
100
|
+
features: a,
|
|
101
101
|
popupContainer: f,
|
|
102
102
|
icon: yt
|
|
103
|
-
} = Jt(sn), [Pe, ye] = m(!1), y =
|
|
103
|
+
} = Jt(sn), [Pe, ye] = m(!1), y = q(h), Te = q(void 0), [pt, vt] = m(0), [X, A] = m(), [Y, ne] = m(""), [Fe, pe] = m(!1), ve = q(null), [Ee, kt] = m([]), [Re, K] = m(!1), [De, bt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = q(null), He = q(null), ke = q(null), [Me, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Ft] = m(!0), [Oe, O] = m(!1), [be, V] = m(!1), [Ue, Et] = m(!1), [E, ae] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Rt, Dt] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [je, U] = m(!1), [ze, Z] = m(!1), [Ht, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [Ve, le] = m(!1);
|
|
104
104
|
F(() => {
|
|
105
105
|
var r, i;
|
|
106
106
|
e && (y.current = []), C([]);
|
|
@@ -113,12 +113,12 @@ const lt = 10, ei = (L) => {
|
|
|
113
113
|
const s = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
|
|
114
114
|
y.current = [...s], C([...s]);
|
|
115
115
|
}
|
|
116
|
-
const n = (
|
|
116
|
+
const n = (l) => {
|
|
117
117
|
var s;
|
|
118
|
-
(s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...
|
|
118
|
+
(s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...l].reverse(), C([...l].reverse()), !l || l.length < 10 ? Z(!1) : Z(!0), Ne && Ne({
|
|
119
119
|
applicationId: o.id,
|
|
120
120
|
sessionId: e.data.id,
|
|
121
|
-
histories:
|
|
121
|
+
histories: l
|
|
122
122
|
}));
|
|
123
123
|
};
|
|
124
124
|
return e.addEventListener("history:loaded", n), () => {
|
|
@@ -173,7 +173,7 @@ const lt = 10, ei = (L) => {
|
|
|
173
173
|
kt(t);
|
|
174
174
|
}));
|
|
175
175
|
}, [ut, o]);
|
|
176
|
-
const
|
|
176
|
+
const Be = (t) => j(void 0, null, function* () {
|
|
177
177
|
var p, T;
|
|
178
178
|
if (M) {
|
|
179
179
|
u.config({
|
|
@@ -234,29 +234,29 @@ const lt = 10, ei = (L) => {
|
|
|
234
234
|
});
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
-
|
|
237
|
+
A(void 0), ne("");
|
|
238
238
|
const i = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
|
|
239
239
|
if (!i) {
|
|
240
240
|
w == null || w({
|
|
241
241
|
netOpen: H ? 1 : 2
|
|
242
242
|
}).then((k) => {
|
|
243
|
-
var
|
|
244
|
-
U(!0), x(!!((
|
|
243
|
+
var B, J;
|
|
244
|
+
U(!0), x(!!((B = k.data) != null && B.netOpen)), Q(!!((J = k.data) != null && J.enableNetOpen)), $e(k).then(() => {
|
|
245
245
|
b == null || b(k), U(!1), Ce(n);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
le(!0);
|
|
251
|
-
const
|
|
251
|
+
const l = Y ? `
|
|
252
252
|
${n}` : n;
|
|
253
253
|
let s;
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
z ? s = yield z == null ? void 0 : z({
|
|
256
256
|
applicationId: o.id,
|
|
257
257
|
sessionId: i,
|
|
258
258
|
message: {
|
|
259
|
-
content:
|
|
259
|
+
content: l,
|
|
260
260
|
sessionId: i,
|
|
261
261
|
role: rt.User,
|
|
262
262
|
files: ie[i]
|
|
@@ -269,7 +269,7 @@ ${n}` : n;
|
|
|
269
269
|
return;
|
|
270
270
|
let d = n;
|
|
271
271
|
typeof s == "object" && (d = s.content || n), (yield e.setPromptVariables(E)) && (((T = ie[i]) == null ? void 0 : T.length) > 0 ? Ot(d) : we(d));
|
|
272
|
-
}),
|
|
272
|
+
}), $e = (t) => new Promise((n, r) => j(void 0, null, function* () {
|
|
273
273
|
const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === ge.User || d.type === void 0) && d.key === "query") && !((d.type === ge.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
|
|
274
274
|
var p;
|
|
275
275
|
const I = (p = E.find((T) => T.key === d.key && T.type === d.type)) == null ? void 0 : p.value;
|
|
@@ -287,9 +287,9 @@ ${n}` : n;
|
|
|
287
287
|
if (re(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
|
|
288
288
|
return;
|
|
289
289
|
const n = ((d = e.data) == null ? void 0 : d.id) || "", r = [];
|
|
290
|
-
let i = [],
|
|
290
|
+
let i = [], l = /* @__PURE__ */ new Set();
|
|
291
291
|
(I = ie[n]) == null || I.forEach((p) => {
|
|
292
|
-
|
|
292
|
+
l.has(p.id) || (i.push(p), l.add(p.id));
|
|
293
293
|
}), Promise.all(i.map((p) => P == null ? void 0 : P.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, p.id, {
|
|
294
294
|
enabled: 1
|
|
295
295
|
}).then((T) => {
|
|
@@ -303,13 +303,13 @@ ${n}` : n;
|
|
|
303
303
|
F(() => {
|
|
304
304
|
if (!he || !e)
|
|
305
305
|
return;
|
|
306
|
-
const t = he, n = () =>
|
|
306
|
+
const t = he, n = () => j(void 0, null, function* () {
|
|
307
307
|
le(!0);
|
|
308
308
|
const r = Y ? `
|
|
309
309
|
${t}` : t;
|
|
310
310
|
let i;
|
|
311
311
|
try {
|
|
312
|
-
|
|
312
|
+
z ? i = yield z == null ? void 0 : z({
|
|
313
313
|
applicationId: o.id,
|
|
314
314
|
sessionId: e.id,
|
|
315
315
|
message: {
|
|
@@ -319,7 +319,7 @@ ${t}` : t;
|
|
|
319
319
|
files: ie[e.id]
|
|
320
320
|
}
|
|
321
321
|
}) : i = !0;
|
|
322
|
-
} catch (
|
|
322
|
+
} catch (l) {
|
|
323
323
|
i = !1;
|
|
324
324
|
}
|
|
325
325
|
le(!1), i !== !1 && (we(t), Ce(void 0));
|
|
@@ -328,18 +328,18 @@ ${t}` : t;
|
|
|
328
328
|
e == null || e.removeEventListener("ready", n);
|
|
329
329
|
};
|
|
330
330
|
}, [he, e]);
|
|
331
|
-
const we = (t, n) =>
|
|
331
|
+
const we = (t, n) => j(void 0, null, function* () {
|
|
332
332
|
var p, T;
|
|
333
333
|
const r = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
|
|
334
334
|
if (!r)
|
|
335
335
|
return;
|
|
336
336
|
V(!0), O(!0);
|
|
337
337
|
const i = Y ? `
|
|
338
|
-
${t}` : t,
|
|
339
|
-
ee(void 0), W(void 0), y.current = [
|
|
338
|
+
${t}` : t, l = new S(i, r, G.User, n);
|
|
339
|
+
ee(void 0), W(void 0), y.current = [l, ...h], C(y.current), o.id && te && te({
|
|
340
340
|
applicationId: o.id,
|
|
341
341
|
sessionId: r,
|
|
342
|
-
message:
|
|
342
|
+
message: l
|
|
343
343
|
});
|
|
344
344
|
const s = new S("", r, G.System);
|
|
345
345
|
s.isWaiting = !0, y.current = [s, ...y.current], C(y.current);
|
|
@@ -348,7 +348,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
348
348
|
referenceFirst: !1
|
|
349
349
|
};
|
|
350
350
|
if (g != null && g.promptVariables) {
|
|
351
|
-
const k = E == null ? void 0 : E.reduce((
|
|
351
|
+
const k = E == null ? void 0 : E.reduce((B, J) => (B[J.key] = J.value, B), {});
|
|
352
352
|
I.formatValues = k;
|
|
353
353
|
}
|
|
354
354
|
if (g != null && g.knowledges) {
|
|
@@ -374,8 +374,8 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
374
374
|
return ce.error({
|
|
375
375
|
message: i.content
|
|
376
376
|
});
|
|
377
|
-
const
|
|
378
|
-
s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions =
|
|
377
|
+
const l = i.actions || [], s = new S(i.content, t, G.Robot);
|
|
378
|
+
s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = l, s.isLoading = !0, s.searchingStatus = i.searchingStatus, y.current = y.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...y.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...y.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...y.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...y.current]), o.id && te && te({
|
|
379
379
|
applicationId: o.id,
|
|
380
380
|
sessionId: t,
|
|
381
381
|
message: s
|
|
@@ -415,39 +415,39 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
415
415
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
416
416
|
}), u.error("图片须小于20M"), u.config({
|
|
417
417
|
getContainer: void 0
|
|
418
|
-
}), !1) : (
|
|
419
|
-
},
|
|
418
|
+
}), !1) : (A(t), !1);
|
|
419
|
+
}, jt = (t) => j(void 0, null, function* () {
|
|
420
420
|
var n;
|
|
421
|
-
return
|
|
421
|
+
return A(t), (n = e == null ? void 0 : e.data) != null && n.id ? qe(e, t) : new Promise((r) => {
|
|
422
422
|
U(!0), w == null || w({
|
|
423
423
|
netOpen: H ? 1 : 2
|
|
424
424
|
}).then((i) => {
|
|
425
|
-
var
|
|
426
|
-
b == null || b(i), U(!1), x(!!((
|
|
425
|
+
var l, s;
|
|
426
|
+
b == null || b(i), U(!1), x(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(qe(i, t));
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
|
-
}),
|
|
429
|
+
}), qe = (t, n) => {
|
|
430
430
|
const r = dn(n.name);
|
|
431
431
|
return new Promise((i) => {
|
|
432
432
|
var s;
|
|
433
|
-
const
|
|
433
|
+
const l = {
|
|
434
434
|
files: [`${ft()}.${r}`],
|
|
435
435
|
isv: "minio",
|
|
436
436
|
knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
|
|
437
437
|
type: 1
|
|
438
438
|
};
|
|
439
|
-
pe(!0), P == null || P.postTicket(
|
|
439
|
+
pe(!0), P == null || P.postTicket(l).then((d) => {
|
|
440
440
|
P.uploadMinioFile(d.minio, n).then(() => {
|
|
441
|
-
var k,
|
|
442
|
-
const I = (k = d.minio.endpoints) == null ? void 0 : k[0], p = d.minio.bucket, T = (
|
|
441
|
+
var k, B;
|
|
442
|
+
const I = (k = d.minio.endpoints) == null ? void 0 : k[0], p = d.minio.bucket, T = (B = d.minio.fileKeys) == null ? void 0 : B[0];
|
|
443
443
|
i(`${location.protocol}//${I}/${p}/${T}`);
|
|
444
444
|
}).catch(() => {
|
|
445
|
-
ne(""),
|
|
445
|
+
ne(""), A(void 0);
|
|
446
446
|
}).finally(() => {
|
|
447
447
|
pe(!1);
|
|
448
448
|
});
|
|
449
449
|
}).catch(() => {
|
|
450
|
-
ne(""),
|
|
450
|
+
ne(""), A(void 0), pe(!1);
|
|
451
451
|
});
|
|
452
452
|
});
|
|
453
453
|
};
|
|
@@ -457,17 +457,17 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
457
457
|
top: t.scrollHeight
|
|
458
458
|
});
|
|
459
459
|
}, [h]);
|
|
460
|
-
const
|
|
460
|
+
const Ae = (t, n) => new Promise((r) => {
|
|
461
461
|
if (!n.file.url || !(o != null && o.id))
|
|
462
462
|
return r();
|
|
463
463
|
const i = st(ot({}, n.file), {
|
|
464
464
|
type: 1
|
|
465
465
|
});
|
|
466
466
|
P == null || P.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
|
|
467
|
-
var
|
|
468
|
-
(
|
|
467
|
+
var l;
|
|
468
|
+
(l = se.current) == null || l.update().finally(r);
|
|
469
469
|
});
|
|
470
|
-
}),
|
|
470
|
+
}), zt = () => {
|
|
471
471
|
var t;
|
|
472
472
|
(t = e == null ? void 0 : e.data) != null && t.id && (O(!1), e.suspend());
|
|
473
473
|
}, Vt = (t) => {
|
|
@@ -478,17 +478,17 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
478
478
|
behavior: t == null ? void 0 : t.behavior
|
|
479
479
|
});
|
|
480
480
|
}, t == null ? void 0 : t.ms);
|
|
481
|
-
},
|
|
481
|
+
}, Bt = () => {
|
|
482
482
|
if (!R.current)
|
|
483
483
|
return;
|
|
484
484
|
const t = R.current.scrollTop <= -80;
|
|
485
485
|
Et(t);
|
|
486
|
-
},
|
|
486
|
+
}, $t = Le((t) => {
|
|
487
487
|
var n, r;
|
|
488
488
|
(n = ve.current) == null || n.update(t), (r = ve.current) == null || r.focus();
|
|
489
|
-
}),
|
|
490
|
-
|
|
491
|
-
}),
|
|
489
|
+
}), qt = Le((t) => {
|
|
490
|
+
Be(t);
|
|
491
|
+
}), At = Le(() => {
|
|
492
492
|
var n;
|
|
493
493
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
494
494
|
return;
|
|
@@ -498,7 +498,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
498
498
|
});
|
|
499
499
|
F(() => {
|
|
500
500
|
var t, n;
|
|
501
|
-
Te.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !
|
|
501
|
+
Te.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !je && ((n = ke.current) == null || n.clear());
|
|
502
502
|
}, [e]);
|
|
503
503
|
const Yt = () => {
|
|
504
504
|
var r;
|
|
@@ -509,14 +509,14 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
509
509
|
endTime: n,
|
|
510
510
|
pageSize: lt
|
|
511
511
|
}).then((i) => {
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
512
|
+
const l = i || [];
|
|
513
|
+
if (!l || !(l != null && l.length)) {
|
|
514
514
|
Z(!1);
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
|
|
517
|
+
l.length < 10 ? Z(!1) : Z(!0), C([...h, ...l.reverse()]);
|
|
518
518
|
});
|
|
519
|
-
}, Kt = (t) =>
|
|
519
|
+
}, Kt = (t) => j(void 0, null, function* () {
|
|
520
520
|
var n, r;
|
|
521
521
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
522
522
|
x(t);
|
|
@@ -525,7 +525,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
525
525
|
return;
|
|
526
526
|
x(t);
|
|
527
527
|
}
|
|
528
|
-
}), xe = () =>
|
|
528
|
+
}), xe = () => j(void 0, null, function* () {
|
|
529
529
|
e ? e.fetchData().then((t) => {
|
|
530
530
|
var n;
|
|
531
531
|
(n = e == null ? void 0 : e.data) != null && n.id && (x(t.netOpen), Q(t.enableNetOpen));
|
|
@@ -536,11 +536,11 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
536
536
|
}, [e]), F(() => {
|
|
537
537
|
var t, n;
|
|
538
538
|
if (R.current) {
|
|
539
|
-
const r = document.getElementById("chat-main"), i = (t = R.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"),
|
|
540
|
-
if (!i || !
|
|
539
|
+
const r = document.getElementById("chat-main"), i = (t = R.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = R.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
|
|
540
|
+
if (!i || !l || !r)
|
|
541
541
|
return;
|
|
542
542
|
const s = r.offsetHeight;
|
|
543
|
-
if (
|
|
543
|
+
if (l.offsetHeight <= s) {
|
|
544
544
|
if (i.style.height === "100%")
|
|
545
545
|
return;
|
|
546
546
|
i.style.height = "100%";
|
|
@@ -554,28 +554,28 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
554
554
|
if (e)
|
|
555
555
|
return;
|
|
556
556
|
const t = () => {
|
|
557
|
-
const i = ((N == null ? void 0 : N.promptVariables) || []).filter((
|
|
557
|
+
const i = ((N == null ? void 0 : N.promptVariables) || []).filter((l) => l.type ? !(l.type === ge.User && l.key === "query") && !(l.type === ge.System && l.key === "datetime") && l.status === 1 : l.key !== "query" && l.status === 1).map((l, s) => {
|
|
558
558
|
var I, p;
|
|
559
559
|
let d = "";
|
|
560
|
-
return typeof (
|
|
560
|
+
return typeof (a == null ? void 0 : a.promptVariables) == "object" && (d = ((p = (I = a.promptVariables.default) == null ? void 0 : I.find((T) => T.key === l.key && T.type === l.type)) == null ? void 0 : p.value) || ""), {
|
|
561
561
|
id: s + "",
|
|
562
|
-
key:
|
|
563
|
-
name:
|
|
562
|
+
key: l.key,
|
|
563
|
+
name: l.name,
|
|
564
564
|
value: d,
|
|
565
|
-
type:
|
|
565
|
+
type: l.type
|
|
566
566
|
};
|
|
567
567
|
});
|
|
568
|
-
ae([...i].sort((
|
|
568
|
+
ae([...i].sort((l, s) => l.key.localeCompare(s.key)));
|
|
569
569
|
};
|
|
570
570
|
return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
|
|
571
571
|
N == null || N.removeEventListener("ready", t);
|
|
572
572
|
};
|
|
573
|
-
}, [e, N,
|
|
573
|
+
}, [e, N, a == null ? void 0 : a.promptVariables]);
|
|
574
574
|
const Ye = () => w == null ? void 0 : w({
|
|
575
575
|
netOpen: H ? 1 : 2
|
|
576
576
|
}).then((t) => {
|
|
577
577
|
var n, r;
|
|
578
|
-
return b == null || b(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)),
|
|
578
|
+
return b == null || b(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), $e(t), t;
|
|
579
579
|
}), Ke = St(() => {
|
|
580
580
|
var t;
|
|
581
581
|
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(dt, {
|
|
@@ -593,10 +593,10 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
593
593
|
isLoading: !1
|
|
594
594
|
},
|
|
595
595
|
actions: !!h.length,
|
|
596
|
-
markdown:
|
|
596
|
+
markdown: a == null ? void 0 : a.markdown
|
|
597
597
|
}) : null;
|
|
598
598
|
}, [o == null ? void 0 : o.arrange, h]);
|
|
599
|
-
return /* @__PURE__ */
|
|
599
|
+
return /* @__PURE__ */ $("div", {
|
|
600
600
|
className: "agent-chat",
|
|
601
601
|
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(vn, {
|
|
602
602
|
ref: He,
|
|
@@ -605,7 +605,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
605
605
|
promptVariables: E,
|
|
606
606
|
setPromptVariables: ae,
|
|
607
607
|
setCurrentSession: b
|
|
608
|
-
}), /* @__PURE__ */
|
|
608
|
+
}), /* @__PURE__ */ $("div", {
|
|
609
609
|
className: "chat-main",
|
|
610
610
|
id: "chat-main",
|
|
611
611
|
style: mt,
|
|
@@ -619,8 +619,8 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
619
619
|
flexDirection: "column-reverse"
|
|
620
620
|
},
|
|
621
621
|
ref: R,
|
|
622
|
-
onScroll:
|
|
623
|
-
children: (We = e == null ? void 0 : e.data) != null && We.id && (h != null && h.length) ? /* @__PURE__ */
|
|
622
|
+
onScroll: Bt,
|
|
623
|
+
children: (We = e == null ? void 0 : e.data) != null && We.id && (h != null && h.length) ? /* @__PURE__ */ $(bn, {
|
|
624
624
|
dataLength: h.length,
|
|
625
625
|
next: Yt,
|
|
626
626
|
style: {
|
|
@@ -634,7 +634,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
634
634
|
plain: !0,
|
|
635
635
|
children: "没有更多数据了"
|
|
636
636
|
}) : null,
|
|
637
|
-
hasMore:
|
|
637
|
+
hasMore: ze,
|
|
638
638
|
loader: /* @__PURE__ */ c("div", {
|
|
639
639
|
style: {
|
|
640
640
|
height: "50px",
|
|
@@ -650,34 +650,35 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
650
650
|
history: t,
|
|
651
651
|
docViewerUrl: v,
|
|
652
652
|
isLastHistory: n === 0,
|
|
653
|
-
onRelatedClick:
|
|
654
|
-
onAgainClick:
|
|
655
|
-
onEditClick:
|
|
656
|
-
markdown:
|
|
657
|
-
}, t.messageId + n)), !
|
|
658
|
-
}) : /* @__PURE__ */
|
|
653
|
+
onRelatedClick: qt,
|
|
654
|
+
onAgainClick: At,
|
|
655
|
+
onEditClick: $t,
|
|
656
|
+
markdown: a == null ? void 0 : a.markdown
|
|
657
|
+
}, t.messageId + n)), !ze && Ke]
|
|
658
|
+
}) : /* @__PURE__ */ $("div", {
|
|
659
659
|
className: "main-empty",
|
|
660
|
-
children: [(
|
|
661
|
-
text:
|
|
662
|
-
icon:
|
|
663
|
-
children: !!Ee.length && (((
|
|
660
|
+
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(gn, {
|
|
661
|
+
text: a === void 0 || a.greeting === !0 || ((Ge = a.greeting) == null ? void 0 : Ge.text) === void 0 ? at.text : a.greeting.text,
|
|
662
|
+
icon: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.icon) === void 0 ? yt || at.icon : a.greeting.icon,
|
|
663
|
+
children: !!Ee.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ c(fn, {
|
|
664
664
|
ref: ke,
|
|
665
665
|
sid: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
|
|
666
666
|
isRecommendClearing: Re,
|
|
667
667
|
data: Ee,
|
|
668
|
+
layoutBreakpoints: typeof (a == null ? void 0 : a.greeting) == "object" ? a.greeting.layoutBreakpoints : void 0,
|
|
668
669
|
onItemClick: (t) => {
|
|
669
|
-
var r, i,
|
|
670
|
+
var r, i, l;
|
|
670
671
|
if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Re)
|
|
671
672
|
return;
|
|
672
673
|
t != null && t.id && K(!0);
|
|
673
674
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
674
|
-
g != null && g.fileUpload ? (
|
|
675
|
+
g != null && g.fileUpload ? (l = (i = se.current) == null ? void 0 : i.clear()) == null || l.then(() => {
|
|
675
676
|
var s, d;
|
|
676
|
-
t != null && t.id && (n ? (s =
|
|
677
|
+
t != null && t.id && (n ? (s = Ae(n, t)) == null || s.finally(() => {
|
|
677
678
|
K(!1);
|
|
678
679
|
}) : (K(!1), U(!0), (d = Ye()) == null || d.then((I) => {
|
|
679
680
|
var p;
|
|
680
|
-
(p =
|
|
681
|
+
(p = Ae(I.id, t)) == null || p.finally(() => {
|
|
681
682
|
K(!1);
|
|
682
683
|
});
|
|
683
684
|
})));
|
|
@@ -701,7 +702,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
701
702
|
fontSize: 16
|
|
702
703
|
}
|
|
703
704
|
}),
|
|
704
|
-
onClick: () =>
|
|
705
|
+
onClick: () => zt(),
|
|
705
706
|
children: "停止回答"
|
|
706
707
|
})
|
|
707
708
|
}), Ue && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
|
|
@@ -722,24 +723,24 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
722
723
|
})]
|
|
723
724
|
}), /* @__PURE__ */ c("div", {
|
|
724
725
|
className: "chat-footer",
|
|
725
|
-
children: /* @__PURE__ */
|
|
726
|
+
children: /* @__PURE__ */ $("div", {
|
|
726
727
|
className: "chat-footer-input",
|
|
727
728
|
children: [X && /* @__PURE__ */ c("div", {
|
|
728
729
|
className: "input-files",
|
|
729
730
|
children: /* @__PURE__ */ c(ln, {
|
|
730
731
|
file: X,
|
|
731
732
|
actions: {
|
|
732
|
-
upload:
|
|
733
|
+
upload: jt,
|
|
733
734
|
remove: () => {
|
|
734
|
-
|
|
735
|
+
A(void 0);
|
|
735
736
|
}
|
|
736
737
|
},
|
|
737
738
|
onUrlChange: (t) => ne(t)
|
|
738
739
|
})
|
|
739
|
-
}), /* @__PURE__ */
|
|
740
|
+
}), /* @__PURE__ */ $(de, {
|
|
740
741
|
className: "footer-upload-action",
|
|
741
742
|
onClick: (t) => t.preventDefault(),
|
|
742
|
-
children: [/* @__PURE__ */
|
|
743
|
+
children: [/* @__PURE__ */ $(de, {
|
|
743
744
|
children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(nn, {
|
|
744
745
|
disabled: !!X || M,
|
|
745
746
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
@@ -788,17 +789,17 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
788
789
|
}), ue && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(yn, {
|
|
789
790
|
appId: o == null ? void 0 : o.id,
|
|
790
791
|
ref: se,
|
|
791
|
-
isFirstSession:
|
|
792
|
+
isFirstSession: je,
|
|
792
793
|
docViewerUrl: v,
|
|
793
|
-
onStatusChange: (t) =>
|
|
794
|
+
onStatusChange: (t) => j(void 0, null, function* () {
|
|
794
795
|
t !== "process" ? (re(!0), xe()) : re(!1);
|
|
795
796
|
}),
|
|
796
797
|
createSession: () => new Promise((t) => {
|
|
797
798
|
U(!0), w == null || w({
|
|
798
799
|
netOpen: H ? 1 : 2
|
|
799
800
|
}).then((n) => {
|
|
800
|
-
var i,
|
|
801
|
-
b == null || b(n), U(!1), x(!!((i = n.data) != null && i.netOpen)), Q(!!((
|
|
801
|
+
var i, l, s;
|
|
802
|
+
b == null || b(n), U(!1), x(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
|
|
802
803
|
const r = ((s = n.data) == null ? void 0 : s.id) || "";
|
|
803
804
|
t(r);
|
|
804
805
|
});
|
|
@@ -817,9 +818,9 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
817
818
|
var r;
|
|
818
819
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
819
820
|
n && oe((i) => {
|
|
820
|
-
const
|
|
821
|
+
const l = i[n] || [];
|
|
821
822
|
return {
|
|
822
|
-
[n]:
|
|
823
|
+
[n]: l.filter((s) => s.id !== t)
|
|
823
824
|
};
|
|
824
825
|
});
|
|
825
826
|
},
|
|
@@ -843,11 +844,11 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
843
844
|
},
|
|
844
845
|
disabled: M
|
|
845
846
|
})]
|
|
846
|
-
}), /* @__PURE__ */
|
|
847
|
+
}), /* @__PURE__ */ $(de, {
|
|
847
848
|
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((Se = o.arrange) == null ? void 0 : Se.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(wn, {
|
|
848
849
|
sessionId: (et = e == null ? void 0 : e.data) == null ? void 0 : et.id,
|
|
849
850
|
netStatus: H,
|
|
850
|
-
enable: typeof (
|
|
851
|
+
enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Ht,
|
|
851
852
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
852
853
|
onNetStatusChange: (t) => {
|
|
853
854
|
Kt(t);
|
|
@@ -879,7 +880,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
879
880
|
networkStatus: !1,
|
|
880
881
|
loading: Ve,
|
|
881
882
|
disabled: Pe || Fe || M || Ve,
|
|
882
|
-
onTextSend:
|
|
883
|
+
onTextSend: Be,
|
|
883
884
|
onChange: (t, n) => {
|
|
884
885
|
W(t);
|
|
885
886
|
const r = n.getText().replace(/[\n\s]+$/, "");
|