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