@glodon-aiot/agent-cli-ui 3.3.6-alpha.1 → 3.4.0-alpha.2
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 +442 -435
- package/dist/es/Dialog/SessionList/index.mjs +117 -115
- package/dist/es/Dialog/index.mjs +35 -34
- package/dist/es/constant.mjs +2 -0
- package/dist/es/index.mjs +30 -29
- 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/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style22.css +1 -1
- package/dist/es/src/style23.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/style30.css +1 -1
- package/dist/es/src/style31.css +1 -1
- package/dist/es/src/style32.css +1 -1
- package/dist/es/src/style33.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +55 -55
- package/dist/src/Dialog/AgentChat/HistoryItem/FileItem/index.d.ts +1 -1
- package/dist/src/Dialog/AgentChat/HistoryItem/SessionAction/index.d.ts +1 -1
- package/dist/src/Dialog/AgentChat/HistoryItem/index.d.ts +1 -1
- package/dist/src/Dialog/AgentChat/PromptSetting/index.d.ts +2 -2
- package/dist/src/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.d.ts +2 -2
- package/dist/src/Dialog/AgentChat/index.d.ts +2 -2
- package/dist/src/Dialog/SessionList/index.d.ts +3 -2
- package/dist/src/components/KnowledgeList/index.d.ts +1 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var on = Object.defineProperty, sn = Object.defineProperties;
|
|
2
|
+
var rn = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var dt = Object.getOwnPropertySymbols;
|
|
4
|
+
var an = Object.prototype.hasOwnProperty, ln = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ce = (N, o, p) => o in N ? on(N, o, { enumerable: !0, configurable: !0, writable: !0, value: p }) : N[o] = p, ct = (N, o) => {
|
|
6
6
|
for (var p in o || (o = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var p of
|
|
10
|
-
|
|
7
|
+
an.call(o, p) && Ce(N, p, o[p]);
|
|
8
|
+
if (dt)
|
|
9
|
+
for (var p of dt(o))
|
|
10
|
+
ln.call(o, p) && Ce(N, p, o[p]);
|
|
11
11
|
return N;
|
|
12
|
-
},
|
|
13
|
-
var H = (N, o, p) => (
|
|
12
|
+
}, ft = (N, o) => sn(N, rn(o));
|
|
13
|
+
var H = (N, o, p) => (Ce(N, typeof o != "symbol" ? o + "" : o, p), p);
|
|
14
14
|
var j = (N, o, p) => new Promise((e, w) => {
|
|
15
15
|
var me = (x) => {
|
|
16
16
|
try {
|
|
@@ -27,36 +27,36 @@ var j = (N, o, p) => new Promise((e, w) => {
|
|
|
27
27
|
}, R = (x) => x.done ? e(x.value) : Promise.resolve(x.value).then(me, k);
|
|
28
28
|
R((p = p.apply(N, o)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as c, jsxs as B } from "react/jsx-runtime";
|
|
31
|
-
import { memo as
|
|
32
|
-
/* empty css */import {
|
|
30
|
+
import { jsx as c, jsxs as B, Fragment as dn } from "react/jsx-runtime";
|
|
31
|
+
import { memo as cn, useState as h, useRef as q, useContext as fn, useMemo as gt, useEffect as E } from "react";
|
|
32
|
+
/* empty css */import { Spin as ut, Divider as gn, Button as G, Space as fe, Upload as un, Tooltip as hn, notification as ge, message as u } from "antd";
|
|
33
33
|
import ue from "../../components/Iconfont/index.mjs";
|
|
34
|
-
import { IHistoryRole as X, ChatMessageRole as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import { v4 as
|
|
38
|
-
import
|
|
39
|
-
import { configuration as
|
|
40
|
-
import { NET_OPEN_STATUS as $, MB as
|
|
41
|
-
import
|
|
42
|
-
import { getImageExtension as
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import { CameraOutlined as
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import { useMemoizedFn as
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
const
|
|
59
|
-
icon:
|
|
34
|
+
import { IHistoryRole as X, ChatMessageRole as ht, PromptVariableType as he } from "@glodon-aiot/apis";
|
|
35
|
+
import pt from "./HistoryItem/index.mjs";
|
|
36
|
+
import vt from "dayjs";
|
|
37
|
+
import { v4 as Pe } from "uuid";
|
|
38
|
+
import mn from "../../context.mjs";
|
|
39
|
+
import { configuration as yn } from "@glodon-aiot/bot-client-sdk";
|
|
40
|
+
import { NET_OPEN_STATUS as $, MB as pn } from "../../constant.mjs";
|
|
41
|
+
import vn from "../../components/FilePreview/index.mjs";
|
|
42
|
+
import { getImageExtension as kn } from "../../utils/index.mjs";
|
|
43
|
+
import bn from "../../QuillEditor/index.mjs";
|
|
44
|
+
import wn from "../../components/Recommend/index.mjs";
|
|
45
|
+
import xn from "../../components/Greeting/index.mjs";
|
|
46
|
+
import In from "../../Footer/index.mjs";
|
|
47
|
+
import { CameraOutlined as Nn, PlusOutlined as Ln } from "@ant-design/icons";
|
|
48
|
+
import Cn from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
49
|
+
import En from "../UploadingPrompt/index.mjs";
|
|
50
|
+
import Pn from "./PromptSetting/index.mjs";
|
|
51
|
+
import { useMemoizedFn as Ee } from "ahooks";
|
|
52
|
+
import Tn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
|
+
import On from "./Tools/SessionHistoryDrawer/index.mjs";
|
|
54
|
+
import Fn from "react-infinite-scroll-component";
|
|
55
|
+
import Rn from "./Tools/ConnectToNetwork/index.mjs";
|
|
56
|
+
import Dn from "./Tools/PromptManager/index.mjs";
|
|
57
|
+
import Hn from "../../assets/icon.svg.mjs";
|
|
58
|
+
const Un = cn(pt), mt = {
|
|
59
|
+
icon: Hn,
|
|
60
60
|
text: "今天我能帮你什么?"
|
|
61
61
|
};
|
|
62
62
|
class te {
|
|
@@ -70,13 +70,13 @@ class te {
|
|
|
70
70
|
H(this, "isSensitive");
|
|
71
71
|
H(this, "isSuspend");
|
|
72
72
|
H(this, "comment");
|
|
73
|
-
this.content = o, this.sessionId = p, this.role = e, this.files = w, this.content = o, this.role = e, this.sessionId = p, this.files = w, this.messageTime =
|
|
73
|
+
this.content = o, this.sessionId = p, this.role = e, this.files = w, this.content = o, this.role = e, this.sessionId = p, this.files = w, this.messageTime = vt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Pe(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
74
74
|
isAgree: 0
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const
|
|
79
|
-
var
|
|
78
|
+
const yt = 10, gi = (N) => {
|
|
79
|
+
var Ze, Je, Se, et, tt, nt, it, ot, st, rt, at, lt;
|
|
80
80
|
const {
|
|
81
81
|
application: o,
|
|
82
82
|
docViewerUrl: p = "",
|
|
@@ -88,27 +88,29 @@ const ft = 10, ai = (N) => {
|
|
|
88
88
|
setNetworkStatus: x,
|
|
89
89
|
sessions: Z,
|
|
90
90
|
// 👈 新增
|
|
91
|
-
setSessions:
|
|
91
|
+
setSessions: kt
|
|
92
92
|
// 👈 新增
|
|
93
|
-
} = N, [v, L] = h([]), [
|
|
94
|
-
service:
|
|
93
|
+
} = N, [v, L] = h([]), [bt, ne] = h(), [ye, Te] = h(), F = q(null), {
|
|
94
|
+
service: P,
|
|
95
95
|
agentClient: C,
|
|
96
|
-
depId:
|
|
97
|
-
footer:
|
|
96
|
+
depId: wt,
|
|
97
|
+
footer: xt,
|
|
98
98
|
transform: g,
|
|
99
99
|
defaultInput: pe,
|
|
100
100
|
onMessage: ie,
|
|
101
|
-
onHistoryLoad:
|
|
101
|
+
onHistoryLoad: Oe,
|
|
102
102
|
beforeMessageSend: z,
|
|
103
|
-
bodyStyle:
|
|
103
|
+
bodyStyle: It,
|
|
104
104
|
disabled: D,
|
|
105
105
|
features: s,
|
|
106
106
|
popupContainer: f,
|
|
107
|
-
icon:
|
|
108
|
-
sider:
|
|
109
|
-
mode:
|
|
110
|
-
} =
|
|
111
|
-
|
|
107
|
+
icon: Nt,
|
|
108
|
+
sider: Lt,
|
|
109
|
+
mode: Ct
|
|
110
|
+
} = fn(mn), [Fe, ve] = h(!1), m = q(v), Re = q(void 0), [Et, Pt] = h(0), [J, Y] = h(), [K, oe] = h(""), [De, ke] = h(!1), be = q(null), [He, Tt] = h([]), [Ue, W] = h(!1), [Me, Ot] = h(!1), [Ft, Rt] = h(""), [Dt, Q] = h(), [se, re] = h({}), ae = q(null), je = q(null), we = q(null), [ze, Ht] = h(!1), [Ut, Mt] = h([]), [jt, le] = h(!0), [zt, Vt] = h(!0), [Ve, U] = h(!1), [xe, V] = h(!1), [Ae, At] = h(!1), [O, de] = h(typeof (s == null ? void 0 : s.promptVariables) == "object" ? s.promptVariables.default || [] : []), [Bt, $t] = h(typeof (s == null ? void 0 : s.knowledges) == "object" && s.knowledges.default || void 0), [Be, M] = h(!1), [$e, S] = h(!1), [qt, _] = h(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), [qe, ce] = h(!1), [Yt, Ie] = h(!1), Ye = gt(() => e === null ? !1 : e === void 0 ? !0 : e ? !e.ready : !0, [e, e == null ? void 0 : e.ready, (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id]);
|
|
111
|
+
E(() => {
|
|
112
|
+
Ie(Ye);
|
|
113
|
+
}, [Ye]), E(() => {
|
|
112
114
|
var a, i;
|
|
113
115
|
e && (m.current = []), L([]);
|
|
114
116
|
const t = F.current;
|
|
@@ -118,11 +120,11 @@ const ft = 10, ai = (N) => {
|
|
|
118
120
|
return;
|
|
119
121
|
if (V(!1), U(!1), (i = e.messages) != null && i.length) {
|
|
120
122
|
const r = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
|
|
121
|
-
m.current = [...r], L([...r]);
|
|
123
|
+
m.current = [...r], L([...r]), Ie(!1);
|
|
122
124
|
}
|
|
123
125
|
const n = (l) => {
|
|
124
126
|
var r;
|
|
125
|
-
(r = e == null ? void 0 : e.data) != null && r.id && (m.current = [...l].reverse(), L([...l].reverse()), !l || l.length < 10 ? S(!1) : S(!0),
|
|
127
|
+
(r = e == null ? void 0 : e.data) != null && r.id && (m.current = [...l].reverse(), L([...l].reverse()), !l || l.length < 10 ? S(!1) : S(!0), Ie(!1), Oe && Oe({
|
|
126
128
|
applicationId: o.id,
|
|
127
129
|
sessionId: e.data.id,
|
|
128
130
|
histories: l
|
|
@@ -131,15 +133,15 @@ const ft = 10, ai = (N) => {
|
|
|
131
133
|
return e.addEventListener("history:loaded", n), () => {
|
|
132
134
|
m.current = [], L([]), e == null || e.removeEventListener("history:loaded", n);
|
|
133
135
|
};
|
|
134
|
-
}, [e]),
|
|
136
|
+
}, [e]), E(() => {
|
|
135
137
|
const t = () => {
|
|
136
138
|
var n;
|
|
137
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && de(e.promptVariables.sort((a, i) => a.key.localeCompare(i.key))), e.knowledges &&
|
|
139
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && de(e.promptVariables.sort((a, i) => a.key.localeCompare(i.key))), e.knowledges && $t(e.knowledges), x(e.netOpen));
|
|
138
140
|
};
|
|
139
141
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
140
142
|
e == null || e.removeEventListener("data:updated", t);
|
|
141
143
|
};
|
|
142
|
-
}, [e]),
|
|
144
|
+
}, [e]), E(() => {
|
|
143
145
|
var n;
|
|
144
146
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
145
147
|
return;
|
|
@@ -157,7 +159,7 @@ const ft = 10, ai = (N) => {
|
|
|
157
159
|
e == null || e.removeEventListener("error", t);
|
|
158
160
|
};
|
|
159
161
|
}, [e]);
|
|
160
|
-
const
|
|
162
|
+
const Kt = () => {
|
|
161
163
|
var a;
|
|
162
164
|
if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(o != null && o.id))
|
|
163
165
|
return;
|
|
@@ -175,13 +177,13 @@ const ft = 10, ai = (N) => {
|
|
|
175
177
|
i.isContext = !0, L([i, ...v]);
|
|
176
178
|
});
|
|
177
179
|
};
|
|
178
|
-
|
|
179
|
-
o != null && o.id && (
|
|
180
|
-
|
|
180
|
+
E(() => {
|
|
181
|
+
o != null && o.id && (P == null || P.getRecommendQues(o.id).then((t) => {
|
|
182
|
+
Tt(t);
|
|
181
183
|
}));
|
|
182
|
-
}, [
|
|
183
|
-
const
|
|
184
|
-
var y,
|
|
184
|
+
}, [wt, o]);
|
|
185
|
+
const Ke = (t) => j(void 0, null, function* () {
|
|
186
|
+
var y, T;
|
|
185
187
|
if (D) {
|
|
186
188
|
u.config({
|
|
187
189
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
@@ -190,7 +192,7 @@ const ft = 10, ai = (N) => {
|
|
|
190
192
|
});
|
|
191
193
|
return;
|
|
192
194
|
}
|
|
193
|
-
const n = t ||
|
|
195
|
+
const n = t || bt;
|
|
194
196
|
if (!(n != null && n.trim())) {
|
|
195
197
|
u.config({
|
|
196
198
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
@@ -217,7 +219,7 @@ const ft = 10, ai = (N) => {
|
|
|
217
219
|
});
|
|
218
220
|
return;
|
|
219
221
|
}
|
|
220
|
-
if (
|
|
222
|
+
if (Fe) {
|
|
221
223
|
u.config({
|
|
222
224
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
223
225
|
}), u.error("等待初始化"), u.config({
|
|
@@ -225,7 +227,7 @@ const ft = 10, ai = (N) => {
|
|
|
225
227
|
});
|
|
226
228
|
return;
|
|
227
229
|
}
|
|
228
|
-
if (!
|
|
230
|
+
if (!jt) {
|
|
229
231
|
u.config({
|
|
230
232
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
231
233
|
}), u.error("正在解析文件"), u.config({
|
|
@@ -233,7 +235,7 @@ const ft = 10, ai = (N) => {
|
|
|
233
235
|
});
|
|
234
236
|
return;
|
|
235
237
|
}
|
|
236
|
-
if (
|
|
238
|
+
if (De) {
|
|
237
239
|
u.config({
|
|
238
240
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
239
241
|
}), u.error("正在上传图片"), u.config({
|
|
@@ -248,8 +250,8 @@ const ft = 10, ai = (N) => {
|
|
|
248
250
|
netOpen: R ? $.OPEN : $.CLOSE
|
|
249
251
|
}).then((b) => {
|
|
250
252
|
var A, ee;
|
|
251
|
-
M(!0), x(!!((A = b.data) != null && A.netOpen)), _(!!((ee = b.data) != null && ee.enableNetOpen)),
|
|
252
|
-
k == null || k(b), M(!1),
|
|
253
|
+
M(!0), x(!!((A = b.data) != null && A.netOpen)), _(!!((ee = b.data) != null && ee.enableNetOpen)), We(b).then(() => {
|
|
254
|
+
k == null || k(b), M(!1), Te(n);
|
|
253
255
|
});
|
|
254
256
|
});
|
|
255
257
|
return;
|
|
@@ -265,7 +267,7 @@ ${n}` : n;
|
|
|
265
267
|
message: {
|
|
266
268
|
content: l,
|
|
267
269
|
sessionId: i,
|
|
268
|
-
role:
|
|
270
|
+
role: ht.User,
|
|
269
271
|
files: se[i]
|
|
270
272
|
}
|
|
271
273
|
}) : r = !0;
|
|
@@ -275,11 +277,11 @@ ${n}` : n;
|
|
|
275
277
|
if (ce(!1), r === !1)
|
|
276
278
|
return;
|
|
277
279
|
let d = n;
|
|
278
|
-
typeof r == "object" && (d = r.content || n), (yield e.setPromptVariables(O)) && (((
|
|
279
|
-
}),
|
|
280
|
+
typeof r == "object" && (d = r.content || n), (yield e.setPromptVariables(O)) && (((T = se[i]) == null ? void 0 : T.length) > 0 ? Wt(d) : Ne(d));
|
|
281
|
+
}), We = (t) => new Promise((n, a) => j(void 0, null, function* () {
|
|
280
282
|
const r = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === he.User || d.type === void 0) && d.key === "query") && !((d.type === he.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
|
|
281
283
|
var y;
|
|
282
|
-
const I = (y = O.find((
|
|
284
|
+
const I = (y = O.find((T) => T.key === d.key && T.type === d.type)) == null ? void 0 : y.value;
|
|
283
285
|
return d.value = I || "", d;
|
|
284
286
|
});
|
|
285
287
|
de(r.sort((d, I) => d.key.localeCompare(I.key))), yield t == null ? void 0 : t.setPromptVariables(r).catch((d) => {
|
|
@@ -289,7 +291,7 @@ ${n}` : n;
|
|
|
289
291
|
getContainer: void 0
|
|
290
292
|
});
|
|
291
293
|
}), n();
|
|
292
|
-
})),
|
|
294
|
+
})), Wt = (t) => {
|
|
293
295
|
var r, d, I;
|
|
294
296
|
if (le(!1), !((r = e == null ? void 0 : e.data) != null && r.id) || !(o != null && o.id))
|
|
295
297
|
return;
|
|
@@ -297,17 +299,17 @@ ${n}` : n;
|
|
|
297
299
|
let i = [], l = /* @__PURE__ */ new Set();
|
|
298
300
|
(I = se[n]) == null || I.forEach((y) => {
|
|
299
301
|
l.has(y.id) || (i.push(y), l.add(y.id));
|
|
300
|
-
}), Promise.all(i.map((y) =>
|
|
302
|
+
}), Promise.all(i.map((y) => P == null ? void 0 : P.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
|
|
301
303
|
enabled: 1
|
|
302
|
-
}).then((
|
|
304
|
+
}).then((T) => {
|
|
303
305
|
a.push(y);
|
|
304
306
|
}))).then((y) => {
|
|
305
|
-
le(!0),
|
|
307
|
+
le(!0), Ne(t, a);
|
|
306
308
|
}).catch((y) => {
|
|
307
309
|
throw Error(y);
|
|
308
310
|
});
|
|
309
311
|
};
|
|
310
|
-
|
|
312
|
+
E(() => {
|
|
311
313
|
if (!ye || !e)
|
|
312
314
|
return;
|
|
313
315
|
const t = ye, n = () => j(void 0, null, function* () {
|
|
@@ -322,21 +324,21 @@ ${t}` : t;
|
|
|
322
324
|
message: {
|
|
323
325
|
content: a,
|
|
324
326
|
sessionId: e.id,
|
|
325
|
-
role:
|
|
327
|
+
role: ht.User,
|
|
326
328
|
files: se[e.id]
|
|
327
329
|
}
|
|
328
330
|
}) : i = !0;
|
|
329
331
|
} catch (l) {
|
|
330
332
|
i = !1;
|
|
331
333
|
}
|
|
332
|
-
ce(!1), i !== !1 && (
|
|
334
|
+
ce(!1), i !== !1 && (Ne(t), Te(void 0));
|
|
333
335
|
});
|
|
334
336
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
335
337
|
e == null || e.removeEventListener("ready", n);
|
|
336
338
|
};
|
|
337
339
|
}, [ye, e]);
|
|
338
|
-
const
|
|
339
|
-
var y,
|
|
340
|
+
const Ne = (t, n) => j(void 0, null, function* () {
|
|
341
|
+
var y, T;
|
|
340
342
|
const a = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
|
|
341
343
|
if (!a)
|
|
342
344
|
return;
|
|
@@ -351,7 +353,7 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
351
353
|
const r = new te("", a, X.System);
|
|
352
354
|
r.isWaiting = !0, m.current = [r, ...m.current], L(m.current);
|
|
353
355
|
const d = (n == null ? void 0 : n.map((b) => b.id)) || [], I = {
|
|
354
|
-
stream:
|
|
356
|
+
stream: yn.stream,
|
|
355
357
|
referenceFirst: !1
|
|
356
358
|
};
|
|
357
359
|
if (g != null && g.promptVariables) {
|
|
@@ -359,7 +361,7 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
359
361
|
I.formatValues = b;
|
|
360
362
|
}
|
|
361
363
|
if (g != null && g.knowledges) {
|
|
362
|
-
const b =
|
|
364
|
+
const b = Bt;
|
|
363
365
|
I.knowledges = b;
|
|
364
366
|
}
|
|
365
367
|
yield e.send({
|
|
@@ -368,22 +370,22 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
368
370
|
files: n
|
|
369
371
|
}, I), re({
|
|
370
372
|
[a]: []
|
|
371
|
-
}), (
|
|
373
|
+
}), (T = ae.current) == null || T.update();
|
|
372
374
|
});
|
|
373
|
-
|
|
375
|
+
E(() => {
|
|
374
376
|
var a;
|
|
375
377
|
const t = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
376
378
|
if (!t)
|
|
377
379
|
return;
|
|
378
380
|
const n = (i) => {
|
|
379
|
-
if (!i.sessionId || i.sessionId && i.sessionId !==
|
|
381
|
+
if (!i.sessionId || i.sessionId && i.sessionId !== Re.current || i.role === X.User)
|
|
380
382
|
return;
|
|
381
383
|
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (U(!1), V(!1), m.current = m.current.filter((d) => !d.isWaiting), L([...m.current]), m.current = [...m.current], i.content))
|
|
382
384
|
return ge.error({
|
|
383
385
|
message: i.content
|
|
384
386
|
});
|
|
385
387
|
const l = i.actions || [], r = new te(i.content, t, X.Robot);
|
|
386
|
-
r.messageId = i.messageId ||
|
|
388
|
+
r.messageId = i.messageId || Pe(), r.reasoningContent = i.reasoningContent, r.searchReference = i.searchReference, r.thinkingSecs = i.thinkingSecs, r.thinkingStatus = i.thinkingStatus, r.actions = l, r.isLoading = !0, r.searchingStatus = i.searchingStatus, m.current = m.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && L([r, ...m.current]), i.code === 11915 && (U(!1), V(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, L([r, ...m.current])), i.index === -2 && (U(!1), V(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, L([r, ...m.current])), i.index === -1 && (U(!1), V(!1), r.isLoading = !1, r.reference = i.reference, L([r, ...m.current]), o.id && ie && ie({
|
|
387
389
|
applicationId: o.id,
|
|
388
390
|
sessionId: t,
|
|
389
391
|
message: r
|
|
@@ -394,7 +396,7 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
394
396
|
}), () => {
|
|
395
397
|
e == null || e.removeEventListener("message:updated", n);
|
|
396
398
|
};
|
|
397
|
-
}, [e]),
|
|
399
|
+
}, [e]), E(() => {
|
|
398
400
|
if (!e) {
|
|
399
401
|
ve(!1);
|
|
400
402
|
return;
|
|
@@ -405,50 +407,50 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
405
407
|
return ve(e.frozen), e.addEventListener("frozen", t), () => {
|
|
406
408
|
e == null || e.removeEventListener("frozen", t);
|
|
407
409
|
};
|
|
408
|
-
}, [e]),
|
|
410
|
+
}, [e]), E(() => {
|
|
409
411
|
if (!C)
|
|
410
412
|
return;
|
|
411
413
|
const t = C.questionContextMaxLength || 4e3;
|
|
412
|
-
|
|
413
|
-
}, [C,
|
|
414
|
+
Pt(t);
|
|
415
|
+
}, [C, P]), E(() => {
|
|
414
416
|
pe && Q(pe.text);
|
|
415
417
|
}, [pe]);
|
|
416
|
-
const
|
|
418
|
+
const Qt = (t) => {
|
|
417
419
|
const n = t.size;
|
|
418
420
|
return n <= 0 ? (u.config({
|
|
419
421
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
420
422
|
}), u.error("该文件为空,请重新上传"), u.config({
|
|
421
423
|
getContainer: void 0
|
|
422
|
-
}), !1) : n > 20 *
|
|
424
|
+
}), !1) : n > 20 * pn ? (u.config({
|
|
423
425
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
424
426
|
}), u.error("图片须小于20M"), u.config({
|
|
425
427
|
getContainer: void 0
|
|
426
428
|
}), !1) : (Y(t), !1);
|
|
427
|
-
},
|
|
429
|
+
}, _t = (t) => j(void 0, null, function* () {
|
|
428
430
|
var n;
|
|
429
|
-
return Y(t), (n = e == null ? void 0 : e.data) != null && n.id ?
|
|
431
|
+
return Y(t), (n = e == null ? void 0 : e.data) != null && n.id ? Qe(e, t) : new Promise((a) => {
|
|
430
432
|
M(!0), w == null || w({
|
|
431
433
|
netOpen: R ? $.OPEN : $.CLOSE
|
|
432
434
|
}).then((i) => {
|
|
433
435
|
var l, r;
|
|
434
|
-
k == null || k(i), M(!1), x(!!((l = i.data) != null && l.netOpen)), _(!!((r = i.data) != null && r.enableNetOpen)), a(
|
|
436
|
+
k == null || k(i), M(!1), x(!!((l = i.data) != null && l.netOpen)), _(!!((r = i.data) != null && r.enableNetOpen)), a(Qe(i, t));
|
|
435
437
|
});
|
|
436
438
|
});
|
|
437
|
-
}),
|
|
438
|
-
const a =
|
|
439
|
+
}), Qe = (t, n) => {
|
|
440
|
+
const a = kn(n.name);
|
|
439
441
|
return new Promise((i) => {
|
|
440
442
|
var r;
|
|
441
443
|
const l = {
|
|
442
|
-
files: [`${
|
|
444
|
+
files: [`${Pe()}.${a}`],
|
|
443
445
|
isv: "minio",
|
|
444
446
|
knowledgeId: ((r = t.data) == null ? void 0 : r.id) || "",
|
|
445
447
|
type: 1
|
|
446
448
|
};
|
|
447
|
-
ke(!0),
|
|
448
|
-
|
|
449
|
+
ke(!0), P == null || P.postTicket(l).then((d) => {
|
|
450
|
+
P.uploadMinioFile(d.minio, n).then(() => {
|
|
449
451
|
var b, A;
|
|
450
|
-
const I = (b = d.minio.endpoints) == null ? void 0 : b[0], y = d.minio.bucket,
|
|
451
|
-
i(`${location.protocol}//${I}/${y}/${
|
|
452
|
+
const I = (b = d.minio.endpoints) == null ? void 0 : b[0], y = d.minio.bucket, T = (A = d.minio.fileKeys) == null ? void 0 : A[0];
|
|
453
|
+
i(`${location.protocol}//${I}/${y}/${T}`);
|
|
452
454
|
}).catch(() => {
|
|
453
455
|
oe(""), Y(void 0);
|
|
454
456
|
}).finally(() => {
|
|
@@ -459,26 +461,26 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
459
461
|
});
|
|
460
462
|
});
|
|
461
463
|
};
|
|
462
|
-
|
|
464
|
+
E(() => {
|
|
463
465
|
const t = F.current;
|
|
464
|
-
t && !
|
|
466
|
+
t && !Ae && t.scrollTo({
|
|
465
467
|
top: t.scrollHeight
|
|
466
468
|
});
|
|
467
469
|
}, [v]);
|
|
468
|
-
const
|
|
470
|
+
const _e = (t, n) => new Promise((a) => {
|
|
469
471
|
if (!n.file.url || !(o != null && o.id))
|
|
470
472
|
return a();
|
|
471
|
-
const i =
|
|
473
|
+
const i = ft(ct({}, n.file), {
|
|
472
474
|
type: 1
|
|
473
475
|
});
|
|
474
|
-
|
|
476
|
+
P == null || P.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
|
|
475
477
|
var l;
|
|
476
478
|
(l = ae.current) == null || l.update().finally(a);
|
|
477
479
|
});
|
|
478
|
-
}),
|
|
480
|
+
}), Gt = () => {
|
|
479
481
|
var t;
|
|
480
482
|
(t = e == null ? void 0 : e.data) != null && t.id && (U(!1), e.suspend());
|
|
481
|
-
},
|
|
483
|
+
}, Xt = (t) => {
|
|
482
484
|
const n = F.current;
|
|
483
485
|
n && setTimeout(() => {
|
|
484
486
|
n.scrollTo({
|
|
@@ -486,17 +488,17 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
486
488
|
behavior: t == null ? void 0 : t.behavior
|
|
487
489
|
});
|
|
488
490
|
}, t == null ? void 0 : t.ms);
|
|
489
|
-
},
|
|
491
|
+
}, Zt = () => {
|
|
490
492
|
if (!F.current)
|
|
491
493
|
return;
|
|
492
494
|
const t = F.current.scrollTop <= -80;
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
+
At(t);
|
|
496
|
+
}, Jt = Ee((t) => {
|
|
495
497
|
var n, a;
|
|
496
498
|
(n = be.current) == null || n.update(t), (a = be.current) == null || a.focus();
|
|
497
|
-
}),
|
|
498
|
-
|
|
499
|
-
}),
|
|
499
|
+
}), St = Ee((t) => {
|
|
500
|
+
Ke(t);
|
|
501
|
+
}), en = Ee(() => {
|
|
500
502
|
var n;
|
|
501
503
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
502
504
|
return;
|
|
@@ -504,18 +506,18 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
504
506
|
const t = new te("", e.data.id, X.System);
|
|
505
507
|
t.isWaiting = !0, m.current = [t, ...m.current], L(m.current), V(!0), U(!0), e.answerAgain();
|
|
506
508
|
});
|
|
507
|
-
|
|
509
|
+
E(() => {
|
|
508
510
|
var t, n;
|
|
509
|
-
|
|
511
|
+
Re.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Be && ((n = we.current) == null || n.clear());
|
|
510
512
|
}, [e]);
|
|
511
|
-
const
|
|
513
|
+
const tn = () => {
|
|
512
514
|
var a;
|
|
513
515
|
if (!((a = e == null ? void 0 : e.data) != null && a.id))
|
|
514
516
|
return;
|
|
515
517
|
const n = v[v.length - 1].messageTime;
|
|
516
518
|
e.fetchMessages({
|
|
517
519
|
endTime: n,
|
|
518
|
-
pageSize:
|
|
520
|
+
pageSize: yt
|
|
519
521
|
}).then((i) => {
|
|
520
522
|
const l = i || [];
|
|
521
523
|
if (!l || !(l != null && l.length)) {
|
|
@@ -524,7 +526,7 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
524
526
|
}
|
|
525
527
|
l.length < 10 ? S(!1) : S(!0), L([...v, ...l.reverse()]);
|
|
526
528
|
});
|
|
527
|
-
},
|
|
529
|
+
}, nn = (t) => j(void 0, null, function* () {
|
|
528
530
|
var n, a;
|
|
529
531
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
530
532
|
x(t);
|
|
@@ -533,15 +535,15 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
533
535
|
return;
|
|
534
536
|
x(t);
|
|
535
537
|
}
|
|
536
|
-
}),
|
|
538
|
+
}), Le = () => j(void 0, null, function* () {
|
|
537
539
|
e ? e.fetchData().then((t) => {
|
|
538
540
|
var n;
|
|
539
541
|
(n = e == null ? void 0 : e.data) != null && n.id && (x(t.netOpen), _(t.enableNetOpen));
|
|
540
542
|
}) : (x(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), _(o.arrange[0].enableNetOpen));
|
|
541
543
|
});
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}, [e]),
|
|
544
|
+
E(() => {
|
|
545
|
+
Le();
|
|
546
|
+
}, [e]), E(() => {
|
|
545
547
|
var t, n;
|
|
546
548
|
if (F.current) {
|
|
547
549
|
const a = document.getElementById("chat-main"), i = (t = F.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = F.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
|
|
@@ -558,14 +560,14 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
558
560
|
i.style.height = "auto";
|
|
559
561
|
}
|
|
560
562
|
}
|
|
561
|
-
}, [v]),
|
|
563
|
+
}, [v]), E(() => {
|
|
562
564
|
if (e)
|
|
563
565
|
return;
|
|
564
566
|
const t = () => {
|
|
565
567
|
const i = ((C == null ? void 0 : C.promptVariables) || []).filter((l) => l.type ? !(l.type === he.User && l.key === "query") && !(l.type === he.System && l.key === "datetime") && l.status === 1 : l.key !== "query" && l.status === 1).map((l, r) => {
|
|
566
568
|
var I, y;
|
|
567
569
|
let d = "";
|
|
568
|
-
return typeof (s == null ? void 0 : s.promptVariables) == "object" && (d = ((y = (I = s.promptVariables.default) == null ? void 0 : I.find((
|
|
570
|
+
return typeof (s == null ? void 0 : s.promptVariables) == "object" && (d = ((y = (I = s.promptVariables.default) == null ? void 0 : I.find((T) => T.key === l.key && T.type === l.type)) == null ? void 0 : y.value) || ""), {
|
|
569
571
|
id: r + "",
|
|
570
572
|
key: l.key,
|
|
571
573
|
name: l.name,
|
|
@@ -579,14 +581,14 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
579
581
|
C == null || C.removeEventListener("ready", t);
|
|
580
582
|
};
|
|
581
583
|
}, [e, C, s == null ? void 0 : s.promptVariables]);
|
|
582
|
-
const
|
|
584
|
+
const Ge = () => w == null ? void 0 : w({
|
|
583
585
|
netOpen: R ? $.OPEN : $.CLOSE
|
|
584
586
|
}).then((t) => {
|
|
585
587
|
var n, a;
|
|
586
|
-
return k == null || k(t), M(!1), x(!!((n = t.data) != null && n.netOpen)), _(!!((a = t.data) != null && a.enableNetOpen)),
|
|
587
|
-
}),
|
|
588
|
+
return k == null || k(t), M(!1), x(!!((n = t.data) != null && n.netOpen)), _(!!((a = t.data) != null && a.enableNetOpen)), We(t), t;
|
|
589
|
+
}), Xe = gt(() => {
|
|
588
590
|
var t;
|
|
589
|
-
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(
|
|
591
|
+
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(pt, {
|
|
590
592
|
application: o,
|
|
591
593
|
history: {
|
|
592
594
|
role: 1,
|
|
@@ -596,7 +598,7 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
596
598
|
sessionId: "",
|
|
597
599
|
reference: [],
|
|
598
600
|
searchReference: [],
|
|
599
|
-
messageTime:
|
|
601
|
+
messageTime: vt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
|
|
600
602
|
actions: [],
|
|
601
603
|
isLoading: !1
|
|
602
604
|
},
|
|
@@ -604,180 +606,163 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
604
606
|
markdown: s == null ? void 0 : s.markdown
|
|
605
607
|
}) : null;
|
|
606
608
|
}, [o == null ? void 0 : o.arrange, v]);
|
|
607
|
-
return /* @__PURE__ */
|
|
609
|
+
return /* @__PURE__ */ c("div", {
|
|
608
610
|
className: "agent-chat",
|
|
609
|
-
children:
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
className: "chat-main
|
|
622
|
-
id: "
|
|
623
|
-
style:
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
flexDirection: "column-reverse"
|
|
628
|
-
},
|
|
629
|
-
ref: F,
|
|
630
|
-
onScroll: Kt,
|
|
631
|
-
children: (Ge = e == null ? void 0 : e.data) != null && Ge.id && (v != null && v.length) ? /* @__PURE__ */ B(Cn, {
|
|
632
|
-
dataLength: v.length,
|
|
633
|
-
next: Gt,
|
|
611
|
+
children: Yt ? /* @__PURE__ */ c("div", {
|
|
612
|
+
className: "session-loading",
|
|
613
|
+
children: /* @__PURE__ */ c(ut, {})
|
|
614
|
+
}) : /* @__PURE__ */ B(dn, {
|
|
615
|
+
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(Pn, {
|
|
616
|
+
ref: je,
|
|
617
|
+
appId: o.id,
|
|
618
|
+
currentSession: e,
|
|
619
|
+
promptVariables: O,
|
|
620
|
+
setPromptVariables: de,
|
|
621
|
+
setCurrentSession: k
|
|
622
|
+
}), /* @__PURE__ */ B("div", {
|
|
623
|
+
className: "chat-main",
|
|
624
|
+
id: "chat-main",
|
|
625
|
+
style: It,
|
|
626
|
+
children: [/* @__PURE__ */ c("div", {
|
|
627
|
+
className: "chat-main-wrapper",
|
|
628
|
+
id: "scrollableDiv",
|
|
634
629
|
style: {
|
|
630
|
+
height: "100%",
|
|
631
|
+
overflowY: "auto",
|
|
635
632
|
display: "flex",
|
|
636
|
-
flexDirection: "column-reverse"
|
|
637
|
-
overflowX: "hidden"
|
|
633
|
+
flexDirection: "column-reverse"
|
|
638
634
|
},
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
}) : null,
|
|
645
|
-
hasMore: Be,
|
|
646
|
-
loader: /* @__PURE__ */ c("div", {
|
|
635
|
+
ref: F,
|
|
636
|
+
onScroll: Zt,
|
|
637
|
+
children: (Je = e == null ? void 0 : e.data) != null && Je.id && (v != null && v.length) ? /* @__PURE__ */ B(Fn, {
|
|
638
|
+
dataLength: v.length,
|
|
639
|
+
next: tn,
|
|
647
640
|
style: {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
641
|
+
display: "flex",
|
|
642
|
+
flexDirection: "column-reverse",
|
|
643
|
+
overflowX: "hidden"
|
|
651
644
|
},
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
645
|
+
inverse: !0,
|
|
646
|
+
endMessage: v.length > yt && // 少于一页不展示这个提示
|
|
647
|
+
((Se = F.current) != null && Se.scrollTop) && ((et = F.current) == null ? void 0 : et.scrollTop) < -10 ? /* @__PURE__ */ c(gn, {
|
|
648
|
+
plain: !0,
|
|
649
|
+
children: "没有更多数据了"
|
|
650
|
+
}) : null,
|
|
651
|
+
hasMore: $e,
|
|
652
|
+
loader: /* @__PURE__ */ c("div", {
|
|
653
|
+
style: {
|
|
654
|
+
height: "50px",
|
|
655
|
+
textAlign: "center",
|
|
656
|
+
overflow: "hidden"
|
|
657
|
+
},
|
|
658
|
+
children: /* @__PURE__ */ c(ut, {})
|
|
659
|
+
}),
|
|
660
|
+
scrollableTarget: "scrollableDiv",
|
|
661
|
+
children: [v.map((t, n) => /* @__PURE__ */ c(Un, {
|
|
662
|
+
application: o,
|
|
663
|
+
currentSession: e,
|
|
664
|
+
history: t,
|
|
665
|
+
docViewerUrl: p,
|
|
666
|
+
isLastHistory: n === 0,
|
|
667
|
+
onRelatedClick: St,
|
|
668
|
+
onAgainClick: en,
|
|
669
|
+
onEditClick: Jt,
|
|
670
|
+
markdown: s == null ? void 0 : s.markdown
|
|
671
|
+
}, t.messageId + n)), !$e && Xe]
|
|
672
|
+
}) : /* @__PURE__ */ B("div", {
|
|
673
|
+
className: "main-empty",
|
|
674
|
+
children: [(s == null ? void 0 : s.greeting) !== !1 && /* @__PURE__ */ c(xn, {
|
|
675
|
+
text: s === void 0 || s.greeting === !0 || ((tt = s.greeting) == null ? void 0 : tt.text) === void 0 ? mt.text : s.greeting.text,
|
|
676
|
+
icon: s === void 0 || s.greeting === !0 || ((nt = s.greeting) == null ? void 0 : nt.icon) === void 0 ? Nt || mt.icon : s.greeting.icon,
|
|
677
|
+
children: !!He.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__ */ c(wn, {
|
|
678
|
+
ref: we,
|
|
679
|
+
sid: (it = e == null ? void 0 : e.data) == null ? void 0 : it.id,
|
|
680
|
+
isRecommendClearing: Ue,
|
|
681
|
+
data: He,
|
|
682
|
+
layoutBreakpoints: typeof (s == null ? void 0 : s.greeting) == "object" ? s.greeting.layoutBreakpoints : void 0,
|
|
683
|
+
onItemClick: (t) => {
|
|
684
|
+
var a, i, l;
|
|
685
|
+
if (ne(t == null ? void 0 : t.question), Q(t == null ? void 0 : t.question), Ue)
|
|
686
|
+
return;
|
|
687
|
+
t != null && t.id && W(!0);
|
|
688
|
+
const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
689
|
+
g != null && g.fileUpload ? (l = (i = ae.current) == null ? void 0 : i.clear()) == null || l.then(() => {
|
|
690
|
+
var r, d;
|
|
691
|
+
t != null && t.id && (n ? (r = _e(n, t)) == null || r.finally(() => {
|
|
690
692
|
W(!1);
|
|
691
|
-
})
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
size: "small",
|
|
707
|
-
icon: /* @__PURE__ */ c(ue, {
|
|
708
|
-
type: "icon-zantinghuida",
|
|
709
|
-
style: {
|
|
710
|
-
fontSize: 16
|
|
711
|
-
}
|
|
712
|
-
}),
|
|
713
|
-
onClick: () => qt(),
|
|
714
|
-
children: "停止回答"
|
|
715
|
-
})
|
|
716
|
-
}), Ve && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ c("div", {
|
|
717
|
-
className: "back-bottom",
|
|
718
|
-
children: /* @__PURE__ */ c(G, {
|
|
719
|
-
size: "small",
|
|
720
|
-
onClick: () => Yt({
|
|
721
|
-
behavior: "smooth"
|
|
722
|
-
}),
|
|
723
|
-
type: "link",
|
|
724
|
-
icon: /* @__PURE__ */ c(ue, {
|
|
725
|
-
type: "icon-yijianhuidaodibu",
|
|
693
|
+
}) : (W(!1), M(!0), (d = Ge()) == null || d.then((I) => {
|
|
694
|
+
var y;
|
|
695
|
+
(y = _e(I.id, t)) == null || y.finally(() => {
|
|
696
|
+
W(!1);
|
|
697
|
+
});
|
|
698
|
+
})));
|
|
699
|
+
}) : n ? W(!1) : (W(!1), M(!0), Ge());
|
|
700
|
+
}
|
|
701
|
+
})
|
|
702
|
+
}), Xe]
|
|
703
|
+
})
|
|
704
|
+
}), Ve && /* @__PURE__ */ c("div", {
|
|
705
|
+
className: "session-stop",
|
|
706
|
+
children: /* @__PURE__ */ c(G, {
|
|
707
|
+
type: "primary",
|
|
726
708
|
style: {
|
|
727
|
-
|
|
728
|
-
}
|
|
709
|
+
background: "white"
|
|
710
|
+
},
|
|
711
|
+
ghost: !0,
|
|
712
|
+
size: "small",
|
|
713
|
+
icon: /* @__PURE__ */ c(ue, {
|
|
714
|
+
type: "icon-zantinghuida",
|
|
715
|
+
style: {
|
|
716
|
+
fontSize: 16
|
|
717
|
+
}
|
|
718
|
+
}),
|
|
719
|
+
onClick: () => Gt(),
|
|
720
|
+
children: "停止回答"
|
|
729
721
|
})
|
|
730
|
-
})
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
remove: () => {
|
|
743
|
-
Y(void 0);
|
|
722
|
+
}), Ae && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ c("div", {
|
|
723
|
+
className: "back-bottom",
|
|
724
|
+
children: /* @__PURE__ */ c(G, {
|
|
725
|
+
size: "small",
|
|
726
|
+
onClick: () => Xt({
|
|
727
|
+
behavior: "smooth"
|
|
728
|
+
}),
|
|
729
|
+
type: "link",
|
|
730
|
+
icon: /* @__PURE__ */ c(ue, {
|
|
731
|
+
type: "icon-yijianhuidaodibu",
|
|
732
|
+
style: {
|
|
733
|
+
fontSize: 24
|
|
744
734
|
}
|
|
745
|
-
}
|
|
746
|
-
onUrlChange: (t) => oe(t)
|
|
735
|
+
})
|
|
747
736
|
})
|
|
748
|
-
})
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
737
|
+
})]
|
|
738
|
+
}), /* @__PURE__ */ c("div", {
|
|
739
|
+
className: "chat-footer",
|
|
740
|
+
children: /* @__PURE__ */ B("div", {
|
|
741
|
+
className: "chat-footer-input",
|
|
742
|
+
children: [J && /* @__PURE__ */ c("div", {
|
|
743
|
+
className: "input-files",
|
|
744
|
+
children: /* @__PURE__ */ c(vn, {
|
|
745
|
+
file: J,
|
|
746
|
+
actions: {
|
|
747
|
+
upload: _t,
|
|
748
|
+
remove: () => {
|
|
749
|
+
Y(void 0);
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
onUrlChange: (t) => oe(t)
|
|
753
|
+
})
|
|
754
|
+
}), /* @__PURE__ */ B(fe, {
|
|
755
|
+
className: "footer-upload-action",
|
|
756
|
+
onClick: (t) => t.preventDefault(),
|
|
757
|
+
children: [/* @__PURE__ */ B(fe, {
|
|
758
|
+
children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(un, {
|
|
767
759
|
disabled: !!J || D,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
}) : /* @__PURE__ */ c(dn, {
|
|
775
|
-
placement: "topLeft",
|
|
776
|
-
overlayClassName: "footer-upload-tooltip",
|
|
777
|
-
title: /* @__PURE__ */ c("div", {
|
|
778
|
-
children: "支持上传.jpg .png .jpeg .bmp格式的图片数据,最大20M,单次仅可上传1个"
|
|
779
|
-
}),
|
|
780
|
-
children: /* @__PURE__ */ c(G, {
|
|
760
|
+
accept: ".jpg, .png, .jpeg,.bmp",
|
|
761
|
+
listType: "picture-card",
|
|
762
|
+
beforeUpload: Qt,
|
|
763
|
+
className: "footer-upload-picture",
|
|
764
|
+
showUploadList: !1,
|
|
765
|
+
children: J ? /* @__PURE__ */ c(G, {
|
|
781
766
|
type: "text",
|
|
782
767
|
className: "camera-out-btn",
|
|
783
768
|
style: {
|
|
@@ -785,153 +770,175 @@ ${t}` : t, l = new te(i, a, X.User, n);
|
|
|
785
770
|
position: "relative",
|
|
786
771
|
bottom: "-2px"
|
|
787
772
|
},
|
|
788
|
-
|
|
789
|
-
|
|
773
|
+
disabled: !!J || D,
|
|
774
|
+
icon: /* @__PURE__ */ c(Nn, {
|
|
790
775
|
className: "icon-tianjia",
|
|
791
776
|
style: {
|
|
792
777
|
fontSize: "22px"
|
|
793
778
|
}
|
|
794
779
|
})
|
|
780
|
+
}) : /* @__PURE__ */ c(hn, {
|
|
781
|
+
placement: "topLeft",
|
|
782
|
+
overlayClassName: "footer-upload-tooltip",
|
|
783
|
+
title: /* @__PURE__ */ c("div", {
|
|
784
|
+
children: "支持上传.jpg .png .jpeg .bmp格式的图片数据,最大20M,单次仅可上传1个"
|
|
785
|
+
}),
|
|
786
|
+
children: /* @__PURE__ */ c(G, {
|
|
787
|
+
type: "text",
|
|
788
|
+
className: "camera-out-btn",
|
|
789
|
+
style: {
|
|
790
|
+
width: "22px",
|
|
791
|
+
position: "relative",
|
|
792
|
+
bottom: "-2px"
|
|
793
|
+
},
|
|
794
|
+
icon: /* @__PURE__ */ c(ue, {
|
|
795
|
+
type: "icon-Vector",
|
|
796
|
+
className: "icon-tianjia",
|
|
797
|
+
style: {
|
|
798
|
+
fontSize: "22px"
|
|
799
|
+
}
|
|
800
|
+
})
|
|
801
|
+
})
|
|
795
802
|
})
|
|
796
|
-
})
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
})
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
803
|
+
}), me && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(Cn, {
|
|
804
|
+
appId: o == null ? void 0 : o.id,
|
|
805
|
+
ref: ae,
|
|
806
|
+
isFirstSession: Be,
|
|
807
|
+
docViewerUrl: p,
|
|
808
|
+
onStatusChange: (t) => j(void 0, null, function* () {
|
|
809
|
+
t !== "process" ? (le(!0), Le()) : le(!1);
|
|
810
|
+
}),
|
|
811
|
+
createSession: () => new Promise((t) => {
|
|
812
|
+
M(!0), w == null || w({
|
|
813
|
+
netOpen: R ? $.OPEN : $.CLOSE
|
|
814
|
+
}).then((n) => {
|
|
815
|
+
var i, l, r;
|
|
816
|
+
k == null || k(n), M(!1), x(!!((i = n.data) != null && i.netOpen)), _(!!((l = n.data) != null && l.enableNetOpen));
|
|
817
|
+
const a = ((r = n.data) == null ? void 0 : r.id) || "";
|
|
818
|
+
t(a);
|
|
819
|
+
});
|
|
820
|
+
}),
|
|
821
|
+
sid: (ot = e == null ? void 0 : e.data) == null ? void 0 : ot.id,
|
|
822
|
+
disabled: xe || D,
|
|
823
|
+
afterFileAdd: (t, n) => {
|
|
824
|
+
n && re((a) => {
|
|
825
|
+
const i = a[n] || [];
|
|
826
|
+
return {
|
|
827
|
+
[n]: [...i, t]
|
|
828
|
+
};
|
|
829
|
+
});
|
|
830
|
+
},
|
|
831
|
+
afterFileDelete: (t) => {
|
|
832
|
+
var a;
|
|
833
|
+
const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
834
|
+
n && re((i) => {
|
|
835
|
+
const l = i[n] || [];
|
|
836
|
+
return {
|
|
837
|
+
[n]: l.filter((r) => r.id !== t)
|
|
838
|
+
};
|
|
839
|
+
});
|
|
840
|
+
},
|
|
841
|
+
onFileListChange: (t) => {
|
|
842
|
+
Mt(t);
|
|
843
|
+
},
|
|
844
|
+
shouldContinue: zt,
|
|
845
|
+
afterFilesClear: () => {
|
|
846
|
+
var n;
|
|
847
|
+
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
848
|
+
t && (re({
|
|
849
|
+
[t]: []
|
|
850
|
+
}), Le());
|
|
851
|
+
}
|
|
852
|
+
}) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(Dn, {
|
|
853
|
+
appId: o.id,
|
|
854
|
+
list: [],
|
|
855
|
+
search: Me ? Ft : "",
|
|
856
|
+
onPromptSelect: (t) => {
|
|
857
|
+
Q(t.context), ne(t.context);
|
|
858
|
+
},
|
|
859
|
+
disabled: D
|
|
860
|
+
})]
|
|
861
|
+
}), /* @__PURE__ */ B(fe, {
|
|
862
|
+
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((st = o.arrange) == null ? void 0 : st.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(Rn, {
|
|
863
|
+
sessionId: (rt = e == null ? void 0 : e.data) == null ? void 0 : rt.id,
|
|
864
|
+
netStatus: R,
|
|
865
|
+
enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) : qt,
|
|
866
|
+
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
867
|
+
onNetStatusChange: (t) => {
|
|
868
|
+
nn(t);
|
|
869
|
+
}
|
|
870
|
+
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(Tn, {
|
|
871
|
+
currentSessionId: (at = e == null ? void 0 : e.data) == null ? void 0 : at.id,
|
|
872
|
+
onSessionChange: (t, n) => {
|
|
873
|
+
Q(void 0), k == null || k(n);
|
|
874
|
+
},
|
|
875
|
+
disabled: D
|
|
876
|
+
}), Lt && Ct === "float" && /* @__PURE__ */ c(On, {
|
|
877
|
+
currentSession: e,
|
|
878
|
+
application: o,
|
|
879
|
+
networkStatus: R,
|
|
880
|
+
setCurrentSession: k,
|
|
881
|
+
sessions: Z,
|
|
882
|
+
setSessions: kt,
|
|
883
|
+
disabled: D
|
|
884
|
+
}), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(G, {
|
|
885
|
+
icon: /* @__PURE__ */ c(Ln, {}),
|
|
886
|
+
className: "add-btn",
|
|
887
|
+
type: "primary",
|
|
888
|
+
disabled: Ve || !e || !v.length || D,
|
|
889
|
+
onClick: () => {
|
|
890
|
+
var t, n;
|
|
891
|
+
k == null || k(null), x(!1), (t = je.current) == null || t.clear(), (n = we.current) == null || n.clear();
|
|
892
|
+
},
|
|
893
|
+
children: "新会话"
|
|
894
|
+
})]
|
|
854
895
|
})]
|
|
855
|
-
}), /* @__PURE__ */
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
896
|
+
}), /* @__PURE__ */ c("div", {
|
|
897
|
+
className: "footer-textarea",
|
|
898
|
+
children: /* @__PURE__ */ c(bn, {
|
|
899
|
+
ref: be,
|
|
900
|
+
maxLength: Et,
|
|
901
|
+
text: Dt,
|
|
902
|
+
networkStatus: !1,
|
|
903
|
+
loading: qe,
|
|
904
|
+
disabled: Fe || De || D || qe,
|
|
905
|
+
onTextSend: Ke,
|
|
906
|
+
onChange: (t, n) => {
|
|
907
|
+
Q(t);
|
|
908
|
+
const a = n.getText().replace(/[\n\s]+$/, "");
|
|
909
|
+
ne(a), Rt(a), Me || Ot(!0);
|
|
868
910
|
},
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
onClick: () => {
|
|
884
|
-
var t, n;
|
|
885
|
-
k == null || k(void 0), x(!1), (t = Me.current) == null || t.clear(), (n = we.current) == null || n.clear();
|
|
886
|
-
},
|
|
887
|
-
children: "新会话"
|
|
888
|
-
})]
|
|
889
|
-
})]
|
|
890
|
-
}), /* @__PURE__ */ c("div", {
|
|
891
|
-
className: "footer-textarea",
|
|
892
|
-
children: /* @__PURE__ */ c(mn, {
|
|
893
|
-
ref: be,
|
|
894
|
-
maxLength: xt,
|
|
895
|
-
text: Pt,
|
|
896
|
-
networkStatus: !1,
|
|
897
|
-
loading: $e,
|
|
898
|
-
disabled: Oe || Re || D || $e,
|
|
899
|
-
onTextSend: qe,
|
|
900
|
-
onChange: (t, n) => {
|
|
901
|
-
Q(t);
|
|
902
|
-
const a = n.getText().replace(/[\n\s]+$/, "");
|
|
903
|
-
ne(a), Et(a), Ue || Lt(!0);
|
|
904
|
-
},
|
|
905
|
-
clearAction: /* @__PURE__ */ c(fe, {
|
|
906
|
-
size: 0,
|
|
907
|
-
children: /* @__PURE__ */ c(G, {
|
|
908
|
-
type: "link",
|
|
909
|
-
disabled: xe || D,
|
|
910
|
-
ghost: !0,
|
|
911
|
-
icon: /* @__PURE__ */ c(ue, {
|
|
912
|
-
style: {
|
|
913
|
-
fontSize: 22
|
|
914
|
-
},
|
|
915
|
-
type: "icon-qingchujiyi"
|
|
916
|
-
}),
|
|
917
|
-
onClick: () => Vt()
|
|
911
|
+
clearAction: /* @__PURE__ */ c(fe, {
|
|
912
|
+
size: 0,
|
|
913
|
+
children: /* @__PURE__ */ c(G, {
|
|
914
|
+
type: "link",
|
|
915
|
+
disabled: xe || D,
|
|
916
|
+
ghost: !0,
|
|
917
|
+
icon: /* @__PURE__ */ c(ue, {
|
|
918
|
+
style: {
|
|
919
|
+
fontSize: 22
|
|
920
|
+
},
|
|
921
|
+
type: "icon-qingchujiyi"
|
|
922
|
+
}),
|
|
923
|
+
onClick: () => Kt()
|
|
924
|
+
})
|
|
918
925
|
})
|
|
919
926
|
})
|
|
920
|
-
})
|
|
921
|
-
})
|
|
922
|
-
})
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
}
|
|
932
|
-
})
|
|
927
|
+
})]
|
|
928
|
+
})
|
|
929
|
+
}), /* @__PURE__ */ c(In, {
|
|
930
|
+
tips: xt
|
|
931
|
+
}), ze && /* @__PURE__ */ c(En, {
|
|
932
|
+
isvisible: ze,
|
|
933
|
+
files: Ut,
|
|
934
|
+
sessionId: (lt = e == null ? void 0 : e.data) == null ? void 0 : lt.id,
|
|
935
|
+
onClose: (t) => {
|
|
936
|
+
Ht(!1), Vt(!1);
|
|
937
|
+
}
|
|
938
|
+
})]
|
|
939
|
+
})
|
|
933
940
|
});
|
|
934
941
|
};
|
|
935
942
|
export {
|
|
936
|
-
|
|
943
|
+
gi as default
|
|
937
944
|
};
|