@glodon-aiot/agent-cli-ui 3.15.0-alpha.2 → 3.15.0
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 +391 -397
- package/dist/es/packages/agent-cli-ui/package.json.mjs +11 -11
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/style10.css +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style17.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/style22.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/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/style31.css +1 -1
- package/dist/es/src/style33.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +42 -42
- package/package.json +3 -3
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
var Fn = Object.defineProperty, Hn = Object.defineProperties;
|
|
2
2
|
var An = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var Ht = Object.getOwnPropertySymbols;
|
|
4
4
|
var Mn = Object.prototype.hasOwnProperty, jn = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var He = (x, h, o) => h in x ? Fn(x, h, { enumerable: !0, configurable: !0, writable: !0, value: o }) : x[h] = o, Ae = (x, h) => {
|
|
6
6
|
for (var o in h || (h = {}))
|
|
7
7
|
Mn.call(h, o) && He(x, o, h[o]);
|
|
8
|
-
if (
|
|
9
|
-
for (var o of
|
|
8
|
+
if (Ht)
|
|
9
|
+
for (var o of Ht(h))
|
|
10
10
|
jn.call(h, o) && He(x, o, h[o]);
|
|
11
11
|
return x;
|
|
12
12
|
}, Me = (x, h) => Hn(x, An(h));
|
|
13
13
|
var A = (x, h, o) => (He(x, typeof h != "symbol" ? h + "" : h, o), o);
|
|
14
14
|
var M = (x, h, o) => new Promise(($, e) => {
|
|
15
|
-
var
|
|
15
|
+
var b = (P) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
e(
|
|
17
|
+
w(o.next(P));
|
|
18
|
+
} catch (T) {
|
|
19
|
+
e(T);
|
|
20
20
|
}
|
|
21
|
-
}, z = (
|
|
21
|
+
}, z = (P) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
e(
|
|
23
|
+
w(o.throw(P));
|
|
24
|
+
} catch (T) {
|
|
25
|
+
e(T);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, w = (P) => P.done ? $(P.value) : Promise.resolve(P.value).then(b, z);
|
|
28
|
+
w((o = o.apply(x, h)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as f, jsxs as
|
|
31
|
-
import { memo as zn, forwardRef as Vn, useState as g, useRef as
|
|
32
|
-
/* empty css */import { message as
|
|
33
|
-
import
|
|
34
|
-
import { IHistoryRole as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
30
|
+
import { jsx as f, jsxs as _, Fragment as $n } from "react/jsx-runtime";
|
|
31
|
+
import { memo as zn, forwardRef as Vn, useState as g, useRef as Y, useContext as Bn, useEffect as I, useMemo as _n, useImperativeHandle as qn } from "react";
|
|
32
|
+
/* empty css */import { message as At, Spin as Mt, Divider as Wn, Button as Z, Space as Ee, Upload as Kn, Tooltip as Yn, Popover as Qn, notification as se } from "antd";
|
|
33
|
+
import re from "../../components/Iconfont/index.mjs";
|
|
34
|
+
import { IHistoryRole as ae, ApplicationTypes as Q, ChatMessageRole as jt, PromptVariableType as Ne } from "@glodon-aiot/apis";
|
|
35
|
+
import _t from "./HistoryItem/index.mjs";
|
|
36
|
+
import qt from "dayjs";
|
|
37
37
|
import { v4 as Ve } from "uuid";
|
|
38
38
|
import Xn from "../../context.mjs";
|
|
39
39
|
import { configuration as Gn } from "@glodon-aiot/bot-client-sdk";
|
|
40
|
-
import { MAX_KNOWLEDGES_AND_FILES_COUNT as
|
|
40
|
+
import { MAX_KNOWLEDGES_AND_FILES_COUNT as $t, NET_OPEN_STATUS as le, MB as Zn } from "../../constant.mjs";
|
|
41
41
|
import Jn from "../../components/FilePreview/index.mjs";
|
|
42
|
-
import { calcKnowledgesLeafCount as Sn, getImageExtension as
|
|
42
|
+
import { calcKnowledgesLeafCount as Sn, getImageExtension as zt, fileTypes as ei } from "../../utils/index.mjs";
|
|
43
43
|
import ti from "../../QuillEditor/index.mjs";
|
|
44
44
|
import ni from "../../components/Recommend/index.mjs";
|
|
45
45
|
import ii from "../../components/Greeting/index.mjs";
|
|
@@ -53,15 +53,15 @@ import ci from "./Tools/SessionListDrawer/index.mjs";
|
|
|
53
53
|
import di from "./Tools/SessionHistoryDrawer/index.mjs";
|
|
54
54
|
import fi from "react-infinite-scroll-component";
|
|
55
55
|
import gi from "./Tools/ConnectToNetwork/index.mjs";
|
|
56
|
-
import
|
|
57
|
-
import { useSessionState as
|
|
56
|
+
import ui from "./Tools/PromptManager/index.mjs";
|
|
57
|
+
import { useSessionState as pi } from "../../hooks/useSessionState.mjs";
|
|
58
58
|
import hi from "../../assets/icon.svg.mjs";
|
|
59
|
-
const mi = zn(
|
|
59
|
+
const mi = zn(_t), Vt = {
|
|
60
60
|
icon: hi,
|
|
61
61
|
text: "今天我能帮你什么?"
|
|
62
62
|
};
|
|
63
63
|
class he {
|
|
64
|
-
constructor(h, o, $, e,
|
|
64
|
+
constructor(h, o, $, e, b) {
|
|
65
65
|
A(this, "messageTime");
|
|
66
66
|
A(this, "isWaiting");
|
|
67
67
|
A(this, "messageId");
|
|
@@ -73,104 +73,104 @@ class he {
|
|
|
73
73
|
A(this, "imageContent");
|
|
74
74
|
// 新增:支持对话型应用的图片内容
|
|
75
75
|
A(this, "comment");
|
|
76
|
-
this.content = h, this.sessionId = o, this.role = $, this.files = e, this.content = h, this.role = $, this.sessionId = o, this.files = e, this.imageContent =
|
|
76
|
+
this.content = h, this.sessionId = o, this.role = $, this.files = e, this.content = h, this.role = $, this.sessionId = o, this.files = e, this.imageContent = b, this.messageTime = qt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Ve(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
77
77
|
isAgree: 0
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const Bt = 10, J = 5, $e = 20, ze = (x, h, o, $) => {
|
|
82
82
|
let e = x;
|
|
83
|
-
if ($ ===
|
|
83
|
+
if ($ === Q.Agent) {
|
|
84
84
|
if (o && o.length > 0) {
|
|
85
|
-
const
|
|
85
|
+
const b = o.map((z) => `[${z.name.replace(/\.[^/.]+$/, "")}](${z.url})`).join(`
|
|
86
86
|
`);
|
|
87
|
-
e =
|
|
87
|
+
e = b ? `${b}
|
|
88
88
|
${e}` : e;
|
|
89
89
|
}
|
|
90
90
|
if (h && h.length > 0) {
|
|
91
|
-
const
|
|
91
|
+
const b = h.filter(Boolean).map((z) => ``).join(`
|
|
92
92
|
`);
|
|
93
|
-
e =
|
|
93
|
+
e = b ? `${b}
|
|
94
94
|
${e}` : e;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
return e;
|
|
98
98
|
}, Xi = Vn((x, h) => {
|
|
99
|
-
var
|
|
99
|
+
var vt, wt, kt, bt, xt, Ct, It, Et, Nt, Lt, Pt, Tt, Dt, Ot;
|
|
100
100
|
const {
|
|
101
101
|
application: o,
|
|
102
102
|
docViewerUrl: $ = "",
|
|
103
103
|
currentSession: e,
|
|
104
|
-
onCreateSession:
|
|
104
|
+
onCreateSession: b,
|
|
105
105
|
embeddingService: z,
|
|
106
|
-
setCurrentSession:
|
|
107
|
-
networkStatus:
|
|
108
|
-
setNetworkStatus:
|
|
109
|
-
} = x, [
|
|
106
|
+
setCurrentSession: w,
|
|
107
|
+
networkStatus: P,
|
|
108
|
+
setNetworkStatus: T
|
|
109
|
+
} = x, [y, E] = g([]), [Wt, me] = g(), [Le, Be] = g(), R = Y(null), {
|
|
110
110
|
service: U,
|
|
111
111
|
agentClient: N,
|
|
112
|
-
depId:
|
|
113
|
-
footer:
|
|
114
|
-
transform:
|
|
115
|
-
defaultInput:
|
|
112
|
+
depId: Kt,
|
|
113
|
+
footer: Yt,
|
|
114
|
+
transform: c,
|
|
115
|
+
defaultInput: Pe,
|
|
116
116
|
onMessage: ye,
|
|
117
117
|
onHistoryLoad: _e,
|
|
118
|
-
beforeMessageSend:
|
|
119
|
-
bodyStyle:
|
|
118
|
+
beforeMessageSend: q,
|
|
119
|
+
bodyStyle: Qt,
|
|
120
120
|
disabled: O,
|
|
121
121
|
features: l,
|
|
122
122
|
popupContainer: j,
|
|
123
|
-
icon:
|
|
124
|
-
sider:
|
|
125
|
-
mode:
|
|
126
|
-
} = Bn(Xn), [qe,
|
|
123
|
+
icon: Xt,
|
|
124
|
+
sider: Gt,
|
|
125
|
+
mode: Zt
|
|
126
|
+
} = Bn(Xn), [qe, Te] = g(!1), m = Y(y), We = Y(void 0), [Jt, St] = g(0), [ce, ve] = g([]), [S, we] = g([]), [Ke, Ye] = g(0), [Qe, en] = g(!1);
|
|
127
127
|
I(() => {
|
|
128
|
-
|
|
128
|
+
en(Ke > 0);
|
|
129
129
|
}, [Ke]);
|
|
130
|
-
const ke =
|
|
130
|
+
const ke = Y(null), [Xe, tn] = g([]), [Ge, ee] = g(!1), [Ze, nn] = g(!1), [on, sn] = g(""), [rn, te] = g(), [ne, de] = g({}), fe = Y(null), Je = Y(null), De = Y(null), [Se, an] = g(!1), [ln, cn] = g([]), [dn, be] = g(!0), [fn, gn] = g(!0), [et, V] = g(!1), [Oe, W] = g(!1), [tt, un] = g(!1), [F, ge] = g(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [pn, hn] = g(() => {
|
|
131
131
|
const t = typeof (l == null ? void 0 : l.knowledges) == "object" && l.knowledges.default || void 0;
|
|
132
132
|
if (t) {
|
|
133
|
-
if (Array.isArray(t) && t.some((
|
|
133
|
+
if (Array.isArray(t) && t.some((a) => Array.isArray(a.fileIds) && a.fileIds.length === 0))
|
|
134
134
|
throw Error("fileIds cannot be an empty array");
|
|
135
|
-
if (Sn(t) >
|
|
136
|
-
throw Error(`knowledges and fileIds total count cannot exceed ${
|
|
135
|
+
if (Sn(t) > $t)
|
|
136
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${$t}`);
|
|
137
137
|
}
|
|
138
138
|
return t;
|
|
139
|
-
}), [nt,
|
|
139
|
+
}), [nt, X] = g(!1), [it, ue] = g(!1), [mn, pe] = g(typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.default) == "boolean" ? l.connectNetwork.default : !1), [ot, xe] = g(!1), [yn, K] = g(!1), [vn, wn] = g(null), [Ce, G] = g(!1), [st, rt] = g(!1), {
|
|
140
140
|
isSwitchingToExistingSession: at,
|
|
141
141
|
setIsSwitchingToExistingSession: Ie
|
|
142
|
-
} =
|
|
142
|
+
} = pi(), ie = Y(null);
|
|
143
143
|
I(() => {
|
|
144
|
-
if (
|
|
145
|
-
|
|
144
|
+
if (wn(e), e === null)
|
|
145
|
+
K(!1);
|
|
146
146
|
else if (e === void 0)
|
|
147
|
-
|
|
147
|
+
K(!0);
|
|
148
148
|
else {
|
|
149
|
-
if (
|
|
149
|
+
if (vn === null) {
|
|
150
150
|
if (at) {
|
|
151
|
-
|
|
151
|
+
K(!0), Ie(!1);
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
K(!1);
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
e.ready ?
|
|
157
|
+
e.ready ? K(!1) : K(!0);
|
|
158
158
|
}
|
|
159
159
|
}, [e, e == null ? void 0 : e.ready, at]), I(() => {
|
|
160
|
-
var s,
|
|
160
|
+
var s, a;
|
|
161
161
|
e && (m.current = []), E([]);
|
|
162
162
|
const t = R.current;
|
|
163
163
|
if (t && t.scrollTo({
|
|
164
164
|
top: 0
|
|
165
165
|
}), !((s = e == null ? void 0 : e.data) != null && s.id))
|
|
166
166
|
return;
|
|
167
|
-
if (
|
|
168
|
-
const
|
|
169
|
-
m.current = [...
|
|
167
|
+
if (W(!1), V(!1), (a = e.messages) != null && a.length) {
|
|
168
|
+
const d = [...e.messages.filter((r) => r == null ? void 0 : r.messageId)].reverse();
|
|
169
|
+
m.current = [...d], E([...d]), K(!1);
|
|
170
170
|
}
|
|
171
171
|
const n = (i) => {
|
|
172
|
-
var
|
|
173
|
-
(
|
|
172
|
+
var d;
|
|
173
|
+
(d = e == null ? void 0 : e.data) != null && d.id && (m.current = [...i].reverse(), E([...i].reverse()), !i || i.length < 10 ? ue(!1) : ue(!0), K(!1), _e && _e({
|
|
174
174
|
applicationId: o.id,
|
|
175
175
|
sessionId: e.data.id,
|
|
176
176
|
histories: i
|
|
@@ -182,7 +182,7 @@ ${e}` : e;
|
|
|
182
182
|
}, [e]), I(() => {
|
|
183
183
|
const t = () => {
|
|
184
184
|
var n;
|
|
185
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables &&
|
|
185
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ge(e.promptVariables.sort((s, a) => s.key.localeCompare(a.key))), e.knowledges && hn(e.knowledges), T(e.netOpen));
|
|
186
186
|
};
|
|
187
187
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
188
188
|
e == null || e.removeEventListener("data:updated", t);
|
|
@@ -192,13 +192,13 @@ ${e}` : e;
|
|
|
192
192
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
193
193
|
return;
|
|
194
194
|
const t = (s) => {
|
|
195
|
-
var
|
|
196
|
-
console.error(s.message, s.cause, "e.case"),
|
|
195
|
+
var a;
|
|
196
|
+
console.error(s.message, s.cause, "e.case"), se.config({
|
|
197
197
|
getContainer: () => (j == null ? void 0 : j.current) || document.body,
|
|
198
198
|
prefixCls: "gbot-notification"
|
|
199
|
-
}),
|
|
200
|
-
message: ((
|
|
201
|
-
}),
|
|
199
|
+
}), se.error({
|
|
200
|
+
message: ((a = s.cause) == null ? void 0 : a.message) || s.message
|
|
201
|
+
}), se.config({
|
|
202
202
|
getContainer: void 0,
|
|
203
203
|
prefixCls: "gbot-notification"
|
|
204
204
|
});
|
|
@@ -207,150 +207,150 @@ ${e}` : e;
|
|
|
207
207
|
e == null || e.removeEventListener("error", t);
|
|
208
208
|
};
|
|
209
209
|
}, [e]);
|
|
210
|
-
const
|
|
210
|
+
const kn = () => {
|
|
211
211
|
var s;
|
|
212
212
|
if (!((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
|
|
213
213
|
return;
|
|
214
|
-
const t = e.data.id, n =
|
|
214
|
+
const t = e.data.id, n = y[y.length - 1];
|
|
215
215
|
if (n && n.isContext) {
|
|
216
|
-
|
|
216
|
+
L("success", "已开启新话题");
|
|
217
217
|
return;
|
|
218
218
|
} else
|
|
219
219
|
e.clear().then(() => {
|
|
220
|
-
const
|
|
221
|
-
|
|
220
|
+
const a = new he("", t, ae.System);
|
|
221
|
+
a.isContext = !0, E([a, ...y]);
|
|
222
222
|
});
|
|
223
223
|
};
|
|
224
224
|
I(() => {
|
|
225
225
|
o != null && o.id && (U == null || U.getRecommendQues(o.id).then((t) => {
|
|
226
|
-
|
|
226
|
+
tn(t);
|
|
227
227
|
}));
|
|
228
|
-
}, [
|
|
228
|
+
}, [Kt, o]);
|
|
229
229
|
const lt = (t) => M(void 0, null, function* () {
|
|
230
230
|
var H, D;
|
|
231
231
|
if (O) {
|
|
232
|
-
|
|
232
|
+
L("error", "发送功能被禁用");
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
|
-
const n = t ||
|
|
235
|
+
const n = t || Wt;
|
|
236
236
|
if (!(n != null && n.trim())) {
|
|
237
|
-
|
|
237
|
+
L("error", "请输入你想问的");
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
if (!(F == null ? void 0 : F.every((
|
|
241
|
-
if (
|
|
242
|
-
|
|
240
|
+
if (!(F == null ? void 0 : F.every((k) => !!(k != null && k.value))))
|
|
241
|
+
if (c != null && c.promptVariables) {
|
|
242
|
+
L("error", "变量值不能为空");
|
|
243
243
|
return;
|
|
244
244
|
} else
|
|
245
|
-
console.error("变量值不能为空", F == null ? void 0 : F.map((
|
|
246
|
-
if (
|
|
247
|
-
|
|
245
|
+
console.error("变量值不能为空", F == null ? void 0 : F.map((k) => !!(k != null && k.value)));
|
|
246
|
+
if (Oe) {
|
|
247
|
+
L("error", "正在回复中");
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
if (qe) {
|
|
251
|
-
|
|
251
|
+
L("error", "等待初始化");
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
|
-
if (!
|
|
255
|
-
|
|
254
|
+
if (!dn) {
|
|
255
|
+
L("error", "正在解析文件");
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
258
|
if (Qe) {
|
|
259
|
-
|
|
259
|
+
L("error", "正在上传图片");
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
262
|
ve([]), we([]);
|
|
263
|
-
const
|
|
264
|
-
if (!
|
|
263
|
+
const a = (H = e == null ? void 0 : e.data) == null ? void 0 : H.id;
|
|
264
|
+
if (!a) {
|
|
265
265
|
if (Ce)
|
|
266
266
|
return;
|
|
267
|
-
|
|
268
|
-
netOpen:
|
|
269
|
-
}).then((
|
|
270
|
-
var
|
|
271
|
-
|
|
272
|
-
|
|
267
|
+
G(!0), b == null || b({
|
|
268
|
+
netOpen: P ? le.OPEN : le.CLOSE
|
|
269
|
+
}).then((k) => {
|
|
270
|
+
var u, B;
|
|
271
|
+
X(!0), T(!!((u = k.data) != null && u.netOpen)), pe(!!((B = k.data) != null && B.enableNetOpen)), Re(k).then(() => {
|
|
272
|
+
w == null || w(k), X(!1), Be(n);
|
|
273
273
|
});
|
|
274
|
-
}).catch((
|
|
275
|
-
|
|
274
|
+
}).catch((k) => {
|
|
275
|
+
G(!1);
|
|
276
276
|
});
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
if (Ce)
|
|
280
280
|
return;
|
|
281
|
-
|
|
282
|
-
const i = ze(n,
|
|
283
|
-
let
|
|
281
|
+
G(!0), xe(!0);
|
|
282
|
+
const i = ze(n, S, ne[a], (o == null ? void 0 : o.type) || 0);
|
|
283
|
+
let d;
|
|
284
284
|
try {
|
|
285
|
-
|
|
285
|
+
q ? d = yield q == null ? void 0 : q({
|
|
286
286
|
applicationId: o.id,
|
|
287
|
-
sessionId:
|
|
287
|
+
sessionId: a,
|
|
288
288
|
message: {
|
|
289
289
|
content: i,
|
|
290
|
-
sessionId:
|
|
291
|
-
role:
|
|
292
|
-
files:
|
|
290
|
+
sessionId: a,
|
|
291
|
+
role: jt.User,
|
|
292
|
+
files: ne[a]
|
|
293
293
|
}
|
|
294
|
-
}) :
|
|
295
|
-
} catch (
|
|
296
|
-
|
|
294
|
+
}) : d = !0;
|
|
295
|
+
} catch (k) {
|
|
296
|
+
d = !1;
|
|
297
297
|
}
|
|
298
|
-
if (xe(!1),
|
|
299
|
-
|
|
298
|
+
if (xe(!1), d === !1) {
|
|
299
|
+
G(!1);
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
|
-
let
|
|
303
|
-
typeof
|
|
304
|
-
const
|
|
305
|
-
|
|
302
|
+
let r = n;
|
|
303
|
+
typeof d == "object" && (r = d.content || n);
|
|
304
|
+
const v = yield (() => new Promise((k) => {
|
|
305
|
+
ge((u) => (k(u), u));
|
|
306
306
|
}))();
|
|
307
|
-
if (!(yield e.setPromptVariables(
|
|
308
|
-
|
|
307
|
+
if (!(yield e.setPromptVariables(v))) {
|
|
308
|
+
G(!1);
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
((D =
|
|
312
|
-
}),
|
|
313
|
-
const
|
|
314
|
-
var
|
|
315
|
-
const
|
|
316
|
-
return
|
|
311
|
+
((D = ne[a]) == null ? void 0 : D.length) > 0 ? bn(r) : Ue(r);
|
|
312
|
+
}), Re = (t) => new Promise((n, s) => M(void 0, null, function* () {
|
|
313
|
+
const d = (t == null ? void 0 : t.promptVariables).filter((r) => r.type ? !((r.type === Ne.User || r.type === void 0) && r.key === "query") && !((r.type === Ne.System || r.type === void 0) && r.key === "datetime") : r.key !== "query").map((r) => {
|
|
314
|
+
var v;
|
|
315
|
+
const p = (v = F.find((C) => C.key === r.key && C.type === r.type)) == null ? void 0 : v.value;
|
|
316
|
+
return r.value = p || "", r;
|
|
317
317
|
});
|
|
318
|
-
|
|
319
|
-
console.error(
|
|
318
|
+
ge(d.sort((r, p) => r.key.localeCompare(p.key))), yield t == null ? void 0 : t.setPromptVariables(d).catch((r) => {
|
|
319
|
+
console.error(r), L("error", r.message);
|
|
320
320
|
}), n();
|
|
321
|
-
})),
|
|
322
|
-
var i,
|
|
321
|
+
})), bn = (t) => {
|
|
322
|
+
var i, d, r;
|
|
323
323
|
if (be(!1), !((i = e == null ? void 0 : e.data) != null && i.id) || !(o != null && o.id))
|
|
324
324
|
return;
|
|
325
|
-
const n = ((
|
|
326
|
-
let s = [],
|
|
327
|
-
(
|
|
328
|
-
|
|
325
|
+
const n = ((d = e.data) == null ? void 0 : d.id) || "";
|
|
326
|
+
let s = [], a = /* @__PURE__ */ new Set();
|
|
327
|
+
(r = ne[n]) == null || r.forEach((p) => {
|
|
328
|
+
a.has(p.id) || (s.push(p), a.add(p.id));
|
|
329
329
|
}), be(!0), Ue(t, s);
|
|
330
330
|
};
|
|
331
331
|
I(() => {
|
|
332
|
-
if (!
|
|
332
|
+
if (!Le || !e)
|
|
333
333
|
return;
|
|
334
|
-
const t =
|
|
334
|
+
const t = Le, n = () => M(void 0, null, function* () {
|
|
335
335
|
xe(!0);
|
|
336
|
-
const s = ze(t,
|
|
337
|
-
let
|
|
336
|
+
const s = ze(t, S, ne[e.id], (o == null ? void 0 : o.type) || 0);
|
|
337
|
+
let a;
|
|
338
338
|
try {
|
|
339
|
-
|
|
339
|
+
q ? a = yield q == null ? void 0 : q({
|
|
340
340
|
applicationId: o.id,
|
|
341
341
|
sessionId: e.id,
|
|
342
342
|
message: {
|
|
343
343
|
content: s,
|
|
344
344
|
sessionId: e.id,
|
|
345
|
-
role:
|
|
346
|
-
files:
|
|
345
|
+
role: jt.User,
|
|
346
|
+
files: ne[e.id]
|
|
347
347
|
}
|
|
348
|
-
}) :
|
|
348
|
+
}) : a = !0;
|
|
349
349
|
} catch (i) {
|
|
350
|
-
|
|
350
|
+
a = !1;
|
|
351
351
|
}
|
|
352
|
-
if (xe(!1),
|
|
353
|
-
|
|
352
|
+
if (xe(!1), a === !1) {
|
|
353
|
+
G(!1);
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
356
|
Ue(t), Be(void 0);
|
|
@@ -358,84 +358,84 @@ ${e}` : e;
|
|
|
358
358
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
359
359
|
e == null || e.removeEventListener("ready", n);
|
|
360
360
|
};
|
|
361
|
-
}, [
|
|
361
|
+
}, [Le, e]);
|
|
362
362
|
const Ue = (t, n) => M(void 0, null, function* () {
|
|
363
|
-
var H, D,
|
|
363
|
+
var H, D, k;
|
|
364
364
|
const s = (H = e == null ? void 0 : e.data) == null ? void 0 : H.id;
|
|
365
365
|
if (!s)
|
|
366
366
|
return;
|
|
367
|
-
|
|
368
|
-
const
|
|
367
|
+
W(!0), V(!0);
|
|
368
|
+
const a = ze(t, S, n, (o == null ? void 0 : o.type) || 0);
|
|
369
369
|
let i;
|
|
370
|
-
if (o.type ===
|
|
370
|
+
if (o.type === Q.Agent)
|
|
371
371
|
i = void 0;
|
|
372
|
-
else if (o.type ===
|
|
373
|
-
const
|
|
374
|
-
i =
|
|
372
|
+
else if (o.type === Q.Dialog && ((D = o.arrange) != null && D.length) && o.arrange[0].visionOpen) {
|
|
373
|
+
const u = S && S.length ? S.filter(Boolean) : [];
|
|
374
|
+
i = u.length ? u : void 0;
|
|
375
375
|
} else
|
|
376
376
|
i = void 0;
|
|
377
|
-
const
|
|
378
|
-
|
|
377
|
+
const d = new he(
|
|
378
|
+
a,
|
|
379
379
|
s,
|
|
380
|
-
|
|
380
|
+
ae.User,
|
|
381
381
|
n,
|
|
382
382
|
i
|
|
383
383
|
// 新增:传入图片内容
|
|
384
384
|
);
|
|
385
|
-
me(void 0),
|
|
385
|
+
me(void 0), te(void 0), m.current = [d, ...y], E(m.current), o.id && ye && ye({
|
|
386
386
|
applicationId: o.id,
|
|
387
387
|
sessionId: s,
|
|
388
|
-
message:
|
|
388
|
+
message: d
|
|
389
389
|
});
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
const
|
|
390
|
+
const r = new he("", s, ae.System);
|
|
391
|
+
r.isWaiting = !0, m.current = [r, ...m.current], E(m.current);
|
|
392
|
+
const p = (n == null ? void 0 : n.map((u) => u.id)) || [], v = {
|
|
393
393
|
stream: Gn.stream,
|
|
394
394
|
referenceFirst: !1
|
|
395
395
|
};
|
|
396
|
-
if (
|
|
397
|
-
const
|
|
398
|
-
|
|
396
|
+
if (c != null && c.promptVariables) {
|
|
397
|
+
const u = F == null ? void 0 : F.reduce((B, oe) => (B[oe.key] = oe.value, B), {});
|
|
398
|
+
v.formatValues = u;
|
|
399
399
|
}
|
|
400
|
-
if (
|
|
401
|
-
const
|
|
402
|
-
|
|
400
|
+
if (c != null && c.knowledges) {
|
|
401
|
+
const u = pn;
|
|
402
|
+
v.knowledges = u;
|
|
403
403
|
}
|
|
404
404
|
const C = {
|
|
405
|
-
text:
|
|
406
|
-
fileIds:
|
|
405
|
+
text: a,
|
|
406
|
+
fileIds: p,
|
|
407
407
|
files: n
|
|
408
408
|
};
|
|
409
|
-
i && i.length > 0 && (C.imageContent = i), yield e.send(C,
|
|
409
|
+
i && i.length > 0 && (C.imageContent = i), yield e.send(C, v), de({
|
|
410
410
|
[s]: []
|
|
411
|
-
}), (
|
|
411
|
+
}), (k = fe.current) == null || k.update(), ve([]), we([]), G(!1);
|
|
412
412
|
});
|
|
413
413
|
I(() => {
|
|
414
|
-
var
|
|
415
|
-
const t = (
|
|
414
|
+
var a;
|
|
415
|
+
const t = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
416
416
|
if (!t)
|
|
417
417
|
return;
|
|
418
418
|
const n = (i) => {
|
|
419
|
-
if (!i.sessionId || i.sessionId && i.sessionId !== We.current || i.role ===
|
|
419
|
+
if (!i.sessionId || i.sessionId && i.sessionId !== We.current || i.role === ae.User)
|
|
420
420
|
return;
|
|
421
|
-
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (V(!1),
|
|
422
|
-
|
|
421
|
+
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (V(!1), W(!1), m.current = m.current.filter((p) => !p.isWaiting), E([...m.current]), m.current = [...m.current], i.content)) {
|
|
422
|
+
se.config({
|
|
423
423
|
getContainer: () => (j == null ? void 0 : j.current) || document.body,
|
|
424
424
|
prefixCls: "gbot-notification"
|
|
425
|
-
}),
|
|
425
|
+
}), se.error({
|
|
426
426
|
message: i.content
|
|
427
|
-
}),
|
|
427
|
+
}), se.config({
|
|
428
428
|
getContainer: void 0,
|
|
429
429
|
prefixCls: "gbot-notification"
|
|
430
430
|
});
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
const
|
|
434
|
-
|
|
433
|
+
const d = i.actions || [], r = new he(i.content, t, ae.Robot);
|
|
434
|
+
r.messageId = i.messageId || Ve(), r.reasoningContent = i.reasoningContent, r.searchReference = i.searchReference, r.thinkingSecs = i.thinkingSecs, r.thinkingStatus = i.thinkingStatus, r.actions = d, r.isLoading = !0, r.searchingStatus = i.searchingStatus, m.current = m.current.filter((p) => !p.isWaiting).filter((p) => !p.isReplying), i.index === void 0 && E([r, ...m.current]), i.code === 11915 && (V(!1), W(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, E([r, ...m.current])), i.index === -2 && (V(!1), W(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, E([r, ...m.current])), i.index === -1 && (V(!1), W(!1), r.isLoading = !1, r.reference = i.reference, E([r, ...m.current]), o.id && ye && ye({
|
|
435
435
|
applicationId: o.id,
|
|
436
436
|
sessionId: t,
|
|
437
|
-
message:
|
|
438
|
-
})), i.index === -3 && (V(!1),
|
|
437
|
+
message: r
|
|
438
|
+
})), i.index === -3 && (V(!1), W(!1), r.isLoading = !1, r.reference = i.reference, r.relatedQuesion = i.relatedQuesion, E([r, ...m.current]));
|
|
439
439
|
}, s = () => {
|
|
440
440
|
e.addEventListener("message:updated", n);
|
|
441
441
|
};
|
|
@@ -444,118 +444,118 @@ ${e}` : e;
|
|
|
444
444
|
};
|
|
445
445
|
}, [e]), I(() => {
|
|
446
446
|
if (!e) {
|
|
447
|
-
|
|
447
|
+
Te(!1);
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
450
|
const t = (n) => {
|
|
451
|
-
|
|
451
|
+
Te(n);
|
|
452
452
|
};
|
|
453
|
-
return
|
|
453
|
+
return Te(e.frozen), e.addEventListener("frozen", t), () => {
|
|
454
454
|
e == null || e.removeEventListener("frozen", t);
|
|
455
455
|
};
|
|
456
456
|
}, [e]), I(() => {
|
|
457
457
|
if (!N)
|
|
458
458
|
return;
|
|
459
459
|
const t = N.questionContextMaxLength || 4e3;
|
|
460
|
-
|
|
460
|
+
St(t);
|
|
461
461
|
}, [N, U]), I(() => {
|
|
462
|
-
|
|
463
|
-
}, [
|
|
464
|
-
|
|
462
|
+
Pe && te(Pe.text);
|
|
463
|
+
}, [Pe]), I(() => {
|
|
464
|
+
At.config({
|
|
465
465
|
getContainer: () => (j == null ? void 0 : j.current) || document.body,
|
|
466
466
|
prefixCls: "gbot-message",
|
|
467
467
|
maxCount: 5
|
|
468
468
|
});
|
|
469
469
|
}, [j]);
|
|
470
|
-
const
|
|
471
|
-
|
|
470
|
+
const L = (t, n, s) => {
|
|
471
|
+
At.open({
|
|
472
472
|
type: t,
|
|
473
473
|
content: n,
|
|
474
474
|
key: s
|
|
475
475
|
});
|
|
476
476
|
}, ct = (t) => {
|
|
477
477
|
const n = t.size;
|
|
478
|
-
return n <= 0 ? (
|
|
479
|
-
},
|
|
478
|
+
return n <= 0 ? (L("error", "该文件为空,请重新上传"), !1) : n > $e * Zn ? (L("error", `图片须小于${$e}M`), !1) : (ve((s) => s.length >= J ? (L("warning", `图片最多上传${J}张`), s) : [...s, t]), !1);
|
|
479
|
+
}, xn = () => {
|
|
480
480
|
var t;
|
|
481
|
-
return (o.type ===
|
|
482
|
-
},
|
|
483
|
-
var D,
|
|
481
|
+
return (o.type === Q.Agent && (c == null ? void 0 : c.imageUpload) || o.type === Q.Dialog && ((t = o.arrange) == null ? void 0 : t.length) && !!o.arrange[0].visionOpen && (c == null ? void 0 : c.imageUpload)) && !O;
|
|
482
|
+
}, Cn = () => !!z && (c == null ? void 0 : c.fileUpload) && (o == null ? void 0 : o.id) && !O, dt = (t) => {
|
|
483
|
+
var D, k;
|
|
484
484
|
const n = Array.from(t || []).filter(Boolean);
|
|
485
485
|
if (!n.length)
|
|
486
486
|
return;
|
|
487
|
-
const s =
|
|
488
|
-
let
|
|
489
|
-
n.forEach((
|
|
490
|
-
var
|
|
491
|
-
if (((
|
|
492
|
-
s ? i.push(
|
|
487
|
+
const s = xn(), a = Cn(), i = [], d = [];
|
|
488
|
+
let r = 0, p = 0, v = 0;
|
|
489
|
+
n.forEach((u) => {
|
|
490
|
+
var Rt, Ut, Ft;
|
|
491
|
+
if (((Rt = u.type) == null ? void 0 : Rt.startsWith("image/")) || !!zt(u.name)) {
|
|
492
|
+
s ? i.push(u) : r++;
|
|
493
493
|
return;
|
|
494
494
|
}
|
|
495
|
-
const
|
|
496
|
-
if (ei.includes(
|
|
497
|
-
|
|
495
|
+
const oe = (Ft = (Ut = u.name) == null ? void 0 : Ut.split(".").pop()) == null ? void 0 : Ft.toLowerCase();
|
|
496
|
+
if (ei.includes(u.type) || ["pdf", "doc", "docx"].includes(oe || "")) {
|
|
497
|
+
a ? d.push(u) : p++;
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
500
|
-
|
|
500
|
+
v++;
|
|
501
501
|
});
|
|
502
|
-
const C = [], H =
|
|
503
|
-
if (!
|
|
502
|
+
const C = [], H = r + p + v;
|
|
503
|
+
if (!a && !s)
|
|
504
504
|
H && C.push(`当前不支持上传文件/图片,已忽略${H}个文件`);
|
|
505
|
-
else if (
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
} else if (!
|
|
509
|
-
const
|
|
510
|
-
|
|
505
|
+
else if (a && !s) {
|
|
506
|
+
const u = r + v;
|
|
507
|
+
u && C.push(`仅支持上传 .doc/.docx/.pdf 文件,已忽略${u}个其他类型文件`);
|
|
508
|
+
} else if (!a && s) {
|
|
509
|
+
const u = p + v;
|
|
510
|
+
u && C.push(`仅支持上传图片(.jpg/.jpeg/.png/.bmp),已忽略${u}个其他类型文件`);
|
|
511
511
|
} else
|
|
512
|
-
|
|
513
|
-
if (C.length &&
|
|
514
|
-
const
|
|
515
|
-
|
|
512
|
+
v && C.push(`存在不支持的文件类型,已忽略${v}个文件`);
|
|
513
|
+
if (C.length && L("warning", C.join(";"), "precheck-warn"), i.length) {
|
|
514
|
+
const u = Math.max(0, J - ce.length), B = i.slice(0, u);
|
|
515
|
+
B.forEach((oe) => ct(oe)), i.length > B.length && L("warning", `最多上传${J}张图片`);
|
|
516
516
|
}
|
|
517
|
-
|
|
517
|
+
d.length && ((k = (D = fe.current) == null ? void 0 : D.appendFiles) == null || k.call(D, d));
|
|
518
518
|
}, ft = (t) => {
|
|
519
519
|
var s;
|
|
520
520
|
const n = (s = t.clipboardData) == null ? void 0 : s.files;
|
|
521
521
|
n && n.length && (t.preventDefault(), t.stopPropagation(), dt(n));
|
|
522
522
|
}, gt = (t) => {
|
|
523
523
|
t.preventDefault();
|
|
524
|
-
},
|
|
524
|
+
}, ut = (t) => {
|
|
525
525
|
var s;
|
|
526
526
|
t.preventDefault(), t.stopPropagation();
|
|
527
527
|
const n = (s = t.dataTransfer) == null ? void 0 : s.files;
|
|
528
528
|
n && n.length && dt(n);
|
|
529
|
-
},
|
|
529
|
+
}, pt = () => M(void 0, null, function* () {
|
|
530
530
|
var t;
|
|
531
|
-
return (t = e == null ? void 0 : e.data) != null && t.id ? e : (
|
|
532
|
-
|
|
533
|
-
netOpen:
|
|
534
|
-
}).then((
|
|
535
|
-
var i,
|
|
536
|
-
|
|
537
|
-
}).catch((
|
|
538
|
-
|
|
531
|
+
return (t = e == null ? void 0 : e.data) != null && t.id ? e : (ie.current || (ie.current = new Promise((n, s) => {
|
|
532
|
+
X(!0), b == null || b({
|
|
533
|
+
netOpen: P ? le.OPEN : le.CLOSE
|
|
534
|
+
}).then((a) => {
|
|
535
|
+
var i, d;
|
|
536
|
+
w == null || w(a), X(!1), T(!!((i = a.data) != null && i.netOpen)), pe(!!((d = a.data) != null && d.enableNetOpen)), Re(a), n(a);
|
|
537
|
+
}).catch((a) => {
|
|
538
|
+
ie.current = null, s(a);
|
|
539
539
|
});
|
|
540
|
-
})),
|
|
540
|
+
})), ie.current);
|
|
541
541
|
}), In = (t) => M(void 0, null, function* () {
|
|
542
|
-
const n = yield
|
|
542
|
+
const n = yield pt();
|
|
543
543
|
return En(n, t);
|
|
544
544
|
}), En = (t, n) => {
|
|
545
|
-
const s =
|
|
546
|
-
return new Promise((
|
|
547
|
-
var
|
|
545
|
+
const s = zt(n.name);
|
|
546
|
+
return new Promise((a) => {
|
|
547
|
+
var d;
|
|
548
548
|
const i = {
|
|
549
549
|
files: [`${Ve()}.${s}`],
|
|
550
550
|
isv: "minio",
|
|
551
|
-
knowledgeId: ((
|
|
551
|
+
knowledgeId: ((d = t.data) == null ? void 0 : d.id) || "",
|
|
552
552
|
type: 1
|
|
553
553
|
};
|
|
554
|
-
U == null || U.postTicket(i).then((
|
|
555
|
-
U.uploadMinioFile(
|
|
554
|
+
U == null || U.postTicket(i).then((r) => {
|
|
555
|
+
U.uploadMinioFile(r.minio, n).then(() => {
|
|
556
556
|
var H, D;
|
|
557
|
-
const
|
|
558
|
-
|
|
557
|
+
const p = (H = r.minio.endpoints) == null ? void 0 : H[0], v = r.minio.bucket, C = (D = r.minio.fileKeys) == null ? void 0 : D[0];
|
|
558
|
+
a(`${r.minio.useSSL ? "https:" : location.protocol}//${p}/${v}/${C}`);
|
|
559
559
|
}).catch(() => {
|
|
560
560
|
});
|
|
561
561
|
}).catch(() => {
|
|
@@ -567,16 +567,16 @@ ${e}` : e;
|
|
|
567
567
|
t && !tt && t.scrollTo({
|
|
568
568
|
top: t.scrollHeight
|
|
569
569
|
});
|
|
570
|
-
}, [
|
|
571
|
-
const
|
|
570
|
+
}, [y]);
|
|
571
|
+
const ht = (t, n) => new Promise((s) => {
|
|
572
572
|
if (!n.file.url || !(o != null && o.id))
|
|
573
573
|
return s();
|
|
574
|
-
const
|
|
574
|
+
const a = Me(Ae({}, n.file), {
|
|
575
575
|
type: 1
|
|
576
576
|
});
|
|
577
|
-
U == null || U.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t,
|
|
577
|
+
U == null || U.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, a).finally(() => {
|
|
578
578
|
var i;
|
|
579
|
-
(i =
|
|
579
|
+
(i = fe.current) == null || i.update().finally(s);
|
|
580
580
|
});
|
|
581
581
|
}), Nn = () => {
|
|
582
582
|
var t;
|
|
@@ -593,7 +593,7 @@ ${e}` : e;
|
|
|
593
593
|
if (!R.current)
|
|
594
594
|
return;
|
|
595
595
|
const t = R.current.scrollTop <= -80;
|
|
596
|
-
|
|
596
|
+
un(t);
|
|
597
597
|
}, Tn = je((t) => {
|
|
598
598
|
var n, s;
|
|
599
599
|
(n = ke.current) == null || n.update(t), (s = ke.current) == null || s.focus();
|
|
@@ -603,44 +603,44 @@ ${e}` : e;
|
|
|
603
603
|
var n;
|
|
604
604
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
605
605
|
return;
|
|
606
|
-
m.current = [...
|
|
607
|
-
const t = new he("", e.data.id,
|
|
608
|
-
t.isWaiting = !0, m.current = [t, ...m.current], E(m.current),
|
|
606
|
+
m.current = [...y.slice(1, y.length)], E(m.current);
|
|
607
|
+
const t = new he("", e.data.id, ae.System);
|
|
608
|
+
t.isWaiting = !0, m.current = [t, ...m.current], E(m.current), W(!0), V(!0), e.answerAgain();
|
|
609
609
|
});
|
|
610
610
|
I(() => {
|
|
611
611
|
var t, n;
|
|
612
|
-
We.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !nt && ((n =
|
|
612
|
+
We.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !nt && ((n = De.current) == null || n.clear());
|
|
613
613
|
}, [e]);
|
|
614
614
|
const Rn = () => {
|
|
615
615
|
var s;
|
|
616
616
|
if (!((s = e == null ? void 0 : e.data) != null && s.id))
|
|
617
617
|
return;
|
|
618
|
-
const n =
|
|
618
|
+
const n = y[y.length - 1].messageTime;
|
|
619
619
|
e.fetchMessages({
|
|
620
620
|
endTime: n,
|
|
621
|
-
pageSize:
|
|
622
|
-
}).then((
|
|
623
|
-
const i =
|
|
621
|
+
pageSize: Bt
|
|
622
|
+
}).then((a) => {
|
|
623
|
+
const i = a || [];
|
|
624
624
|
if (!i || !(i != null && i.length)) {
|
|
625
625
|
ue(!1);
|
|
626
626
|
return;
|
|
627
627
|
}
|
|
628
|
-
i.length < 10 ? ue(!1) : ue(!0), E([...
|
|
628
|
+
i.length < 10 ? ue(!1) : ue(!0), E([...y, ...i.reverse()]);
|
|
629
629
|
});
|
|
630
630
|
}, Un = (t) => M(void 0, null, function* () {
|
|
631
631
|
var n, s;
|
|
632
632
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
633
|
-
|
|
633
|
+
T(t);
|
|
634
634
|
else {
|
|
635
635
|
if (yield e.setNetOpen(t), !((s = e.data) != null && s.id))
|
|
636
636
|
return;
|
|
637
|
-
|
|
637
|
+
T(t);
|
|
638
638
|
}
|
|
639
639
|
}), Fe = () => M(void 0, null, function* () {
|
|
640
640
|
e ? e.fetchData().then((t) => {
|
|
641
641
|
var n;
|
|
642
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (
|
|
643
|
-
}) : (
|
|
642
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (T(t.netOpen), pe(t.enableNetOpen));
|
|
643
|
+
}) : (T(typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.default) == "boolean" ? l.connectNetwork.default : !1), pe(o.arrange[0].enableNetOpen));
|
|
644
644
|
});
|
|
645
645
|
I(() => {
|
|
646
646
|
Fe();
|
|
@@ -648,11 +648,11 @@ ${e}` : e;
|
|
|
648
648
|
requestAnimationFrame(() => {
|
|
649
649
|
var n, s;
|
|
650
650
|
if (R.current) {
|
|
651
|
-
const
|
|
652
|
-
if (!i || !
|
|
651
|
+
const a = document.getElementById("chat-main"), i = (n = R.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), d = (s = R.current) == null ? void 0 : s.querySelector(".infinite-scroll-component");
|
|
652
|
+
if (!i || !d || !a)
|
|
653
653
|
return;
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
654
|
+
const r = a.offsetHeight;
|
|
655
|
+
if (d.offsetHeight <= r) {
|
|
656
656
|
if (i.style.height === "100%")
|
|
657
657
|
return;
|
|
658
658
|
i.style.height = "100%";
|
|
@@ -663,35 +663,35 @@ ${e}` : e;
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
});
|
|
666
|
-
}, [
|
|
666
|
+
}, [y]), I(() => {
|
|
667
667
|
if (e)
|
|
668
668
|
return;
|
|
669
669
|
const t = () => {
|
|
670
|
-
const
|
|
671
|
-
var
|
|
672
|
-
let
|
|
673
|
-
return typeof (l == null ? void 0 : l.promptVariables) == "object" && (
|
|
674
|
-
id:
|
|
670
|
+
const a = ((N == null ? void 0 : N.promptVariables) || []).filter((i) => i.type ? !(i.type === Ne.User && i.key === "query") && !(i.type === Ne.System && i.key === "datetime") && i.status === 1 : i.key !== "query" && i.status === 1).map((i, d) => {
|
|
671
|
+
var p, v;
|
|
672
|
+
let r = "";
|
|
673
|
+
return typeof (l == null ? void 0 : l.promptVariables) == "object" && (r = ((v = (p = l.promptVariables.default) == null ? void 0 : p.find((C) => C.key === i.key && C.type === i.type)) == null ? void 0 : v.value) || ""), {
|
|
674
|
+
id: d + "",
|
|
675
675
|
key: i.key,
|
|
676
676
|
name: i.name,
|
|
677
|
-
value:
|
|
677
|
+
value: r,
|
|
678
678
|
type: i.type
|
|
679
679
|
};
|
|
680
680
|
});
|
|
681
|
-
|
|
681
|
+
ge([...a].sort((i, d) => i.key.localeCompare(d.key)));
|
|
682
682
|
};
|
|
683
683
|
return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
|
|
684
684
|
N == null || N.removeEventListener("ready", t);
|
|
685
685
|
};
|
|
686
686
|
}, [e, N, l == null ? void 0 : l.promptVariables]);
|
|
687
|
-
const
|
|
688
|
-
netOpen:
|
|
687
|
+
const mt = () => b == null ? void 0 : b({
|
|
688
|
+
netOpen: P ? le.OPEN : le.CLOSE
|
|
689
689
|
}).then((t) => {
|
|
690
690
|
var n, s;
|
|
691
|
-
return
|
|
692
|
-
}),
|
|
691
|
+
return w == null || w(t), X(!1), T(!!((n = t.data) != null && n.netOpen)), pe(!!((s = t.data) != null && s.enableNetOpen)), Re(t), t;
|
|
692
|
+
}), yt = _n(() => {
|
|
693
693
|
var t;
|
|
694
|
-
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ f(
|
|
694
|
+
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ f(_t, {
|
|
695
695
|
application: o,
|
|
696
696
|
history: {
|
|
697
697
|
role: 1,
|
|
@@ -701,14 +701,14 @@ ${e}` : e;
|
|
|
701
701
|
sessionId: "",
|
|
702
702
|
reference: [],
|
|
703
703
|
searchReference: [],
|
|
704
|
-
messageTime:
|
|
704
|
+
messageTime: qt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
|
|
705
705
|
actions: [],
|
|
706
706
|
isLoading: !1
|
|
707
707
|
},
|
|
708
|
-
actions: !!
|
|
708
|
+
actions: !!y.length,
|
|
709
709
|
markdown: l == null ? void 0 : l.markdown
|
|
710
710
|
}) : null;
|
|
711
|
-
}, [o == null ? void 0 : o.arrange,
|
|
711
|
+
}, [o == null ? void 0 : o.arrange, y]);
|
|
712
712
|
return qn(h, () => ({
|
|
713
713
|
getCurrentInputText: () => {
|
|
714
714
|
var t;
|
|
@@ -717,26 +717,26 @@ ${e}` : e;
|
|
|
717
717
|
})), I(() => {
|
|
718
718
|
var n;
|
|
719
719
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
720
|
-
t &&
|
|
720
|
+
t && de((s) => Me(Ae({}, s), {
|
|
721
721
|
[t]: []
|
|
722
722
|
}));
|
|
723
|
-
}, [(
|
|
723
|
+
}, [(vt = e == null ? void 0 : e.data) == null ? void 0 : vt.id]), /* @__PURE__ */ _("div", {
|
|
724
724
|
className: "agent-chat",
|
|
725
|
-
children: [
|
|
725
|
+
children: [yn ? /* @__PURE__ */ f("div", {
|
|
726
726
|
className: "session-loading",
|
|
727
|
-
children: /* @__PURE__ */ f(
|
|
728
|
-
}) : /* @__PURE__ */
|
|
729
|
-
children: [(
|
|
727
|
+
children: /* @__PURE__ */ f(Mt, {})
|
|
728
|
+
}) : /* @__PURE__ */ _($n, {
|
|
729
|
+
children: [(c == null ? void 0 : c.promptVariables) && /* @__PURE__ */ f(li, {
|
|
730
730
|
ref: Je,
|
|
731
731
|
appId: o.id,
|
|
732
732
|
currentSession: e,
|
|
733
733
|
promptVariables: F,
|
|
734
|
-
setPromptVariables:
|
|
735
|
-
setCurrentSession:
|
|
736
|
-
}), /* @__PURE__ */
|
|
734
|
+
setPromptVariables: ge,
|
|
735
|
+
setCurrentSession: w
|
|
736
|
+
}), /* @__PURE__ */ _("div", {
|
|
737
737
|
className: "chat-main",
|
|
738
738
|
id: "chat-main",
|
|
739
|
-
style:
|
|
739
|
+
style: Qt,
|
|
740
740
|
children: [/* @__PURE__ */ f("div", {
|
|
741
741
|
className: "chat-main-wrapper",
|
|
742
742
|
id: "scrollableDiv",
|
|
@@ -748,8 +748,8 @@ ${e}` : e;
|
|
|
748
748
|
},
|
|
749
749
|
ref: R,
|
|
750
750
|
onScroll: Pn,
|
|
751
|
-
children: (
|
|
752
|
-
dataLength:
|
|
751
|
+
children: (wt = e == null ? void 0 : e.data) != null && wt.id && (y != null && y.length) ? /* @__PURE__ */ _(fi, {
|
|
752
|
+
dataLength: y.length,
|
|
753
753
|
next: Rn,
|
|
754
754
|
style: {
|
|
755
755
|
display: "flex",
|
|
@@ -757,8 +757,8 @@ ${e}` : e;
|
|
|
757
757
|
overflowX: "hidden"
|
|
758
758
|
},
|
|
759
759
|
inverse: !0,
|
|
760
|
-
endMessage:
|
|
761
|
-
((
|
|
760
|
+
endMessage: y.length > Bt && // 少于一页不展示这个提示
|
|
761
|
+
((kt = R.current) != null && kt.scrollTop) && ((bt = R.current) == null ? void 0 : bt.scrollTop) < -10 ? /* @__PURE__ */ f(Wn, {
|
|
762
762
|
plain: !0,
|
|
763
763
|
children: "没有更多数据了"
|
|
764
764
|
}) : null,
|
|
@@ -769,10 +769,10 @@ ${e}` : e;
|
|
|
769
769
|
textAlign: "center",
|
|
770
770
|
overflow: "hidden"
|
|
771
771
|
},
|
|
772
|
-
children: /* @__PURE__ */ f(
|
|
772
|
+
children: /* @__PURE__ */ f(Mt, {})
|
|
773
773
|
}),
|
|
774
774
|
scrollableTarget: "scrollableDiv",
|
|
775
|
-
children: [
|
|
775
|
+
children: [y.map((t, n) => /* @__PURE__ */ f(mi, {
|
|
776
776
|
application: o,
|
|
777
777
|
currentSession: e,
|
|
778
778
|
history: t,
|
|
@@ -782,58 +782,58 @@ ${e}` : e;
|
|
|
782
782
|
onAgainClick: On,
|
|
783
783
|
onEditClick: Tn,
|
|
784
784
|
markdown: l == null ? void 0 : l.markdown
|
|
785
|
-
}, t.messageId + n)), !it &&
|
|
786
|
-
}) : /* @__PURE__ */
|
|
785
|
+
}, t.messageId + n)), !it && yt]
|
|
786
|
+
}) : /* @__PURE__ */ _("div", {
|
|
787
787
|
className: "main-empty",
|
|
788
788
|
children: [(l == null ? void 0 : l.greeting) !== !1 && /* @__PURE__ */ f(ii, {
|
|
789
789
|
text: (
|
|
790
790
|
// 第一优先级:features配置
|
|
791
791
|
l != null && l.greeting && typeof l.greeting == "object" && l.greeting.text !== void 0 ? l.greeting.text : (
|
|
792
792
|
// 第二优先级:application.arrange[0].greetings
|
|
793
|
-
(
|
|
793
|
+
(xt = o.arrange) != null && xt.length && ((Ct = o.arrange[0]) != null && Ct.greetings) ? o.arrange[0].greetings : (
|
|
794
794
|
// 第三优先级:默认文本
|
|
795
|
-
|
|
795
|
+
Vt.text
|
|
796
796
|
)
|
|
797
797
|
)
|
|
798
798
|
),
|
|
799
|
-
icon: l === void 0 || l.greeting === !0 || ((
|
|
799
|
+
icon: l === void 0 || l.greeting === !0 || ((It = l.greeting) == null ? void 0 : It.icon) === void 0 ? Xt || Vt.icon : l.greeting.icon,
|
|
800
800
|
children: !!Xe.length && (((l == null ? void 0 : l.greeting) === void 0 || (l == null ? void 0 : l.greeting)) === !0 || typeof (l == null ? void 0 : l.greeting) == "object" && l.greeting.questions !== !1) && /* @__PURE__ */ f(ni, {
|
|
801
|
-
ref:
|
|
802
|
-
sid: (
|
|
801
|
+
ref: De,
|
|
802
|
+
sid: (Et = e == null ? void 0 : e.data) == null ? void 0 : Et.id,
|
|
803
803
|
isRecommendClearing: Ge,
|
|
804
804
|
data: Xe,
|
|
805
805
|
layoutBreakpoints: typeof (l == null ? void 0 : l.greeting) == "object" ? l.greeting.layoutBreakpoints : void 0,
|
|
806
806
|
onItemClick: (t) => {
|
|
807
|
-
var s,
|
|
808
|
-
if (me(t == null ? void 0 : t.question),
|
|
807
|
+
var s, a, i;
|
|
808
|
+
if (me(t == null ? void 0 : t.question), te(t == null ? void 0 : t.question), Ge)
|
|
809
809
|
return;
|
|
810
|
-
t != null && t.id &&
|
|
810
|
+
t != null && t.id && ee(!0);
|
|
811
811
|
const n = (s = e == null ? void 0 : e.data) == null ? void 0 : s.id;
|
|
812
|
-
|
|
813
|
-
var
|
|
814
|
-
t != null && t.id && (n ? (
|
|
815
|
-
|
|
816
|
-
}) : (
|
|
817
|
-
var
|
|
818
|
-
(
|
|
819
|
-
|
|
812
|
+
c != null && c.fileUpload ? (i = (a = fe.current) == null ? void 0 : a.clear()) == null || i.then(() => {
|
|
813
|
+
var d, r;
|
|
814
|
+
t != null && t.id && (n ? (d = ht(n, t)) == null || d.finally(() => {
|
|
815
|
+
ee(!1);
|
|
816
|
+
}) : (ee(!1), X(!0), (r = mt()) == null || r.then((p) => {
|
|
817
|
+
var v;
|
|
818
|
+
(v = ht(p.id, t)) == null || v.finally(() => {
|
|
819
|
+
ee(!1);
|
|
820
820
|
});
|
|
821
821
|
})));
|
|
822
|
-
}) : n ?
|
|
822
|
+
}) : n ? ee(!1) : (ee(!1), X(!0), mt());
|
|
823
823
|
}
|
|
824
824
|
})
|
|
825
|
-
}),
|
|
825
|
+
}), yt]
|
|
826
826
|
})
|
|
827
827
|
}), et && /* @__PURE__ */ f("div", {
|
|
828
828
|
className: "session-stop",
|
|
829
|
-
children: /* @__PURE__ */ f(
|
|
829
|
+
children: /* @__PURE__ */ f(Z, {
|
|
830
830
|
type: "primary",
|
|
831
831
|
style: {
|
|
832
832
|
background: "white"
|
|
833
833
|
},
|
|
834
834
|
ghost: !0,
|
|
835
835
|
size: "small",
|
|
836
|
-
icon: /* @__PURE__ */ f(
|
|
836
|
+
icon: /* @__PURE__ */ f(re, {
|
|
837
837
|
type: "icon-zantinghuida",
|
|
838
838
|
style: {
|
|
839
839
|
fontSize: 16
|
|
@@ -842,15 +842,15 @@ ${e}` : e;
|
|
|
842
842
|
onClick: () => Nn(),
|
|
843
843
|
children: "停止回答"
|
|
844
844
|
})
|
|
845
|
-
}), tt && (
|
|
845
|
+
}), tt && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ f("div", {
|
|
846
846
|
className: "back-bottom",
|
|
847
|
-
children: /* @__PURE__ */ f(
|
|
847
|
+
children: /* @__PURE__ */ f(Z, {
|
|
848
848
|
size: "small",
|
|
849
849
|
onClick: () => Ln({
|
|
850
850
|
behavior: "smooth"
|
|
851
851
|
}),
|
|
852
852
|
type: "link",
|
|
853
|
-
icon: /* @__PURE__ */ f(
|
|
853
|
+
icon: /* @__PURE__ */ f(re, {
|
|
854
854
|
type: "icon-yijianhuidaodibu",
|
|
855
855
|
style: {
|
|
856
856
|
fontSize: 24
|
|
@@ -860,53 +860,53 @@ ${e}` : e;
|
|
|
860
860
|
})]
|
|
861
861
|
}), /* @__PURE__ */ f("div", {
|
|
862
862
|
className: "chat-footer",
|
|
863
|
-
children: /* @__PURE__ */
|
|
863
|
+
children: /* @__PURE__ */ _("div", {
|
|
864
864
|
className: "chat-footer-input",
|
|
865
|
-
children: [
|
|
865
|
+
children: [ce.length > 0 && /* @__PURE__ */ f("div", {
|
|
866
866
|
className: "input-files",
|
|
867
|
-
children:
|
|
867
|
+
children: ce.map((t, n) => /* @__PURE__ */ f(Jn, {
|
|
868
868
|
className: "thumb-40",
|
|
869
869
|
file: t,
|
|
870
870
|
actions: {
|
|
871
871
|
upload: (s) => M(void 0, null, function* () {
|
|
872
|
-
Ye((
|
|
872
|
+
Ye((a) => a + 1);
|
|
873
873
|
try {
|
|
874
874
|
return yield In(s);
|
|
875
875
|
} finally {
|
|
876
|
-
Ye((
|
|
876
|
+
Ye((a) => Math.max(0, a - 1));
|
|
877
877
|
}
|
|
878
878
|
}),
|
|
879
879
|
remove: () => {
|
|
880
|
-
ve((s) => s.filter((
|
|
880
|
+
ve((s) => s.filter((a, i) => i !== n)), we((s) => s.filter((a, i) => i !== n));
|
|
881
881
|
}
|
|
882
882
|
},
|
|
883
883
|
onUrlChange: (s) => {
|
|
884
|
-
we((
|
|
885
|
-
const i = [...
|
|
884
|
+
we((a) => {
|
|
885
|
+
const i = [...a];
|
|
886
886
|
return i[n] = s, i;
|
|
887
887
|
});
|
|
888
888
|
}
|
|
889
889
|
}, n))
|
|
890
|
-
}), /* @__PURE__ */
|
|
890
|
+
}), /* @__PURE__ */ _(Ee, {
|
|
891
891
|
className: "footer-upload-action",
|
|
892
892
|
onClick: (t) => t.preventDefault(),
|
|
893
|
-
children: [/* @__PURE__ */
|
|
894
|
-
children: [(o.type ===
|
|
893
|
+
children: [/* @__PURE__ */ _(Ee, {
|
|
894
|
+
children: [(o.type === Q.Agent && (c == null ? void 0 : c.imageUpload) || o.type === Q.Dialog && ((Nt = o.arrange) == null ? void 0 : Nt.length) && !!o.arrange[0].visionOpen && (c == null ? void 0 : c.imageUpload)) && /* @__PURE__ */ f(Kn, {
|
|
895
895
|
multiple: !0,
|
|
896
|
-
disabled:
|
|
896
|
+
disabled: ce.length >= J || O,
|
|
897
897
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
898
898
|
listType: "picture-card",
|
|
899
899
|
beforeUpload: ct,
|
|
900
900
|
className: "footer-upload-picture",
|
|
901
901
|
showUploadList: !1,
|
|
902
|
-
children:
|
|
902
|
+
children: ce.length < J ? /* @__PURE__ */ f(Yn, {
|
|
903
903
|
placement: "topLeft",
|
|
904
904
|
overlayClassName: "footer-upload-tooltip",
|
|
905
905
|
title: /* @__PURE__ */ f("div", {
|
|
906
906
|
children: `支持上传.jpg .png .jpeg
|
|
907
|
-
.bmp格式的图片数据,单文件最大${$e}M,最多${
|
|
907
|
+
.bmp格式的图片数据,单文件最大${$e}M,最多${J}张`
|
|
908
908
|
}),
|
|
909
|
-
children: /* @__PURE__ */ f(
|
|
909
|
+
children: /* @__PURE__ */ f(Z, {
|
|
910
910
|
type: "text",
|
|
911
911
|
className: "camera-out-btn",
|
|
912
912
|
style: {
|
|
@@ -914,7 +914,7 @@ ${e}` : e;
|
|
|
914
914
|
position: "relative",
|
|
915
915
|
bottom: "-2px"
|
|
916
916
|
},
|
|
917
|
-
icon: /* @__PURE__ */ f(
|
|
917
|
+
icon: /* @__PURE__ */ f(re, {
|
|
918
918
|
type: "icon-shangchuantupian",
|
|
919
919
|
className: "icon-tianjia",
|
|
920
920
|
style: {
|
|
@@ -922,7 +922,7 @@ ${e}` : e;
|
|
|
922
922
|
}
|
|
923
923
|
})
|
|
924
924
|
})
|
|
925
|
-
}) : /* @__PURE__ */ f(
|
|
925
|
+
}) : /* @__PURE__ */ f(Z, {
|
|
926
926
|
type: "text",
|
|
927
927
|
className: "camera-out-btn",
|
|
928
928
|
style: {
|
|
@@ -931,7 +931,7 @@ ${e}` : e;
|
|
|
931
931
|
bottom: "-2px"
|
|
932
932
|
},
|
|
933
933
|
disabled: !0,
|
|
934
|
-
icon: /* @__PURE__ */ f(
|
|
934
|
+
icon: /* @__PURE__ */ f(re, {
|
|
935
935
|
type: "icon-shangchuantupian",
|
|
936
936
|
className: "icon-tianjia",
|
|
937
937
|
style: {
|
|
@@ -939,80 +939,74 @@ ${e}` : e;
|
|
|
939
939
|
}
|
|
940
940
|
})
|
|
941
941
|
})
|
|
942
|
-
}), z && (
|
|
942
|
+
}), z && (c != null && c.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ f(ri, {
|
|
943
943
|
appId: o == null ? void 0 : o.id,
|
|
944
|
-
ref:
|
|
944
|
+
ref: fe,
|
|
945
945
|
isFirstSession: nt,
|
|
946
946
|
docViewerUrl: $,
|
|
947
947
|
onStatusChange: (t) => M(void 0, null, function* () {
|
|
948
948
|
t !== "process" ? (be(!0), Fe()) : be(!1);
|
|
949
949
|
}),
|
|
950
|
-
createSession: () =>
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}).then((n) => {
|
|
954
|
-
var r, i, c;
|
|
955
|
-
y == null || y(n), B(!1), P(!!((r = n.data) != null && r.netOpen)), oe(!!((i = n.data) != null && i.enableNetOpen)), Ee(n);
|
|
956
|
-
const s = ((c = n.data) == null ? void 0 : c.id) || "";
|
|
957
|
-
t(s);
|
|
958
|
-
});
|
|
950
|
+
createSession: () => pt().then((t) => {
|
|
951
|
+
var s;
|
|
952
|
+
return ((s = t.data) == null ? void 0 : s.id) || "";
|
|
959
953
|
}),
|
|
960
|
-
sid: (
|
|
961
|
-
disabled:
|
|
954
|
+
sid: (Lt = e == null ? void 0 : e.data) == null ? void 0 : Lt.id,
|
|
955
|
+
disabled: Oe || O,
|
|
962
956
|
afterFileAdd: (t, n) => {
|
|
963
|
-
n &&
|
|
964
|
-
const
|
|
957
|
+
n && de((s) => {
|
|
958
|
+
const a = s[n] || [];
|
|
965
959
|
return {
|
|
966
|
-
[n]: [...
|
|
960
|
+
[n]: [...a, t]
|
|
967
961
|
};
|
|
968
962
|
});
|
|
969
963
|
},
|
|
970
964
|
afterFileDelete: (t) => {
|
|
971
965
|
var s;
|
|
972
966
|
const n = (s = e == null ? void 0 : e.data) == null ? void 0 : s.id;
|
|
973
|
-
n &&
|
|
974
|
-
const i =
|
|
967
|
+
n && de((a) => {
|
|
968
|
+
const i = a[n] || [];
|
|
975
969
|
return {
|
|
976
|
-
[n]: i.filter((
|
|
970
|
+
[n]: i.filter((d) => d.id !== t)
|
|
977
971
|
};
|
|
978
972
|
});
|
|
979
973
|
},
|
|
980
974
|
onFileListChange: (t) => {
|
|
981
|
-
|
|
975
|
+
cn(t);
|
|
982
976
|
},
|
|
983
|
-
shouldContinue:
|
|
977
|
+
shouldContinue: fn,
|
|
984
978
|
afterFilesClear: () => {
|
|
985
979
|
var n;
|
|
986
980
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
987
|
-
t && (
|
|
981
|
+
t && (de({
|
|
988
982
|
[t]: []
|
|
989
983
|
}), Fe());
|
|
990
984
|
}
|
|
991
|
-
}) : null, (
|
|
985
|
+
}) : null, (c == null ? void 0 : c.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ f(ui, {
|
|
992
986
|
appId: o.id,
|
|
993
987
|
list: [],
|
|
994
|
-
search: Ze ?
|
|
988
|
+
search: Ze ? on : "",
|
|
995
989
|
onPromptSelect: (t) => {
|
|
996
|
-
|
|
990
|
+
te(t.context), me(t.context);
|
|
997
991
|
},
|
|
998
992
|
disabled: O
|
|
999
993
|
})]
|
|
1000
|
-
}), /* @__PURE__ */
|
|
1001
|
-
children: [(
|
|
1002
|
-
sessionId: (
|
|
1003
|
-
netStatus:
|
|
1004
|
-
enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) :
|
|
994
|
+
}), /* @__PURE__ */ _(Ee, {
|
|
995
|
+
children: [(c == null ? void 0 : c.connectNetwork) && o.type === Q.Dialog && ((Pt = o.arrange) == null ? void 0 : Pt.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ f(gi, {
|
|
996
|
+
sessionId: (Tt = e == null ? void 0 : e.data) == null ? void 0 : Tt.id,
|
|
997
|
+
netStatus: P,
|
|
998
|
+
enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) : mn,
|
|
1005
999
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
1006
1000
|
onNetStatusChange: (t) => {
|
|
1007
1001
|
Un(t);
|
|
1008
1002
|
}
|
|
1009
|
-
}), (
|
|
1010
|
-
currentSessionId: (
|
|
1003
|
+
}), (c == null ? void 0 : c.sessionList) && /* @__PURE__ */ f(ci, {
|
|
1004
|
+
currentSessionId: (Dt = e == null ? void 0 : e.data) == null ? void 0 : Dt.id,
|
|
1011
1005
|
onSessionChange: (t, n) => {
|
|
1012
|
-
|
|
1006
|
+
te(void 0), Ie(!0), w == null || w(n);
|
|
1013
1007
|
},
|
|
1014
1008
|
disabled: O
|
|
1015
|
-
}),
|
|
1009
|
+
}), Gt && Zt === "float" && /* @__PURE__ */ f("div", {
|
|
1016
1010
|
className: "session-history-drawer-component",
|
|
1017
1011
|
children: /* @__PURE__ */ f(Qn, {
|
|
1018
1012
|
placement: "topRight",
|
|
@@ -1023,11 +1017,11 @@ ${e}` : e;
|
|
|
1023
1017
|
},
|
|
1024
1018
|
getPopupContainer: (t) => t.parentNode,
|
|
1025
1019
|
content: "会话历史记录",
|
|
1026
|
-
children: /* @__PURE__ */ f(
|
|
1020
|
+
children: /* @__PURE__ */ f(Z, {
|
|
1027
1021
|
className: "history-overlay-action",
|
|
1028
1022
|
disabled: O,
|
|
1029
1023
|
type: "text",
|
|
1030
|
-
icon: /* @__PURE__ */ f(
|
|
1024
|
+
icon: /* @__PURE__ */ f(re, {
|
|
1031
1025
|
type: "icon-lishijilu",
|
|
1032
1026
|
style: {
|
|
1033
1027
|
fontSize: 24
|
|
@@ -1036,14 +1030,14 @@ ${e}` : e;
|
|
|
1036
1030
|
onClick: () => rt(!0)
|
|
1037
1031
|
})
|
|
1038
1032
|
})
|
|
1039
|
-
}), (
|
|
1033
|
+
}), (c == null ? void 0 : c.sessionOpen) && /* @__PURE__ */ f(Z, {
|
|
1040
1034
|
icon: /* @__PURE__ */ f(si, {}),
|
|
1041
1035
|
className: "add-btn",
|
|
1042
1036
|
type: "primary",
|
|
1043
|
-
disabled: et || !e || !
|
|
1037
|
+
disabled: et || !e || !y.length || O,
|
|
1044
1038
|
onClick: () => {
|
|
1045
1039
|
var t, n;
|
|
1046
|
-
Ie(!1),
|
|
1040
|
+
Ie(!1), w == null || w(null), ie.current = null, T(!1), (t = Je.current) == null || t.clear(), (n = De.current) == null || n.clear();
|
|
1047
1041
|
},
|
|
1048
1042
|
children: "新会话"
|
|
1049
1043
|
})]
|
|
@@ -1052,56 +1046,56 @@ ${e}` : e;
|
|
|
1052
1046
|
className: "footer-textarea",
|
|
1053
1047
|
onPaste: ft,
|
|
1054
1048
|
onPasteCapture: ft,
|
|
1055
|
-
onDrop:
|
|
1056
|
-
onDropCapture:
|
|
1049
|
+
onDrop: ut,
|
|
1050
|
+
onDropCapture: ut,
|
|
1057
1051
|
onDragOver: gt,
|
|
1058
1052
|
onDragOverCapture: gt,
|
|
1059
1053
|
children: /* @__PURE__ */ f(ti, {
|
|
1060
1054
|
ref: ke,
|
|
1061
|
-
maxLength:
|
|
1062
|
-
text:
|
|
1055
|
+
maxLength: Jt,
|
|
1056
|
+
text: rn,
|
|
1063
1057
|
networkStatus: !1,
|
|
1064
1058
|
loading: ot || Ce,
|
|
1065
1059
|
disabled: qe || Qe || O || ot || Ce,
|
|
1066
1060
|
onTextSend: lt,
|
|
1067
1061
|
onChange: (t, n) => {
|
|
1068
|
-
|
|
1062
|
+
te(t);
|
|
1069
1063
|
const s = n.getText().replace(/[\n\s]+$/, "");
|
|
1070
|
-
me(s),
|
|
1064
|
+
me(s), sn(s), Ze || nn(!0);
|
|
1071
1065
|
},
|
|
1072
|
-
clearAction: /* @__PURE__ */ f(
|
|
1066
|
+
clearAction: /* @__PURE__ */ f(Ee, {
|
|
1073
1067
|
size: 0,
|
|
1074
|
-
children: /* @__PURE__ */ f(
|
|
1068
|
+
children: /* @__PURE__ */ f(Z, {
|
|
1075
1069
|
type: "link",
|
|
1076
|
-
disabled:
|
|
1070
|
+
disabled: Oe || O,
|
|
1077
1071
|
ghost: !0,
|
|
1078
|
-
icon: /* @__PURE__ */ f(
|
|
1072
|
+
icon: /* @__PURE__ */ f(re, {
|
|
1079
1073
|
style: {
|
|
1080
1074
|
fontSize: 22
|
|
1081
1075
|
},
|
|
1082
1076
|
type: "icon-qingchujiyi"
|
|
1083
1077
|
}),
|
|
1084
|
-
onClick: () =>
|
|
1078
|
+
onClick: () => kn()
|
|
1085
1079
|
})
|
|
1086
1080
|
})
|
|
1087
1081
|
})
|
|
1088
1082
|
})]
|
|
1089
1083
|
})
|
|
1090
1084
|
}), /* @__PURE__ */ f(oi, {
|
|
1091
|
-
tips:
|
|
1085
|
+
tips: Yt
|
|
1092
1086
|
}), Se && /* @__PURE__ */ f(ai, {
|
|
1093
1087
|
isvisible: Se,
|
|
1094
|
-
files:
|
|
1095
|
-
sessionId: (
|
|
1088
|
+
files: ln,
|
|
1089
|
+
sessionId: (Ot = e == null ? void 0 : e.data) == null ? void 0 : Ot.id,
|
|
1096
1090
|
onClose: (t) => {
|
|
1097
|
-
|
|
1091
|
+
an(!1), gn(!1);
|
|
1098
1092
|
}
|
|
1099
1093
|
})]
|
|
1100
1094
|
}), st && /* @__PURE__ */ f(di, {
|
|
1101
1095
|
currentSession: e,
|
|
1102
1096
|
application: o,
|
|
1103
|
-
networkStatus:
|
|
1104
|
-
setCurrentSession:
|
|
1097
|
+
networkStatus: P,
|
|
1098
|
+
setCurrentSession: w,
|
|
1105
1099
|
disabled: O,
|
|
1106
1100
|
isSessionHistoryVisible: st,
|
|
1107
1101
|
setIsSessionHistoryVisible: rt,
|