@glodon-aiot/agent-cli-ui 3.19.0-alpha.21 → 3.19.0-alpha.22
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 +287 -273
- package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.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/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style29.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +30 -30
- package/package.json +3 -3
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Hn = Object.defineProperty, jn = Object.defineProperties;
|
|
2
2
|
var $n = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var jt = Object.getOwnPropertySymbols;
|
|
4
4
|
var zn = Object.prototype.hasOwnProperty, Vn = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var He = (b, h, i) => h in b ? Hn(b, h, { enumerable: !0, configurable: !0, writable: !0, value: i }) : b[h] = i, je = (b, h) => {
|
|
6
6
|
for (var i in h || (h = {}))
|
|
7
|
-
zn.call(h, i) &&
|
|
7
|
+
zn.call(h, i) && He(b, i, h[i]);
|
|
8
8
|
if (jt)
|
|
9
9
|
for (var i of jt(h))
|
|
10
|
-
Vn.call(h, i) &&
|
|
11
|
-
return
|
|
12
|
-
}, $e = (
|
|
13
|
-
var j = (
|
|
14
|
-
var $ = (
|
|
15
|
-
var
|
|
10
|
+
Vn.call(h, i) && He(b, i, h[i]);
|
|
11
|
+
return b;
|
|
12
|
+
}, $e = (b, h) => jn(b, $n(h));
|
|
13
|
+
var j = (b, h, i) => (He(b, typeof h != "symbol" ? h + "" : h, i), i);
|
|
14
|
+
var $ = (b, h, i) => new Promise((A, e) => {
|
|
15
|
+
var I = (T) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
e(
|
|
17
|
+
x(i.next(T));
|
|
18
|
+
} catch (R) {
|
|
19
|
+
e(R);
|
|
20
20
|
}
|
|
21
|
-
}, z = (
|
|
21
|
+
}, z = (T) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
e(
|
|
23
|
+
x(i.throw(T));
|
|
24
|
+
} catch (R) {
|
|
25
|
+
e(R);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, x = (T) => T.done ? A(T.value) : Promise.resolve(T.value).then(I, z);
|
|
28
|
+
x((i = i.apply(b, h)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as g, jsxs as
|
|
31
|
-
import { memo as _n, forwardRef as qn, useState as p, useRef as K, useContext as Wn, useEffect as
|
|
32
|
-
/* empty css */import { Spin as $t, Divider as
|
|
30
|
+
import { jsx as g, jsxs as U, Fragment as Bn } from "react/jsx-runtime";
|
|
31
|
+
import { memo as _n, forwardRef as qn, useState as p, useRef as K, useContext as Wn, useEffect as N, useMemo as Kn, useImperativeHandle as Sn } from "react";
|
|
32
|
+
/* empty css */import { Spin as $t, Divider as Yn, Button as G, Space as Ee, Upload as Qn, Tooltip as Xn, Popover as Gn, notification as se, message as Zn } from "antd";
|
|
33
33
|
import re from "../../components/Iconfont/index.mjs";
|
|
34
|
-
import { IHistoryRole as ae, ApplicationTypes as
|
|
34
|
+
import { IHistoryRole as ae, ApplicationTypes as S, ChatMessageRole as zt, PromptVariableType as Ne } from "@glodon-aiot/apis";
|
|
35
35
|
import Wt from "./HistoryItem/index.mjs";
|
|
36
36
|
import Kt from "dayjs";
|
|
37
37
|
import { v4 as _e } from "uuid";
|
|
@@ -62,7 +62,7 @@ const bi = _n(Wt), _t = {
|
|
|
62
62
|
text: "今天我能帮你什么?"
|
|
63
63
|
};
|
|
64
64
|
class he {
|
|
65
|
-
constructor(h, i,
|
|
65
|
+
constructor(h, i, A, e, I) {
|
|
66
66
|
j(this, "messageTime");
|
|
67
67
|
j(this, "isWaiting");
|
|
68
68
|
j(this, "messageId");
|
|
@@ -74,46 +74,46 @@ class he {
|
|
|
74
74
|
j(this, "imageContent");
|
|
75
75
|
// 新增:支持对话型应用的图片内容
|
|
76
76
|
j(this, "comment");
|
|
77
|
-
this.content = h, this.sessionId = i, this.role =
|
|
77
|
+
this.content = h, this.sessionId = i, this.role = A, this.files = e, this.content = h, this.role = A, this.sessionId = i, this.files = e, this.imageContent = I, this.messageTime = Kt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = _e(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
78
78
|
isAgree: 0
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
const qt = 10, Z = 5, Ve = 20, Be = (
|
|
83
|
-
let e =
|
|
84
|
-
if (
|
|
82
|
+
const qt = 10, Z = 5, Ve = 20, Be = (b, h, i, A) => {
|
|
83
|
+
let e = b;
|
|
84
|
+
if (A === S.Agent) {
|
|
85
85
|
if (i && i.length > 0) {
|
|
86
|
-
const
|
|
86
|
+
const I = i.map((z) => `[${z.name.replace(/\.[^/.]+$/, "")}](${z.url})`).join(`
|
|
87
87
|
`);
|
|
88
|
-
e =
|
|
88
|
+
e = I ? `${I}
|
|
89
89
|
${e}` : e;
|
|
90
90
|
}
|
|
91
91
|
if (h && h.length > 0) {
|
|
92
|
-
const
|
|
92
|
+
const I = h.filter(Boolean).map((z) => ``).join(`
|
|
93
93
|
`);
|
|
94
|
-
e =
|
|
94
|
+
e = I ? `${I}
|
|
95
95
|
${e}` : e;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
return e;
|
|
99
|
-
}, xi = (
|
|
100
|
-
const h = Math.floor(
|
|
101
|
-
return `${e(h)}:${e(i)}:${e(
|
|
102
|
-
}, no = qn((
|
|
103
|
-
var bt, xt, Ct, It,
|
|
99
|
+
}, xi = (b) => {
|
|
100
|
+
const h = Math.floor(b / 3600), i = Math.floor(b % 3600 / 60), A = b % 60, e = (I) => String(I).padStart(2, "0");
|
|
101
|
+
return `${e(h)}:${e(i)}:${e(A)}`;
|
|
102
|
+
}, no = qn((b, h) => {
|
|
103
|
+
var bt, xt, Ct, It, Et, Nt, Lt, Pt, Dt, Tt, Rt, Ot, Ft, Ut;
|
|
104
104
|
const {
|
|
105
105
|
application: i,
|
|
106
|
-
docViewerUrl:
|
|
106
|
+
docViewerUrl: A = "",
|
|
107
107
|
currentSession: e,
|
|
108
|
-
onCreateSession:
|
|
108
|
+
onCreateSession: I,
|
|
109
109
|
embeddingService: z,
|
|
110
|
-
setCurrentSession:
|
|
111
|
-
networkStatus:
|
|
112
|
-
setNetworkStatus:
|
|
113
|
-
} =
|
|
114
|
-
service:
|
|
110
|
+
setCurrentSession: x,
|
|
111
|
+
networkStatus: T,
|
|
112
|
+
setNetworkStatus: R
|
|
113
|
+
} = b, [w, L] = p([]), [St, me] = p(), [Le, qe] = p(), O = K(null), {
|
|
114
|
+
service: M,
|
|
115
115
|
agentClient: P,
|
|
116
|
-
depId:
|
|
116
|
+
depId: Yt,
|
|
117
117
|
footer: Qt,
|
|
118
118
|
transform: f,
|
|
119
119
|
defaultInput: Pe,
|
|
@@ -121,18 +121,18 @@ ${e}` : e;
|
|
|
121
121
|
onHistoryLoad: We,
|
|
122
122
|
beforeMessageSend: _,
|
|
123
123
|
bodyStyle: Xt,
|
|
124
|
-
disabled:
|
|
124
|
+
disabled: F,
|
|
125
125
|
features: a,
|
|
126
|
-
popupContainer:
|
|
126
|
+
popupContainer: Y,
|
|
127
127
|
icon: Gt,
|
|
128
128
|
sider: Zt,
|
|
129
129
|
mode: Jt,
|
|
130
|
-
silencedSeconds:
|
|
131
|
-
} = Wn(Jn), [Ke,
|
|
132
|
-
|
|
133
|
-
nn(
|
|
134
|
-
}, [
|
|
135
|
-
const ke = K(null), [Ge, on] = p([]), [Ze, ee] = p(!1), [Je, sn] = p(!1), [rn, an] = p(""), [ln, te] = p(), [ne, de] = p({}), fe = K(null), et = K(null),
|
|
130
|
+
silencedSeconds: De
|
|
131
|
+
} = Wn(Jn), [Ke, Te] = p(!1), y = K(w), Se = K(void 0), [en, tn] = p(0), [ce, ve] = p([]), [J, we] = p([]), [Ye, Qe] = p(0), [Xe, nn] = p(!1);
|
|
132
|
+
N(() => {
|
|
133
|
+
nn(Ye > 0);
|
|
134
|
+
}, [Ye]);
|
|
135
|
+
const ke = K(null), [Ge, on] = p([]), [Ze, ee] = p(!1), [Je, sn] = p(!1), [rn, an] = p(""), [ln, te] = p(), [ne, de] = p({}), fe = K(null), et = K(null), Re = K(null), [tt, cn] = p(!1), [dn, fn] = p([]), [gn, be] = p(!0), [un, pn] = p(!0), [nt, V] = p(!1), [Oe, q] = p(!1), [it, hn] = p(!1), [H, ge] = p(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [mn, yn] = p(() => {
|
|
136
136
|
const t = typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0;
|
|
137
137
|
if (t) {
|
|
138
138
|
if (Array.isArray(t) && t.some((r) => Array.isArray(r.fileIds) && r.fileIds.length === 0))
|
|
@@ -145,12 +145,12 @@ ${e}` : e;
|
|
|
145
145
|
isSwitchingToExistingSession: ct,
|
|
146
146
|
setIsSwitchingToExistingSession: Ie
|
|
147
147
|
} = wi(), ie = K(null), [Fe, xn] = p("");
|
|
148
|
-
|
|
149
|
-
if (!
|
|
148
|
+
N(() => {
|
|
149
|
+
if (!De)
|
|
150
150
|
return;
|
|
151
|
-
let t = xi(
|
|
151
|
+
let t = xi(De);
|
|
152
152
|
xn(t);
|
|
153
|
-
}, [
|
|
153
|
+
}, [De]), N(() => {
|
|
154
154
|
if (bn(e), e === null)
|
|
155
155
|
W(!1);
|
|
156
156
|
else if (e === void 0)
|
|
@@ -166,21 +166,21 @@ ${e}` : e;
|
|
|
166
166
|
}
|
|
167
167
|
e.ready ? W(!1) : W(!0);
|
|
168
168
|
}
|
|
169
|
-
}, [e, e == null ? void 0 : e.ready, ct]),
|
|
169
|
+
}, [e, e == null ? void 0 : e.ready, ct]), N(() => {
|
|
170
170
|
var o, r;
|
|
171
171
|
e && (y.current = []), L([]);
|
|
172
|
-
const t =
|
|
172
|
+
const t = O.current;
|
|
173
173
|
if (t && t.scrollTo({
|
|
174
174
|
top: 0
|
|
175
175
|
}), !((o = e == null ? void 0 : e.data) != null && o.id))
|
|
176
176
|
return;
|
|
177
177
|
if (q(!1), V(!1), (r = e.messages) != null && r.length) {
|
|
178
|
-
const
|
|
179
|
-
y.current = [...
|
|
178
|
+
const c = [...e.messages.filter((l) => l == null ? void 0 : l.messageId)].reverse();
|
|
179
|
+
y.current = [...c], L([...c]), W(!1);
|
|
180
180
|
}
|
|
181
181
|
const n = (s) => {
|
|
182
|
-
var
|
|
183
|
-
(
|
|
182
|
+
var c;
|
|
183
|
+
(c = e == null ? void 0 : e.data) != null && c.id && (y.current = [...s].reverse(), L([...s].reverse()), !s || s.length < 10 ? ue(!1) : ue(!0), W(!1), We && We({
|
|
184
184
|
applicationId: i.id,
|
|
185
185
|
sessionId: e.data.id,
|
|
186
186
|
histories: s
|
|
@@ -189,22 +189,22 @@ ${e}` : e;
|
|
|
189
189
|
return e.addEventListener("history:loaded", n), () => {
|
|
190
190
|
y.current = [], L([]), e == null || e.removeEventListener("history:loaded", n);
|
|
191
191
|
};
|
|
192
|
-
}, [e]),
|
|
192
|
+
}, [e]), N(() => {
|
|
193
193
|
const t = () => {
|
|
194
194
|
var n;
|
|
195
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ge(e.promptVariables.sort((o, r) => o.key.localeCompare(r.key))), e.knowledges && yn(e.knowledges),
|
|
195
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ge(e.promptVariables.sort((o, r) => o.key.localeCompare(r.key))), e.knowledges && yn(e.knowledges), R(e.netOpen));
|
|
196
196
|
};
|
|
197
197
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
198
198
|
e == null || e.removeEventListener("data:updated", t);
|
|
199
199
|
};
|
|
200
|
-
}, [e]),
|
|
200
|
+
}, [e]), N(() => {
|
|
201
201
|
var n;
|
|
202
202
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
203
203
|
return;
|
|
204
204
|
const t = (o) => {
|
|
205
205
|
var r;
|
|
206
206
|
console.error(o.message, o.cause, "e.case"), se.config({
|
|
207
|
-
getContainer: () => (
|
|
207
|
+
getContainer: () => (Y == null ? void 0 : Y.current) || document.body,
|
|
208
208
|
prefixCls: "gbot-notification"
|
|
209
209
|
}), se.error({
|
|
210
210
|
message: ((r = o.cause) == null ? void 0 : r.message) || o.message
|
|
@@ -223,7 +223,7 @@ ${e}` : e;
|
|
|
223
223
|
return;
|
|
224
224
|
const t = e.data.id, n = w[w.length - 1];
|
|
225
225
|
if (n && n.isContext) {
|
|
226
|
-
|
|
226
|
+
D("success", "已开启新话题");
|
|
227
227
|
return;
|
|
228
228
|
} else
|
|
229
229
|
e.clear().then(() => {
|
|
@@ -231,42 +231,42 @@ ${e}` : e;
|
|
|
231
231
|
r.isContext = !0, L([r, ...w]);
|
|
232
232
|
});
|
|
233
233
|
};
|
|
234
|
-
|
|
235
|
-
i != null && i.id && (
|
|
234
|
+
N(() => {
|
|
235
|
+
i != null && i.id && (M == null || M.getRecommendQues(i.id).then((t) => {
|
|
236
236
|
on(t);
|
|
237
237
|
}));
|
|
238
|
-
}, [
|
|
238
|
+
}, [Yt, i]);
|
|
239
239
|
const dt = (t) => $(void 0, null, function* () {
|
|
240
|
-
var u,
|
|
241
|
-
if (
|
|
242
|
-
|
|
240
|
+
var u, E;
|
|
241
|
+
if (F) {
|
|
242
|
+
D("error", "发送功能被禁用");
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
const n = t ||
|
|
245
|
+
const n = t || St;
|
|
246
246
|
if (!(n != null && n.trim())) {
|
|
247
|
-
|
|
247
|
+
D("error", "请输入你想问的");
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
if (!(
|
|
250
|
+
if (!(H == null ? void 0 : H.every((C) => !!(C != null && C.value))))
|
|
251
251
|
if (f != null && f.promptVariables) {
|
|
252
|
-
|
|
252
|
+
D("error", "变量值不能为空");
|
|
253
253
|
return;
|
|
254
254
|
} else
|
|
255
|
-
console.error("变量值不能为空",
|
|
256
|
-
if (
|
|
257
|
-
|
|
255
|
+
console.error("变量值不能为空", H == null ? void 0 : H.map((C) => !!(C != null && C.value)));
|
|
256
|
+
if (Oe) {
|
|
257
|
+
D("error", "正在回复中");
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
if (Ke) {
|
|
261
|
-
|
|
261
|
+
D("error", "等待初始化");
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
if (!gn) {
|
|
265
|
-
|
|
265
|
+
D("error", "正在解析文件");
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
268
|
if (Xe) {
|
|
269
|
-
|
|
269
|
+
D("error", "正在上传图片");
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
272
|
ve([]), we([]);
|
|
@@ -274,14 +274,14 @@ ${e}` : e;
|
|
|
274
274
|
if (!r) {
|
|
275
275
|
if (Ce)
|
|
276
276
|
return;
|
|
277
|
-
X(!0),
|
|
278
|
-
netOpen:
|
|
279
|
-
}).then((
|
|
277
|
+
X(!0), I == null || I({
|
|
278
|
+
netOpen: T ? le.OPEN : le.CLOSE
|
|
279
|
+
}).then((C) => {
|
|
280
280
|
var m, B;
|
|
281
|
-
Q(!0),
|
|
282
|
-
|
|
281
|
+
Q(!0), R(!!((m = C.data) != null && m.netOpen)), pe(!!((B = C.data) != null && B.enableNetOpen)), Ue(C).then(() => {
|
|
282
|
+
x == null || x(C), Q(!1), qe(n);
|
|
283
283
|
});
|
|
284
|
-
}).catch((
|
|
284
|
+
}).catch((C) => {
|
|
285
285
|
X(!1);
|
|
286
286
|
});
|
|
287
287
|
return;
|
|
@@ -290,9 +290,9 @@ ${e}` : e;
|
|
|
290
290
|
return;
|
|
291
291
|
X(!0), xe(!0);
|
|
292
292
|
const s = Be(n, J, ne[r], (i == null ? void 0 : i.type) || 0);
|
|
293
|
-
let
|
|
293
|
+
let c;
|
|
294
294
|
try {
|
|
295
|
-
_ ?
|
|
295
|
+
_ ? c = yield _ == null ? void 0 : _({
|
|
296
296
|
applicationId: i.id,
|
|
297
297
|
sessionId: r,
|
|
298
298
|
message: {
|
|
@@ -301,44 +301,44 @@ ${e}` : e;
|
|
|
301
301
|
role: zt.User,
|
|
302
302
|
files: ne[r]
|
|
303
303
|
}
|
|
304
|
-
}) :
|
|
305
|
-
} catch (
|
|
306
|
-
|
|
304
|
+
}) : c = !0;
|
|
305
|
+
} catch (C) {
|
|
306
|
+
c = !1;
|
|
307
307
|
}
|
|
308
|
-
if (xe(!1),
|
|
308
|
+
if (xe(!1), c === !1) {
|
|
309
309
|
X(!1);
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
let l = n;
|
|
313
|
-
typeof
|
|
314
|
-
const
|
|
315
|
-
ge((m) => (
|
|
313
|
+
typeof c == "object" && (l = c.content || n);
|
|
314
|
+
const d = yield (() => new Promise((C) => {
|
|
315
|
+
ge((m) => (C(m), m));
|
|
316
316
|
}))();
|
|
317
|
-
if (!(yield e.setPromptVariables(
|
|
317
|
+
if (!(yield e.setPromptVariables(d))) {
|
|
318
318
|
X(!1);
|
|
319
319
|
return;
|
|
320
320
|
}
|
|
321
|
-
((
|
|
321
|
+
((E = ne[r]) == null ? void 0 : E.length) > 0 ? In(l) : Ae(l);
|
|
322
322
|
}), Ue = (t) => new Promise((n, o) => $(void 0, null, function* () {
|
|
323
|
-
const
|
|
324
|
-
var
|
|
325
|
-
const v = (
|
|
323
|
+
const c = (t == null ? void 0 : t.promptVariables).filter((l) => l.type ? !((l.type === Ne.User || l.type === void 0) && l.key === "query") && !((l.type === Ne.System || l.type === void 0) && l.key === "datetime") : l.key !== "query").map((l) => {
|
|
324
|
+
var d;
|
|
325
|
+
const v = (d = H.find((k) => k.key === l.key && k.type === l.type)) == null ? void 0 : d.value;
|
|
326
326
|
return l.value = v || "", l;
|
|
327
327
|
});
|
|
328
|
-
ge(
|
|
329
|
-
console.error(l),
|
|
328
|
+
ge(c.sort((l, v) => l.key.localeCompare(v.key))), yield t == null ? void 0 : t.setPromptVariables(c).catch((l) => {
|
|
329
|
+
console.error(l), D("error", l.message);
|
|
330
330
|
}), n();
|
|
331
331
|
})), In = (t) => {
|
|
332
|
-
var s,
|
|
332
|
+
var s, c, l;
|
|
333
333
|
if (be(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(i != null && i.id))
|
|
334
334
|
return;
|
|
335
|
-
const n = ((
|
|
335
|
+
const n = ((c = e.data) == null ? void 0 : c.id) || "";
|
|
336
336
|
let o = [], r = /* @__PURE__ */ new Set();
|
|
337
337
|
(l = ne[n]) == null || l.forEach((v) => {
|
|
338
338
|
r.has(v.id) || (o.push(v), r.add(v.id));
|
|
339
339
|
}), be(!0), Ae(t, o);
|
|
340
340
|
};
|
|
341
|
-
|
|
341
|
+
N(() => {
|
|
342
342
|
if (!Le || !e)
|
|
343
343
|
return;
|
|
344
344
|
const t = Le, n = () => $(void 0, null, function* () {
|
|
@@ -370,21 +370,21 @@ ${e}` : e;
|
|
|
370
370
|
};
|
|
371
371
|
}, [Le, e]);
|
|
372
372
|
const Ae = (t, n) => $(void 0, null, function* () {
|
|
373
|
-
var u,
|
|
373
|
+
var u, E, C;
|
|
374
374
|
const o = (u = e == null ? void 0 : e.data) == null ? void 0 : u.id;
|
|
375
375
|
if (!o)
|
|
376
376
|
return;
|
|
377
377
|
q(!0), V(!0);
|
|
378
378
|
const r = Be(t, J, n, (i == null ? void 0 : i.type) || 0);
|
|
379
379
|
let s;
|
|
380
|
-
if (i.type ===
|
|
380
|
+
if (i.type === S.Agent)
|
|
381
381
|
s = void 0;
|
|
382
|
-
else if (i.type ===
|
|
382
|
+
else if (i.type === S.Dialog && ((E = i.arrange) != null && E.length) && i.arrange[0].visionOpen) {
|
|
383
383
|
const m = J && J.length ? J.filter(Boolean) : [];
|
|
384
384
|
s = m.length ? m : void 0;
|
|
385
385
|
} else
|
|
386
386
|
s = void 0;
|
|
387
|
-
const
|
|
387
|
+
const c = new he(
|
|
388
388
|
r,
|
|
389
389
|
o,
|
|
390
390
|
ae.User,
|
|
@@ -392,35 +392,35 @@ ${e}` : e;
|
|
|
392
392
|
s
|
|
393
393
|
// 新增:传入图片内容
|
|
394
394
|
);
|
|
395
|
-
me(void 0), te(void 0), y.current = [
|
|
395
|
+
me(void 0), te(void 0), y.current = [c, ...w], L(y.current), i.id && ye && ye({
|
|
396
396
|
applicationId: i.id,
|
|
397
397
|
sessionId: o,
|
|
398
|
-
message:
|
|
398
|
+
message: c
|
|
399
399
|
});
|
|
400
400
|
const l = new he("", o, ae.System);
|
|
401
401
|
l.isWaiting = !0, y.current = [l, ...y.current], L(y.current);
|
|
402
|
-
const v = (n == null ? void 0 : n.map((m) => m.id)) || [],
|
|
402
|
+
const v = (n == null ? void 0 : n.map((m) => m.id)) || [], d = {
|
|
403
403
|
stream: ei.stream,
|
|
404
404
|
referenceFirst: !1
|
|
405
405
|
};
|
|
406
406
|
if (f != null && f.promptVariables) {
|
|
407
|
-
const m =
|
|
408
|
-
|
|
407
|
+
const m = H == null ? void 0 : H.reduce((B, oe) => (B[oe.key] = oe.value, B), {});
|
|
408
|
+
d.formatValues = m;
|
|
409
409
|
}
|
|
410
410
|
if (f != null && f.knowledges) {
|
|
411
411
|
const m = mn;
|
|
412
|
-
|
|
412
|
+
d.knowledges = m;
|
|
413
413
|
}
|
|
414
|
-
const
|
|
414
|
+
const k = {
|
|
415
415
|
text: r,
|
|
416
416
|
fileIds: v,
|
|
417
417
|
files: n
|
|
418
418
|
};
|
|
419
|
-
s && s.length > 0 && (
|
|
419
|
+
s && s.length > 0 && (k.imageContent = s), yield e.send(k, d), de({
|
|
420
420
|
[o]: []
|
|
421
|
-
}), (
|
|
421
|
+
}), (C = fe.current) == null || C.update(), ve([]), we([]), X(!1);
|
|
422
422
|
});
|
|
423
|
-
|
|
423
|
+
N(() => {
|
|
424
424
|
var v;
|
|
425
425
|
const t = (v = e == null ? void 0 : e.data) == null ? void 0 : v.id;
|
|
426
426
|
if (!t)
|
|
@@ -430,58 +430,58 @@ ${e}` : e;
|
|
|
430
430
|
n = null, o && (L([o, ...y.current]), o = null);
|
|
431
431
|
}, s = () => {
|
|
432
432
|
n !== null && (cancelAnimationFrame(n), n = null, o = null);
|
|
433
|
-
},
|
|
434
|
-
if (!
|
|
433
|
+
}, c = (d) => {
|
|
434
|
+
if (!d.sessionId || d.sessionId && d.sessionId !== Se.current || d.role === ae.User)
|
|
435
435
|
return;
|
|
436
|
-
if (
|
|
436
|
+
if (d.index === -1 && d.code !== 200 && d.code !== 11915 && (s(), V(!1), q(!1), y.current = y.current.filter((E) => !E.isWaiting), L([...y.current]), y.current = [...y.current], d.content)) {
|
|
437
437
|
se.config({
|
|
438
|
-
getContainer: () => (
|
|
438
|
+
getContainer: () => (Y == null ? void 0 : Y.current) || document.body,
|
|
439
439
|
prefixCls: "gbot-notification"
|
|
440
440
|
}), se.error({
|
|
441
|
-
message:
|
|
441
|
+
message: d.content
|
|
442
442
|
}), se.config({
|
|
443
443
|
getContainer: void 0,
|
|
444
444
|
prefixCls: "gbot-notification"
|
|
445
445
|
});
|
|
446
446
|
return;
|
|
447
447
|
}
|
|
448
|
-
const
|
|
449
|
-
if (u.messageId =
|
|
448
|
+
const k = d.actions || [], u = new he(d.content, t, ae.Robot);
|
|
449
|
+
if (u.messageId = d.messageId || _e(), u.reasoningContent = d.reasoningContent, u.searchReference = d.searchReference, u.thinkingSecs = d.thinkingSecs, u.thinkingStatus = d.thinkingStatus, u.actions = k, u.isLoading = !0, u.searchingStatus = d.searchingStatus, y.current = y.current.filter((E) => !E.isWaiting).filter((E) => !E.isReplying), d.index === void 0) {
|
|
450
450
|
o = u, n === null && (n = requestAnimationFrame(r));
|
|
451
451
|
return;
|
|
452
452
|
}
|
|
453
|
-
s(),
|
|
453
|
+
s(), d.code === 11915 && (V(!1), q(!1), u.isLoading = !1, u.content = "请您换个问题问我吧~", u.isSensitive = !0, L([u, ...y.current])), d.index === -2 && (V(!1), q(!1), u.isLoading = !1, u.content = "回答已中止~", u.isSuspend = !0, L([u, ...y.current])), d.index === -1 && (V(!1), q(!1), u.isLoading = !1, u.reference = d.reference, L([u, ...y.current]), i.id && ye && ye({
|
|
454
454
|
applicationId: i.id,
|
|
455
455
|
sessionId: t,
|
|
456
456
|
message: u
|
|
457
|
-
})),
|
|
457
|
+
})), d.index === -3 && (V(!1), q(!1), u.isLoading = !1, u.reference = d.reference, u.relatedQuesion = d.relatedQuesion, L([u, ...y.current]));
|
|
458
458
|
}, l = () => {
|
|
459
|
-
e.addEventListener("message:updated",
|
|
459
|
+
e.addEventListener("message:updated", c);
|
|
460
460
|
};
|
|
461
|
-
return e.ready ? e.addEventListener("message:updated",
|
|
462
|
-
s(), e == null || e.removeEventListener("message:updated",
|
|
461
|
+
return e.ready ? e.addEventListener("message:updated", c) : e.addEventListener("ready", l), () => {
|
|
462
|
+
s(), e == null || e.removeEventListener("message:updated", c), e == null || e.removeEventListener("ready", l);
|
|
463
463
|
};
|
|
464
|
-
}, [e]),
|
|
464
|
+
}, [e]), N(() => {
|
|
465
465
|
if (!e) {
|
|
466
|
-
|
|
466
|
+
Te(!1);
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
const t = (n) => {
|
|
470
|
-
|
|
470
|
+
Te(n);
|
|
471
471
|
};
|
|
472
|
-
return
|
|
472
|
+
return Te(e.frozen), e.addEventListener("frozen", t), () => {
|
|
473
473
|
e == null || e.removeEventListener("frozen", t);
|
|
474
474
|
};
|
|
475
|
-
}, [e]),
|
|
475
|
+
}, [e]), N(() => {
|
|
476
476
|
if (!P)
|
|
477
477
|
return;
|
|
478
478
|
const t = P.questionContextMaxLength || 4e3;
|
|
479
479
|
tn(t);
|
|
480
|
-
}, [P,
|
|
480
|
+
}, [P, M]), N(() => {
|
|
481
481
|
Pe && te(Pe.text);
|
|
482
482
|
}, [Pe]);
|
|
483
|
-
const
|
|
484
|
-
si(
|
|
483
|
+
const D = (t, n, o) => {
|
|
484
|
+
si(Y, () => {
|
|
485
485
|
Zn.open({
|
|
486
486
|
type: t,
|
|
487
487
|
content: n,
|
|
@@ -490,46 +490,46 @@ ${e}` : e;
|
|
|
490
490
|
});
|
|
491
491
|
}, ft = (t) => {
|
|
492
492
|
const n = t.size;
|
|
493
|
-
return n <= 0 ? (
|
|
494
|
-
},
|
|
493
|
+
return n <= 0 ? (D("error", "该文件为空,请重新上传"), !1) : n > Ve * ti ? (D("error", `图片须小于${Ve}M`), !1) : (ve((o) => o.length >= Z ? (D("warning", `图片最多上传${Z}张`), o) : [...o, t]), !1);
|
|
494
|
+
}, En = () => {
|
|
495
495
|
var t;
|
|
496
|
-
return (i.type ===
|
|
497
|
-
},
|
|
498
|
-
var
|
|
496
|
+
return (i.type === S.Agent && (f == null ? void 0 : f.imageUpload) || i.type === S.Dialog && ((t = i.arrange) == null ? void 0 : t.length) && !!i.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && !F;
|
|
497
|
+
}, Nn = () => !!z && (f == null ? void 0 : f.fileUpload) && (i == null ? void 0 : i.id) && !F, gt = (t) => {
|
|
498
|
+
var E, C;
|
|
499
499
|
const n = Array.from(t || []).filter(Boolean);
|
|
500
500
|
if (!n.length)
|
|
501
501
|
return;
|
|
502
|
-
const o =
|
|
503
|
-
let l = 0, v = 0,
|
|
502
|
+
const o = En(), r = Nn(), s = [], c = [];
|
|
503
|
+
let l = 0, v = 0, d = 0;
|
|
504
504
|
n.forEach((m) => {
|
|
505
|
-
var At,
|
|
505
|
+
var At, Mt, Ht;
|
|
506
506
|
if (((At = m.type) == null ? void 0 : At.startsWith("image/")) || !!Bt(m.name)) {
|
|
507
507
|
o ? s.push(m) : l++;
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
const oe = (
|
|
510
|
+
const oe = (Ht = (Mt = m.name) == null ? void 0 : Mt.split(".").pop()) == null ? void 0 : Ht.toLowerCase();
|
|
511
511
|
if (oi.includes(m.type) || ["pdf", "doc", "docx"].includes(oe || "")) {
|
|
512
|
-
r ?
|
|
512
|
+
r ? c.push(m) : v++;
|
|
513
513
|
return;
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
d++;
|
|
516
516
|
});
|
|
517
|
-
const
|
|
517
|
+
const k = [], u = l + v + d;
|
|
518
518
|
if (!r && !o)
|
|
519
|
-
u &&
|
|
519
|
+
u && k.push(`当前不支持上传文件/图片,已忽略${u}个文件`);
|
|
520
520
|
else if (r && !o) {
|
|
521
|
-
const m = l +
|
|
522
|
-
m &&
|
|
521
|
+
const m = l + d;
|
|
522
|
+
m && k.push(`仅支持上传 .doc/.docx/.pdf 文件,已忽略${m}个其他类型文件`);
|
|
523
523
|
} else if (!r && o) {
|
|
524
|
-
const m = v +
|
|
525
|
-
m &&
|
|
524
|
+
const m = v + d;
|
|
525
|
+
m && k.push(`仅支持上传图片(.jpg/.jpeg/.png/.bmp),已忽略${m}个其他类型文件`);
|
|
526
526
|
} else
|
|
527
|
-
|
|
528
|
-
if (
|
|
527
|
+
d && k.push(`存在不支持的文件类型,已忽略${d}个文件`);
|
|
528
|
+
if (k.length && D("warning", k.join(";"), "precheck-warn"), s.length) {
|
|
529
529
|
const m = Math.max(0, Z - ce.length), B = s.slice(0, m);
|
|
530
|
-
B.forEach((oe) => ft(oe)), s.length > B.length &&
|
|
530
|
+
B.forEach((oe) => ft(oe)), s.length > B.length && D("warning", `最多上传${Z}张图片`);
|
|
531
531
|
}
|
|
532
|
-
|
|
532
|
+
c.length && ((C = (E = fe.current) == null ? void 0 : E.appendFiles) == null || C.call(E, c));
|
|
533
533
|
}, ut = (t) => {
|
|
534
534
|
var o;
|
|
535
535
|
const n = (o = t.clipboardData) == null ? void 0 : o.files;
|
|
@@ -544,11 +544,11 @@ ${e}` : e;
|
|
|
544
544
|
}, mt = () => $(void 0, null, function* () {
|
|
545
545
|
var t;
|
|
546
546
|
return (t = e == null ? void 0 : e.data) != null && t.id ? e : (ie.current || (ie.current = new Promise((n, o) => {
|
|
547
|
-
Q(!0),
|
|
548
|
-
netOpen:
|
|
547
|
+
Q(!0), I == null || I({
|
|
548
|
+
netOpen: T ? le.OPEN : le.CLOSE
|
|
549
549
|
}).then((r) => {
|
|
550
|
-
var s,
|
|
551
|
-
|
|
550
|
+
var s, c;
|
|
551
|
+
x == null || x(r), Q(!1), R(!!((s = r.data) != null && s.netOpen)), pe(!!((c = r.data) != null && c.enableNetOpen)), Ue(r), n(r);
|
|
552
552
|
}).catch((r) => {
|
|
553
553
|
ie.current = null, o(r);
|
|
554
554
|
});
|
|
@@ -559,26 +559,26 @@ ${e}` : e;
|
|
|
559
559
|
}), Pn = (t, n) => {
|
|
560
560
|
const o = Bt(n.name);
|
|
561
561
|
return new Promise((r) => {
|
|
562
|
-
var
|
|
562
|
+
var c;
|
|
563
563
|
const s = {
|
|
564
564
|
files: [`${_e()}.${o}`],
|
|
565
565
|
isv: "minio",
|
|
566
|
-
knowledgeId: ((
|
|
566
|
+
knowledgeId: ((c = t.data) == null ? void 0 : c.id) || "",
|
|
567
567
|
type: 1
|
|
568
568
|
};
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
var u,
|
|
572
|
-
const v = (u = l.minio.endpoints) == null ? void 0 : u[0],
|
|
573
|
-
r(`${l.minio.useSSL ? "https:" : location.protocol}//${v}/${
|
|
569
|
+
M == null || M.postTicket(s).then((l) => {
|
|
570
|
+
M.uploadMinioFile(l.minio, n).then(() => {
|
|
571
|
+
var u, E;
|
|
572
|
+
const v = (u = l.minio.endpoints) == null ? void 0 : u[0], d = l.minio.bucket, k = (E = l.minio.fileKeys) == null ? void 0 : E[0];
|
|
573
|
+
r(`${l.minio.useSSL ? "https:" : location.protocol}//${v}/${d}/${k}`);
|
|
574
574
|
}).catch(() => {
|
|
575
575
|
});
|
|
576
576
|
}).catch(() => {
|
|
577
577
|
});
|
|
578
578
|
});
|
|
579
579
|
};
|
|
580
|
-
|
|
581
|
-
const t =
|
|
580
|
+
N(() => {
|
|
581
|
+
const t = O.current;
|
|
582
582
|
t && !it && t.scrollTo({
|
|
583
583
|
top: t.scrollHeight
|
|
584
584
|
});
|
|
@@ -589,27 +589,27 @@ ${e}` : e;
|
|
|
589
589
|
const r = $e(je({}, n.file), {
|
|
590
590
|
type: 1
|
|
591
591
|
});
|
|
592
|
-
|
|
592
|
+
M == null || M.postApplicationIdSessionKnowledgeSessionFile(i == null ? void 0 : i.id, t, r).finally(() => {
|
|
593
593
|
var s;
|
|
594
594
|
(s = fe.current) == null || s.update().finally(o);
|
|
595
595
|
});
|
|
596
|
-
}),
|
|
596
|
+
}), Dn = () => {
|
|
597
597
|
var t;
|
|
598
598
|
(t = e == null ? void 0 : e.data) != null && t.id && (V(!1), e.suspend());
|
|
599
|
-
},
|
|
600
|
-
const n =
|
|
599
|
+
}, Tn = (t) => {
|
|
600
|
+
const n = O.current;
|
|
601
601
|
n && setTimeout(() => {
|
|
602
602
|
n.scrollTo({
|
|
603
603
|
top: n.scrollHeight,
|
|
604
604
|
behavior: t == null ? void 0 : t.behavior
|
|
605
605
|
});
|
|
606
606
|
}, t == null ? void 0 : t.ms);
|
|
607
|
-
},
|
|
608
|
-
if (!
|
|
607
|
+
}, Rn = () => {
|
|
608
|
+
if (!O.current)
|
|
609
609
|
return;
|
|
610
|
-
const t =
|
|
610
|
+
const t = O.current.scrollTop <= -80;
|
|
611
611
|
hn(t);
|
|
612
|
-
},
|
|
612
|
+
}, On = ze((t) => {
|
|
613
613
|
var n, o;
|
|
614
614
|
(n = ke.current) == null || n.update(t), (o = ke.current) == null || o.focus();
|
|
615
615
|
}), Fn = ze((t) => {
|
|
@@ -622,9 +622,9 @@ ${e}` : e;
|
|
|
622
622
|
const t = new he("", e.data.id, ae.System);
|
|
623
623
|
t.isWaiting = !0, y.current = [t, ...y.current], L(y.current), q(!0), V(!0), e.answerAgain();
|
|
624
624
|
});
|
|
625
|
-
|
|
625
|
+
N(() => {
|
|
626
626
|
var t, n;
|
|
627
|
-
|
|
627
|
+
Se.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !ot && ((n = Re.current) == null || n.clear());
|
|
628
628
|
}, [e]);
|
|
629
629
|
const An = () => {
|
|
630
630
|
var o;
|
|
@@ -642,68 +642,82 @@ ${e}` : e;
|
|
|
642
642
|
}
|
|
643
643
|
s.length < 10 ? ue(!1) : ue(!0), L([...w, ...s.reverse()]);
|
|
644
644
|
});
|
|
645
|
-
},
|
|
645
|
+
}, Mn = (t) => $(void 0, null, function* () {
|
|
646
646
|
var n, o;
|
|
647
647
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
648
|
-
|
|
648
|
+
R(t);
|
|
649
649
|
else {
|
|
650
650
|
if (yield e.setNetOpen(t), !((o = e.data) != null && o.id))
|
|
651
651
|
return;
|
|
652
|
-
|
|
652
|
+
R(t);
|
|
653
653
|
}
|
|
654
|
-
}),
|
|
654
|
+
}), Me = () => $(void 0, null, function* () {
|
|
655
655
|
e ? e.fetchData().then((t) => {
|
|
656
656
|
var n;
|
|
657
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (
|
|
658
|
-
}) : (
|
|
657
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (R(t.netOpen), pe(t.enableNetOpen));
|
|
658
|
+
}) : (R(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), pe(i.arrange[0].enableNetOpen));
|
|
659
659
|
});
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}, [e]),
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
660
|
+
N(() => {
|
|
661
|
+
Me();
|
|
662
|
+
}, [e]), N(() => {
|
|
663
|
+
let t = null, n = null;
|
|
664
|
+
const o = () => {
|
|
665
|
+
var k, u;
|
|
666
|
+
if (!O.current)
|
|
667
|
+
return;
|
|
668
|
+
const s = document.getElementById("chat-main"), c = (k = O.current) == null ? void 0 : k.querySelector(".infinite-scroll-component__outerdiv"), l = (u = O.current) == null ? void 0 : u.querySelector(".infinite-scroll-component");
|
|
669
|
+
if (!c || !l || !s)
|
|
670
|
+
return;
|
|
671
|
+
const v = s.offsetHeight;
|
|
672
|
+
if (l.offsetHeight <= v) {
|
|
673
|
+
if (c.style.height === "100%")
|
|
668
674
|
return;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
} else {
|
|
675
|
-
if (s.style.height === "auto")
|
|
676
|
-
return;
|
|
677
|
-
s.style.height = "auto";
|
|
678
|
-
}
|
|
675
|
+
c.style.height = "100%";
|
|
676
|
+
} else {
|
|
677
|
+
if (c.style.height === "auto")
|
|
678
|
+
return;
|
|
679
|
+
c.style.height = "auto";
|
|
679
680
|
}
|
|
680
|
-
})
|
|
681
|
-
|
|
681
|
+
}, r = () => {
|
|
682
|
+
var l;
|
|
683
|
+
if (typeof ResizeObserver == "undefined" || !O.current)
|
|
684
|
+
return;
|
|
685
|
+
const s = document.getElementById("chat-main"), c = (l = O.current) == null ? void 0 : l.querySelector(".infinite-scroll-component");
|
|
686
|
+
!c || !s || (n = new ResizeObserver(() => {
|
|
687
|
+
o();
|
|
688
|
+
}), n.observe(c), n.observe(s));
|
|
689
|
+
};
|
|
690
|
+
return t = requestAnimationFrame(() => {
|
|
691
|
+
o(), r();
|
|
692
|
+
}), () => {
|
|
693
|
+
t !== null && cancelAnimationFrame(t), n == null || n.disconnect();
|
|
694
|
+
};
|
|
695
|
+
}, [w]), N(() => {
|
|
682
696
|
if (e)
|
|
683
697
|
return;
|
|
684
698
|
const t = () => {
|
|
685
|
-
const r = ((P == null ? void 0 : P.promptVariables) || []).filter((s) => s.type ? !(s.type ===
|
|
686
|
-
var v,
|
|
699
|
+
const r = ((P == null ? void 0 : P.promptVariables) || []).filter((s) => s.type ? !(s.type === Ne.User && s.key === "query") && !(s.type === Ne.System && s.key === "datetime") && s.status === 1 : s.key !== "query" && s.status === 1).map((s, c) => {
|
|
700
|
+
var v, d;
|
|
687
701
|
let l = "";
|
|
688
|
-
return typeof (a == null ? void 0 : a.promptVariables) == "object" && (l = ((
|
|
689
|
-
id:
|
|
702
|
+
return typeof (a == null ? void 0 : a.promptVariables) == "object" && (l = ((d = (v = a.promptVariables.default) == null ? void 0 : v.find((k) => k.key === s.key && k.type === s.type)) == null ? void 0 : d.value) || ""), {
|
|
703
|
+
id: c + "",
|
|
690
704
|
key: s.key,
|
|
691
705
|
name: s.name,
|
|
692
706
|
value: l,
|
|
693
707
|
type: s.type
|
|
694
708
|
};
|
|
695
709
|
});
|
|
696
|
-
ge([...r].sort((s,
|
|
710
|
+
ge([...r].sort((s, c) => s.key.localeCompare(c.key)));
|
|
697
711
|
};
|
|
698
712
|
return P != null && P.ready ? t() : P == null || P.addEventListener("ready", t), () => {
|
|
699
713
|
P == null || P.removeEventListener("ready", t);
|
|
700
714
|
};
|
|
701
715
|
}, [e, P, a == null ? void 0 : a.promptVariables]);
|
|
702
|
-
const vt = () =>
|
|
703
|
-
netOpen:
|
|
716
|
+
const vt = () => I == null ? void 0 : I({
|
|
717
|
+
netOpen: T ? le.OPEN : le.CLOSE
|
|
704
718
|
}).then((t) => {
|
|
705
719
|
var n, o;
|
|
706
|
-
return
|
|
720
|
+
return x == null || x(t), Q(!1), R(!!((n = t.data) != null && n.netOpen)), pe(!!((o = t.data) != null && o.enableNetOpen)), Ue(t), t;
|
|
707
721
|
}), wt = !!w.length, kt = Kn(() => {
|
|
708
722
|
var t;
|
|
709
723
|
return i.arrange && ((t = i.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ g(Wt, {
|
|
@@ -724,31 +738,31 @@ ${e}` : e;
|
|
|
724
738
|
markdown: a == null ? void 0 : a.markdown
|
|
725
739
|
}) : null;
|
|
726
740
|
}, [i == null ? void 0 : i.arrange, wt]);
|
|
727
|
-
return
|
|
741
|
+
return Sn(h, () => ({
|
|
728
742
|
getCurrentInputText: () => {
|
|
729
743
|
var t;
|
|
730
744
|
return (t = ke.current) == null ? void 0 : t.getCurrentText();
|
|
731
745
|
}
|
|
732
|
-
})),
|
|
746
|
+
})), N(() => {
|
|
733
747
|
var n;
|
|
734
748
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
735
749
|
t && de((o) => $e(je({}, o), {
|
|
736
750
|
[t]: []
|
|
737
751
|
}));
|
|
738
|
-
}, [(bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id]), /* @__PURE__ */
|
|
752
|
+
}, [(bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id]), /* @__PURE__ */ U("div", {
|
|
739
753
|
className: "agent-chat",
|
|
740
754
|
children: [wn ? /* @__PURE__ */ g("div", {
|
|
741
755
|
className: "session-loading",
|
|
742
756
|
children: /* @__PURE__ */ g($t, {})
|
|
743
|
-
}) : /* @__PURE__ */
|
|
757
|
+
}) : /* @__PURE__ */ U(Bn, {
|
|
744
758
|
children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ g(ui, {
|
|
745
759
|
ref: et,
|
|
746
760
|
appId: i.id,
|
|
747
761
|
currentSession: e,
|
|
748
|
-
promptVariables:
|
|
762
|
+
promptVariables: H,
|
|
749
763
|
setPromptVariables: ge,
|
|
750
|
-
setCurrentSession:
|
|
751
|
-
}), /* @__PURE__ */
|
|
764
|
+
setCurrentSession: x
|
|
765
|
+
}), /* @__PURE__ */ U("div", {
|
|
752
766
|
className: "chat-main",
|
|
753
767
|
id: "chat-main",
|
|
754
768
|
style: Xt,
|
|
@@ -761,9 +775,9 @@ ${e}` : e;
|
|
|
761
775
|
display: "flex",
|
|
762
776
|
flexDirection: "column-reverse"
|
|
763
777
|
},
|
|
764
|
-
ref:
|
|
765
|
-
onScroll:
|
|
766
|
-
children: (xt = e == null ? void 0 : e.data) != null && xt.id && (w != null && w.length) ? /* @__PURE__ */
|
|
778
|
+
ref: O,
|
|
779
|
+
onScroll: Rn,
|
|
780
|
+
children: (xt = e == null ? void 0 : e.data) != null && xt.id && (w != null && w.length) ? /* @__PURE__ */ U(mi, {
|
|
767
781
|
dataLength: w.length,
|
|
768
782
|
next: An,
|
|
769
783
|
style: {
|
|
@@ -773,7 +787,7 @@ ${e}` : e;
|
|
|
773
787
|
},
|
|
774
788
|
inverse: !0,
|
|
775
789
|
endMessage: w.length > qt && // 少于一页不展示这个提示
|
|
776
|
-
((Ct =
|
|
790
|
+
((Ct = O.current) != null && Ct.scrollTop) && ((It = O.current) == null ? void 0 : It.scrollTop) < -10 ? /* @__PURE__ */ g(Yn, {
|
|
777
791
|
plain: !0,
|
|
778
792
|
children: "没有更多数据了"
|
|
779
793
|
}) : null,
|
|
@@ -791,21 +805,21 @@ ${e}` : e;
|
|
|
791
805
|
application: i,
|
|
792
806
|
currentSession: e,
|
|
793
807
|
history: t,
|
|
794
|
-
docViewerUrl:
|
|
808
|
+
docViewerUrl: A,
|
|
795
809
|
isLastHistory: n === 0,
|
|
796
810
|
onRelatedClick: Fn,
|
|
797
811
|
onAgainClick: Un,
|
|
798
|
-
onEditClick:
|
|
812
|
+
onEditClick: On,
|
|
799
813
|
markdown: a == null ? void 0 : a.markdown
|
|
800
814
|
}, t.messageId + n)), !st && kt]
|
|
801
|
-
}) : /* @__PURE__ */
|
|
815
|
+
}) : /* @__PURE__ */ U("div", {
|
|
802
816
|
className: "main-empty",
|
|
803
817
|
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ g(li, {
|
|
804
818
|
text: (
|
|
805
819
|
// 第一优先级:features配置
|
|
806
820
|
a != null && a.greeting && typeof a.greeting == "object" && a.greeting.text !== void 0 ? a.greeting.text : (
|
|
807
821
|
// 第二优先级:application.arrange[0].greetings
|
|
808
|
-
(
|
|
822
|
+
(Et = i.arrange) != null && Et.length && ((Nt = i.arrange[0]) != null && Nt.greetings) ? i.arrange[0].greetings : (
|
|
809
823
|
// 第三优先级:默认文本
|
|
810
824
|
_t.text
|
|
811
825
|
)
|
|
@@ -813,7 +827,7 @@ ${e}` : e;
|
|
|
813
827
|
),
|
|
814
828
|
icon: a === void 0 || a.greeting === !0 || ((Lt = a.greeting) == null ? void 0 : Lt.icon) === void 0 ? Gt || _t.icon : a.greeting.icon,
|
|
815
829
|
children: !!Ge.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__ */ g(ai, {
|
|
816
|
-
ref:
|
|
830
|
+
ref: Re,
|
|
817
831
|
sid: (Pt = e == null ? void 0 : e.data) == null ? void 0 : Pt.id,
|
|
818
832
|
isRecommendClearing: Ze,
|
|
819
833
|
data: Ge,
|
|
@@ -825,12 +839,12 @@ ${e}` : e;
|
|
|
825
839
|
t != null && t.id && ee(!0);
|
|
826
840
|
const n = (o = e == null ? void 0 : e.data) == null ? void 0 : o.id;
|
|
827
841
|
f != null && f.fileUpload ? (s = (r = fe.current) == null ? void 0 : r.clear()) == null || s.then(() => {
|
|
828
|
-
var
|
|
829
|
-
t != null && t.id && (n ? (
|
|
842
|
+
var c, l;
|
|
843
|
+
t != null && t.id && (n ? (c = yt(n, t)) == null || c.finally(() => {
|
|
830
844
|
ee(!1);
|
|
831
845
|
}) : (ee(!1), Q(!0), (l = vt()) == null || l.then((v) => {
|
|
832
|
-
var
|
|
833
|
-
(
|
|
846
|
+
var d;
|
|
847
|
+
(d = yt(v.id, t)) == null || d.finally(() => {
|
|
834
848
|
ee(!1);
|
|
835
849
|
});
|
|
836
850
|
})));
|
|
@@ -854,14 +868,14 @@ ${e}` : e;
|
|
|
854
868
|
fontSize: 16
|
|
855
869
|
}
|
|
856
870
|
}),
|
|
857
|
-
onClick: () =>
|
|
871
|
+
onClick: () => Dn(),
|
|
858
872
|
children: "停止回答"
|
|
859
873
|
})
|
|
860
874
|
}), it && (w == null ? void 0 : w.length) > 0 && /* @__PURE__ */ g("div", {
|
|
861
875
|
className: "back-bottom",
|
|
862
876
|
children: /* @__PURE__ */ g(G, {
|
|
863
877
|
size: "small",
|
|
864
|
-
onClick: () =>
|
|
878
|
+
onClick: () => Tn({
|
|
865
879
|
behavior: "smooth"
|
|
866
880
|
}),
|
|
867
881
|
type: "link",
|
|
@@ -875,7 +889,7 @@ ${e}` : e;
|
|
|
875
889
|
})]
|
|
876
890
|
}), /* @__PURE__ */ g("div", {
|
|
877
891
|
className: "chat-footer",
|
|
878
|
-
children: /* @__PURE__ */
|
|
892
|
+
children: /* @__PURE__ */ U("div", {
|
|
879
893
|
className: "chat-footer-input",
|
|
880
894
|
children: [ce.length > 0 && /* @__PURE__ */ g("div", {
|
|
881
895
|
className: "input-files",
|
|
@@ -902,15 +916,15 @@ ${e}` : e;
|
|
|
902
916
|
});
|
|
903
917
|
}
|
|
904
918
|
}, n))
|
|
905
|
-
}), /* @__PURE__ */
|
|
919
|
+
}), /* @__PURE__ */ U("div", {
|
|
906
920
|
className: "footer-upload-action-wrapper",
|
|
907
|
-
children: [/* @__PURE__ */
|
|
921
|
+
children: [/* @__PURE__ */ U(Ee, {
|
|
908
922
|
className: "footer-upload-action",
|
|
909
923
|
onClick: (t) => t.preventDefault(),
|
|
910
|
-
children: [/* @__PURE__ */
|
|
911
|
-
children: [(i.type ===
|
|
924
|
+
children: [/* @__PURE__ */ U(Ee, {
|
|
925
|
+
children: [(i.type === S.Agent && (f == null ? void 0 : f.imageUpload) || i.type === S.Dialog && ((Dt = i.arrange) == null ? void 0 : Dt.length) && !!i.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && /* @__PURE__ */ g(Qn, {
|
|
912
926
|
multiple: !0,
|
|
913
|
-
disabled: ce.length >= Z ||
|
|
927
|
+
disabled: ce.length >= Z || F,
|
|
914
928
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
915
929
|
listType: "picture-card",
|
|
916
930
|
beforeUpload: ft,
|
|
@@ -960,16 +974,16 @@ ${e}` : e;
|
|
|
960
974
|
appId: i == null ? void 0 : i.id,
|
|
961
975
|
ref: fe,
|
|
962
976
|
isFirstSession: ot,
|
|
963
|
-
docViewerUrl:
|
|
977
|
+
docViewerUrl: A,
|
|
964
978
|
onStatusChange: (t) => $(void 0, null, function* () {
|
|
965
|
-
t !== "process" ? (be(!0),
|
|
979
|
+
t !== "process" ? (be(!0), Me()) : be(!1);
|
|
966
980
|
}),
|
|
967
981
|
createSession: () => mt().then((t) => {
|
|
968
982
|
var o;
|
|
969
983
|
return ((o = t.data) == null ? void 0 : o.id) || "";
|
|
970
984
|
}),
|
|
971
|
-
sid: (
|
|
972
|
-
disabled:
|
|
985
|
+
sid: (Tt = e == null ? void 0 : e.data) == null ? void 0 : Tt.id,
|
|
986
|
+
disabled: Oe || F,
|
|
973
987
|
afterFileAdd: (t, n) => {
|
|
974
988
|
n && de((o) => {
|
|
975
989
|
const r = o[n] || [];
|
|
@@ -984,7 +998,7 @@ ${e}` : e;
|
|
|
984
998
|
n && de((r) => {
|
|
985
999
|
const s = r[n] || [];
|
|
986
1000
|
return {
|
|
987
|
-
[n]: s.filter((
|
|
1001
|
+
[n]: s.filter((c) => c.id !== t)
|
|
988
1002
|
};
|
|
989
1003
|
});
|
|
990
1004
|
},
|
|
@@ -997,7 +1011,7 @@ ${e}` : e;
|
|
|
997
1011
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
998
1012
|
t && (de({
|
|
999
1013
|
[t]: []
|
|
1000
|
-
}),
|
|
1014
|
+
}), Me());
|
|
1001
1015
|
}
|
|
1002
1016
|
}) : null, (f == null ? void 0 : f.prompt) && (i == null ? void 0 : i.id) && /* @__PURE__ */ g(vi, {
|
|
1003
1017
|
appId: i.id,
|
|
@@ -1006,23 +1020,23 @@ ${e}` : e;
|
|
|
1006
1020
|
onPromptSelect: (t) => {
|
|
1007
1021
|
te(t.context), me(t.context);
|
|
1008
1022
|
},
|
|
1009
|
-
disabled:
|
|
1023
|
+
disabled: F
|
|
1010
1024
|
})]
|
|
1011
|
-
}), /* @__PURE__ */
|
|
1012
|
-
children: [(f == null ? void 0 : f.connectNetwork) && i.type ===
|
|
1013
|
-
sessionId: (
|
|
1014
|
-
netStatus:
|
|
1025
|
+
}), /* @__PURE__ */ U(Ee, {
|
|
1026
|
+
children: [(f == null ? void 0 : f.connectNetwork) && i.type === S.Dialog && ((Rt = i.arrange) == null ? void 0 : Rt.length) && !!i.arrange[0].enableNetOpen && /* @__PURE__ */ g(yi, {
|
|
1027
|
+
sessionId: (Ot = e == null ? void 0 : e.data) == null ? void 0 : Ot.id,
|
|
1028
|
+
netStatus: T,
|
|
1015
1029
|
enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : vn,
|
|
1016
1030
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
1017
1031
|
onNetStatusChange: (t) => {
|
|
1018
|
-
|
|
1032
|
+
Mn(t);
|
|
1019
1033
|
}
|
|
1020
1034
|
}), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ g(pi, {
|
|
1021
1035
|
currentSessionId: (Ft = e == null ? void 0 : e.data) == null ? void 0 : Ft.id,
|
|
1022
1036
|
onSessionChange: (t, n) => {
|
|
1023
|
-
te(void 0), Ie(!0),
|
|
1037
|
+
te(void 0), Ie(!0), x == null || x(n);
|
|
1024
1038
|
},
|
|
1025
|
-
disabled:
|
|
1039
|
+
disabled: F
|
|
1026
1040
|
}), Zt && Jt === "float" && /* @__PURE__ */ g("div", {
|
|
1027
1041
|
className: "session-history-drawer-component",
|
|
1028
1042
|
children: /* @__PURE__ */ g(Gn, {
|
|
@@ -1036,7 +1050,7 @@ ${e}` : e;
|
|
|
1036
1050
|
content: "会话历史记录",
|
|
1037
1051
|
children: /* @__PURE__ */ g(G, {
|
|
1038
1052
|
className: "history-overlay-action",
|
|
1039
|
-
disabled:
|
|
1053
|
+
disabled: F,
|
|
1040
1054
|
type: "text",
|
|
1041
1055
|
icon: /* @__PURE__ */ g(re, {
|
|
1042
1056
|
type: "icon-lishijilu",
|
|
@@ -1051,10 +1065,10 @@ ${e}` : e;
|
|
|
1051
1065
|
icon: /* @__PURE__ */ g(di, {}),
|
|
1052
1066
|
className: "add-btn",
|
|
1053
1067
|
type: "primary",
|
|
1054
|
-
disabled: nt || !e || !w.length ||
|
|
1068
|
+
disabled: nt || !e || !w.length || F,
|
|
1055
1069
|
onClick: () => {
|
|
1056
1070
|
var t, n;
|
|
1057
|
-
Ie(!1),
|
|
1071
|
+
Ie(!1), x == null || x(null), ie.current = null, R(!1), (t = et.current) == null || t.clear(), (n = Re.current) == null || n.clear();
|
|
1058
1072
|
},
|
|
1059
1073
|
children: "新会话"
|
|
1060
1074
|
})]
|
|
@@ -1062,7 +1076,7 @@ ${e}` : e;
|
|
|
1062
1076
|
}), !!Fe && /* @__PURE__ */ g("div", {
|
|
1063
1077
|
className: "remainingSeconds-mark"
|
|
1064
1078
|
})]
|
|
1065
|
-
}), /* @__PURE__ */
|
|
1079
|
+
}), /* @__PURE__ */ U("div", {
|
|
1066
1080
|
className: "footer-textarea",
|
|
1067
1081
|
onPaste: ut,
|
|
1068
1082
|
onPasteCapture: ut,
|
|
@@ -1076,18 +1090,18 @@ ${e}` : e;
|
|
|
1076
1090
|
text: ln,
|
|
1077
1091
|
networkStatus: !1,
|
|
1078
1092
|
loading: rt || Ce,
|
|
1079
|
-
disabled: Ke || Xe ||
|
|
1093
|
+
disabled: Ke || Xe || F || rt || Ce,
|
|
1080
1094
|
onTextSend: dt,
|
|
1081
1095
|
onChange: (t, n) => {
|
|
1082
1096
|
te(t);
|
|
1083
1097
|
const o = n.getText().replace(/[\n\s]+$/, "");
|
|
1084
1098
|
me(o), an(o), Je || sn(!0);
|
|
1085
1099
|
},
|
|
1086
|
-
clearAction: /* @__PURE__ */ g(
|
|
1100
|
+
clearAction: /* @__PURE__ */ g(Ee, {
|
|
1087
1101
|
size: 0,
|
|
1088
1102
|
children: /* @__PURE__ */ g(G, {
|
|
1089
1103
|
type: "link",
|
|
1090
|
-
disabled:
|
|
1104
|
+
disabled: Oe || F,
|
|
1091
1105
|
ghost: !0,
|
|
1092
1106
|
icon: /* @__PURE__ */ g(re, {
|
|
1093
1107
|
style: {
|
|
@@ -1098,7 +1112,7 @@ ${e}` : e;
|
|
|
1098
1112
|
onClick: () => Cn()
|
|
1099
1113
|
})
|
|
1100
1114
|
})
|
|
1101
|
-
}), !!Fe && /* @__PURE__ */
|
|
1115
|
+
}), !!Fe && /* @__PURE__ */ U("div", {
|
|
1102
1116
|
className: "remainingSeconds-time",
|
|
1103
1117
|
children: ["您之前对话触发敏感词拦截,当前处于禁言状态,暂时无法发送消息,剩余禁言时长", Fe]
|
|
1104
1118
|
})]
|
|
@@ -1117,9 +1131,9 @@ ${e}` : e;
|
|
|
1117
1131
|
}), at && /* @__PURE__ */ g(hi, {
|
|
1118
1132
|
currentSession: e,
|
|
1119
1133
|
application: i,
|
|
1120
|
-
networkStatus:
|
|
1121
|
-
setCurrentSession:
|
|
1122
|
-
disabled:
|
|
1134
|
+
networkStatus: T,
|
|
1135
|
+
setCurrentSession: x,
|
|
1136
|
+
disabled: F,
|
|
1123
1137
|
isSessionHistoryVisible: at,
|
|
1124
1138
|
setIsSessionHistoryVisible: lt,
|
|
1125
1139
|
onSessionChange: (t) => {
|