@glodon-aiot/agent-cli-ui 3.19.0-alpha.19 → 3.19.0-alpha.21
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/HistoryItem/FileItem/index.mjs +52 -59
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionAction/index.mjs +67 -70
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +100 -103
- package/dist/es/Dialog/AgentChat/Tools/SessionListDrawer/HistorySessionList/index.mjs +76 -87
- package/dist/es/Dialog/AgentChat/Tools/UploadKnowledgeFiles/index.mjs +121 -124
- package/dist/es/Dialog/AgentChat/index.mjs +199 -202
- package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +150 -157
- package/dist/es/components/Recommend/RecommendItem.mjs +33 -36
- 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/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style19.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style29.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/utils/scopedMessage.mjs +29 -0
- package/dist/lib/index.js +53 -53
- package/dist/src/utils/scopedMessage.d.ts +7 -0
- package/package.json +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Mn = Object.defineProperty, jn = Object.defineProperties;
|
|
2
|
+
var $n = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var jt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Me = (k, h, i) => h in k ?
|
|
4
|
+
var zn = Object.prototype.hasOwnProperty, Vn = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Me = (k, h, i) => h in k ? Mn(k, h, { enumerable: !0, configurable: !0, writable: !0, value: i }) : k[h] = i, je = (k, h) => {
|
|
6
6
|
for (var i in h || (h = {}))
|
|
7
|
-
|
|
7
|
+
zn.call(h, i) && Me(k, i, h[i]);
|
|
8
8
|
if (jt)
|
|
9
9
|
for (var i of jt(h))
|
|
10
|
-
|
|
10
|
+
Vn.call(h, i) && Me(k, i, h[i]);
|
|
11
11
|
return k;
|
|
12
|
-
}, $e = (k, h) =>
|
|
12
|
+
}, $e = (k, h) => jn(k, $n(h));
|
|
13
13
|
var j = (k, h, i) => (Me(k, typeof h != "symbol" ? h + "" : h, i), i);
|
|
14
14
|
var $ = (k, h, i) => new Promise((U, e) => {
|
|
15
15
|
var C = (D) => {
|
|
@@ -18,46 +18,47 @@ var $ = (k, h, i) => new Promise((U, e) => {
|
|
|
18
18
|
} catch (O) {
|
|
19
19
|
e(O);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, z = (D) => {
|
|
22
22
|
try {
|
|
23
23
|
b(i.throw(D));
|
|
24
24
|
} catch (O) {
|
|
25
25
|
e(O);
|
|
26
26
|
}
|
|
27
|
-
}, b = (D) => D.done ? U(D.value) : Promise.resolve(D.value).then(C,
|
|
27
|
+
}, b = (D) => D.done ? U(D.value) : Promise.resolve(D.value).then(C, z);
|
|
28
28
|
b((i = i.apply(k, h)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as g, jsxs as F, Fragment as
|
|
31
|
-
import { memo as
|
|
32
|
-
/* empty css */import {
|
|
30
|
+
import { jsx as g, jsxs as F, Fragment as Bn } from "react/jsx-runtime";
|
|
31
|
+
import { memo as _n, forwardRef as qn, useState as p, useRef as K, useContext as Wn, useEffect as E, useMemo as Kn, useImperativeHandle as Yn } from "react";
|
|
32
|
+
/* empty css */import { Spin as $t, Divider as Sn, Button as G, Space as Ne, Upload as Qn, Tooltip as Xn, Popover as Gn, notification as se, message as Zn } from "antd";
|
|
33
33
|
import re from "../../components/Iconfont/index.mjs";
|
|
34
|
-
import { IHistoryRole as ae, ApplicationTypes as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
34
|
+
import { IHistoryRole as ae, ApplicationTypes as Y, ChatMessageRole as zt, PromptVariableType as Ee } from "@glodon-aiot/apis";
|
|
35
|
+
import Wt from "./HistoryItem/index.mjs";
|
|
36
|
+
import Kt from "dayjs";
|
|
37
37
|
import { v4 as _e } from "uuid";
|
|
38
38
|
import Jn from "../../context.mjs";
|
|
39
39
|
import { configuration as ei } from "@glodon-aiot/bot-client-sdk";
|
|
40
|
-
import { MAX_KNOWLEDGES_AND_FILES_COUNT as
|
|
40
|
+
import { MAX_KNOWLEDGES_AND_FILES_COUNT as Vt, NET_OPEN_STATUS as le, MB as ti } from "../../constant.mjs";
|
|
41
41
|
import ni from "../../components/FilePreview/index.mjs";
|
|
42
|
-
import { calcKnowledgesLeafCount as ii, getImageExtension as
|
|
43
|
-
import si from "../../
|
|
44
|
-
import ri from "../../
|
|
45
|
-
import ai from "../../components/
|
|
46
|
-
import li from "../../
|
|
47
|
-
import
|
|
48
|
-
import di from "
|
|
49
|
-
import fi from "
|
|
50
|
-
import gi from "
|
|
42
|
+
import { calcKnowledgesLeafCount as ii, getImageExtension as Bt, fileTypes as oi } from "../../utils/index.mjs";
|
|
43
|
+
import { withAgentCliMessage as si } from "../../utils/scopedMessage.mjs";
|
|
44
|
+
import ri from "../../QuillEditor/index.mjs";
|
|
45
|
+
import ai from "../../components/Recommend/index.mjs";
|
|
46
|
+
import li from "../../components/Greeting/index.mjs";
|
|
47
|
+
import ci from "../../Footer/index.mjs";
|
|
48
|
+
import { PlusOutlined as di } from "@ant-design/icons";
|
|
49
|
+
import fi from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
50
|
+
import gi from "../UploadingPrompt/index.mjs";
|
|
51
|
+
import ui from "./PromptSetting/index.mjs";
|
|
51
52
|
import { useMemoizedFn as ze } from "ahooks";
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import { useSessionState as
|
|
58
|
-
import
|
|
59
|
-
const
|
|
60
|
-
icon:
|
|
53
|
+
import pi from "./Tools/SessionListDrawer/index.mjs";
|
|
54
|
+
import hi from "./Tools/SessionHistoryDrawer/index.mjs";
|
|
55
|
+
import mi from "react-infinite-scroll-component";
|
|
56
|
+
import yi from "./Tools/ConnectToNetwork/index.mjs";
|
|
57
|
+
import vi from "./Tools/PromptManager/index.mjs";
|
|
58
|
+
import { useSessionState as wi } from "../../hooks/useSessionState.mjs";
|
|
59
|
+
import ki from "../../assets/icon.svg.mjs";
|
|
60
|
+
const bi = _n(Wt), _t = {
|
|
61
|
+
icon: ki,
|
|
61
62
|
text: "今天我能帮你什么?"
|
|
62
63
|
};
|
|
63
64
|
class he {
|
|
@@ -73,113 +74,113 @@ class he {
|
|
|
73
74
|
j(this, "imageContent");
|
|
74
75
|
// 新增:支持对话型应用的图片内容
|
|
75
76
|
j(this, "comment");
|
|
76
|
-
this.content = h, this.sessionId = i, this.role = U, this.files = e, this.content = h, this.role = U, this.sessionId = i, this.files = e, this.imageContent = C, this.messageTime =
|
|
77
|
+
this.content = h, this.sessionId = i, this.role = U, this.files = e, this.content = h, this.role = U, this.sessionId = i, this.files = e, this.imageContent = C, this.messageTime = Kt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = _e(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
77
78
|
isAgree: 0
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
const
|
|
82
|
+
const qt = 10, Z = 5, Ve = 20, Be = (k, h, i, U) => {
|
|
82
83
|
let e = k;
|
|
83
|
-
if (U ===
|
|
84
|
+
if (U === Y.Agent) {
|
|
84
85
|
if (i && i.length > 0) {
|
|
85
|
-
const C = i.map((
|
|
86
|
+
const C = i.map((z) => `[${z.name.replace(/\.[^/.]+$/, "")}](${z.url})`).join(`
|
|
86
87
|
`);
|
|
87
88
|
e = C ? `${C}
|
|
88
89
|
${e}` : e;
|
|
89
90
|
}
|
|
90
91
|
if (h && h.length > 0) {
|
|
91
|
-
const C = h.filter(Boolean).map((
|
|
92
|
+
const C = h.filter(Boolean).map((z) => ``).join(`
|
|
92
93
|
`);
|
|
93
94
|
e = C ? `${C}
|
|
94
95
|
${e}` : e;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
return e;
|
|
98
|
-
},
|
|
99
|
+
}, xi = (k) => {
|
|
99
100
|
const h = Math.floor(k / 3600), i = Math.floor(k % 3600 / 60), U = k % 60, e = (C) => String(C).padStart(2, "0");
|
|
100
101
|
return `${e(h)}:${e(i)}:${e(U)}`;
|
|
101
|
-
},
|
|
102
|
+
}, no = qn((k, h) => {
|
|
102
103
|
var bt, xt, Ct, It, Nt, Et, Lt, Pt, Tt, Dt, Ot, Rt, Ft, Ut;
|
|
103
104
|
const {
|
|
104
105
|
application: i,
|
|
105
106
|
docViewerUrl: U = "",
|
|
106
107
|
currentSession: e,
|
|
107
108
|
onCreateSession: C,
|
|
108
|
-
embeddingService:
|
|
109
|
+
embeddingService: z,
|
|
109
110
|
setCurrentSession: b,
|
|
110
111
|
networkStatus: D,
|
|
111
112
|
setNetworkStatus: O
|
|
112
|
-
} = k, [w, L] = p([]), [
|
|
113
|
-
service:
|
|
113
|
+
} = k, [w, L] = p([]), [Yt, me] = p(), [Le, qe] = p(), A = K(null), {
|
|
114
|
+
service: H,
|
|
114
115
|
agentClient: P,
|
|
115
|
-
depId:
|
|
116
|
-
footer:
|
|
116
|
+
depId: St,
|
|
117
|
+
footer: Qt,
|
|
117
118
|
transform: f,
|
|
118
119
|
defaultInput: Pe,
|
|
119
120
|
onMessage: ye,
|
|
120
121
|
onHistoryLoad: We,
|
|
121
|
-
beforeMessageSend:
|
|
122
|
-
bodyStyle:
|
|
122
|
+
beforeMessageSend: _,
|
|
123
|
+
bodyStyle: Xt,
|
|
123
124
|
disabled: R,
|
|
124
125
|
features: a,
|
|
125
|
-
popupContainer:
|
|
126
|
-
icon:
|
|
127
|
-
sider:
|
|
128
|
-
mode:
|
|
126
|
+
popupContainer: S,
|
|
127
|
+
icon: Gt,
|
|
128
|
+
sider: Zt,
|
|
129
|
+
mode: Jt,
|
|
129
130
|
silencedSeconds: Te
|
|
130
|
-
} =
|
|
131
|
+
} = Wn(Jn), [Ke, De] = p(!1), y = K(w), Ye = K(void 0), [en, tn] = p(0), [ce, ve] = p([]), [J, we] = p([]), [Se, Qe] = p(0), [Xe, nn] = p(!1);
|
|
131
132
|
E(() => {
|
|
132
|
-
|
|
133
|
+
nn(Se > 0);
|
|
133
134
|
}, [Se]);
|
|
134
|
-
const ke =
|
|
135
|
+
const ke = K(null), [Ge, on] = p([]), [Ze, ee] = p(!1), [Je, sn] = p(!1), [rn, an] = p(""), [ln, te] = p(), [ne, de] = p({}), fe = K(null), et = K(null), Oe = K(null), [tt, cn] = p(!1), [dn, fn] = p([]), [gn, be] = p(!0), [un, pn] = p(!0), [nt, V] = p(!1), [Re, q] = p(!1), [it, hn] = p(!1), [M, ge] = p(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [mn, yn] = p(() => {
|
|
135
136
|
const t = typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0;
|
|
136
137
|
if (t) {
|
|
137
138
|
if (Array.isArray(t) && t.some((r) => Array.isArray(r.fileIds) && r.fileIds.length === 0))
|
|
138
139
|
throw Error("fileIds cannot be an empty array");
|
|
139
|
-
if (ii(t) >
|
|
140
|
-
throw Error(`knowledges and fileIds total count cannot exceed ${
|
|
140
|
+
if (ii(t) > Vt)
|
|
141
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${Vt}`);
|
|
141
142
|
}
|
|
142
143
|
return t;
|
|
143
|
-
}), [ot, Q] = p(!1), [st, ue] = p(!1), [
|
|
144
|
+
}), [ot, Q] = p(!1), [st, ue] = p(!1), [vn, pe] = p(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [rt, xe] = p(!1), [wn, W] = p(!1), [kn, bn] = p(null), [Ce, X] = p(!1), [at, lt] = p(!1), {
|
|
144
145
|
isSwitchingToExistingSession: ct,
|
|
145
146
|
setIsSwitchingToExistingSession: Ie
|
|
146
|
-
} =
|
|
147
|
+
} = wi(), ie = K(null), [Fe, xn] = p("");
|
|
147
148
|
E(() => {
|
|
148
149
|
if (!Te)
|
|
149
150
|
return;
|
|
150
|
-
let t =
|
|
151
|
-
|
|
151
|
+
let t = xi(Te);
|
|
152
|
+
xn(t);
|
|
152
153
|
}, [Te]), E(() => {
|
|
153
|
-
if (
|
|
154
|
-
|
|
154
|
+
if (bn(e), e === null)
|
|
155
|
+
W(!1);
|
|
155
156
|
else if (e === void 0)
|
|
156
|
-
|
|
157
|
+
W(!0);
|
|
157
158
|
else {
|
|
158
|
-
if (
|
|
159
|
+
if (kn === null) {
|
|
159
160
|
if (ct) {
|
|
160
|
-
|
|
161
|
+
W(!0), Ie(!1);
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
|
-
|
|
164
|
+
W(!1);
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
|
-
e.ready ?
|
|
167
|
+
e.ready ? W(!1) : W(!0);
|
|
167
168
|
}
|
|
168
169
|
}, [e, e == null ? void 0 : e.ready, ct]), E(() => {
|
|
169
170
|
var o, r;
|
|
170
171
|
e && (y.current = []), L([]);
|
|
171
|
-
const t =
|
|
172
|
+
const t = A.current;
|
|
172
173
|
if (t && t.scrollTo({
|
|
173
174
|
top: 0
|
|
174
175
|
}), !((o = e == null ? void 0 : e.data) != null && o.id))
|
|
175
176
|
return;
|
|
176
|
-
if (
|
|
177
|
+
if (q(!1), V(!1), (r = e.messages) != null && r.length) {
|
|
177
178
|
const d = [...e.messages.filter((l) => l == null ? void 0 : l.messageId)].reverse();
|
|
178
|
-
y.current = [...d], L([...d]),
|
|
179
|
+
y.current = [...d], L([...d]), W(!1);
|
|
179
180
|
}
|
|
180
181
|
const n = (s) => {
|
|
181
182
|
var d;
|
|
182
|
-
(d = e == null ? void 0 : e.data) != null && d.id && (y.current = [...s].reverse(), L([...s].reverse()), !s || s.length < 10 ? ue(!1) : ue(!0),
|
|
183
|
+
(d = e == null ? void 0 : e.data) != null && d.id && (y.current = [...s].reverse(), L([...s].reverse()), !s || s.length < 10 ? ue(!1) : ue(!0), W(!1), We && We({
|
|
183
184
|
applicationId: i.id,
|
|
184
185
|
sessionId: e.data.id,
|
|
185
186
|
histories: s
|
|
@@ -191,7 +192,7 @@ ${e}` : e;
|
|
|
191
192
|
}, [e]), E(() => {
|
|
192
193
|
const t = () => {
|
|
193
194
|
var n;
|
|
194
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ge(e.promptVariables.sort((o, r) => o.key.localeCompare(r.key))), e.knowledges &&
|
|
195
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ge(e.promptVariables.sort((o, r) => o.key.localeCompare(r.key))), e.knowledges && yn(e.knowledges), O(e.netOpen));
|
|
195
196
|
};
|
|
196
197
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
197
198
|
e == null || e.removeEventListener("data:updated", t);
|
|
@@ -203,7 +204,7 @@ ${e}` : e;
|
|
|
203
204
|
const t = (o) => {
|
|
204
205
|
var r;
|
|
205
206
|
console.error(o.message, o.cause, "e.case"), se.config({
|
|
206
|
-
getContainer: () => (
|
|
207
|
+
getContainer: () => (S == null ? void 0 : S.current) || document.body,
|
|
207
208
|
prefixCls: "gbot-notification"
|
|
208
209
|
}), se.error({
|
|
209
210
|
message: ((r = o.cause) == null ? void 0 : r.message) || o.message
|
|
@@ -216,7 +217,7 @@ ${e}` : e;
|
|
|
216
217
|
e == null || e.removeEventListener("error", t);
|
|
217
218
|
};
|
|
218
219
|
}, [e]);
|
|
219
|
-
const
|
|
220
|
+
const Cn = () => {
|
|
220
221
|
var o;
|
|
221
222
|
if (!((o = e == null ? void 0 : e.data) != null && o.id) || !(i != null && i.id))
|
|
222
223
|
return;
|
|
@@ -231,17 +232,17 @@ ${e}` : e;
|
|
|
231
232
|
});
|
|
232
233
|
};
|
|
233
234
|
E(() => {
|
|
234
|
-
i != null && i.id && (
|
|
235
|
-
|
|
235
|
+
i != null && i.id && (H == null || H.getRecommendQues(i.id).then((t) => {
|
|
236
|
+
on(t);
|
|
236
237
|
}));
|
|
237
|
-
}, [
|
|
238
|
+
}, [St, i]);
|
|
238
239
|
const dt = (t) => $(void 0, null, function* () {
|
|
239
240
|
var u, N;
|
|
240
241
|
if (R) {
|
|
241
242
|
T("error", "发送功能被禁用");
|
|
242
243
|
return;
|
|
243
244
|
}
|
|
244
|
-
const n = t ||
|
|
245
|
+
const n = t || Yt;
|
|
245
246
|
if (!(n != null && n.trim())) {
|
|
246
247
|
T("error", "请输入你想问的");
|
|
247
248
|
return;
|
|
@@ -260,7 +261,7 @@ ${e}` : e;
|
|
|
260
261
|
T("error", "等待初始化");
|
|
261
262
|
return;
|
|
262
263
|
}
|
|
263
|
-
if (!
|
|
264
|
+
if (!gn) {
|
|
264
265
|
T("error", "正在解析文件");
|
|
265
266
|
return;
|
|
266
267
|
}
|
|
@@ -276,8 +277,8 @@ ${e}` : e;
|
|
|
276
277
|
X(!0), C == null || C({
|
|
277
278
|
netOpen: D ? le.OPEN : le.CLOSE
|
|
278
279
|
}).then((x) => {
|
|
279
|
-
var m,
|
|
280
|
-
Q(!0), O(!!((m = x.data) != null && m.netOpen)), pe(!!((
|
|
280
|
+
var m, B;
|
|
281
|
+
Q(!0), O(!!((m = x.data) != null && m.netOpen)), pe(!!((B = x.data) != null && B.enableNetOpen)), Ue(x).then(() => {
|
|
281
282
|
b == null || b(x), Q(!1), qe(n);
|
|
282
283
|
});
|
|
283
284
|
}).catch((x) => {
|
|
@@ -291,13 +292,13 @@ ${e}` : e;
|
|
|
291
292
|
const s = Be(n, J, ne[r], (i == null ? void 0 : i.type) || 0);
|
|
292
293
|
let d;
|
|
293
294
|
try {
|
|
294
|
-
|
|
295
|
+
_ ? d = yield _ == null ? void 0 : _({
|
|
295
296
|
applicationId: i.id,
|
|
296
297
|
sessionId: r,
|
|
297
298
|
message: {
|
|
298
299
|
content: s,
|
|
299
300
|
sessionId: r,
|
|
300
|
-
role:
|
|
301
|
+
role: zt.User,
|
|
301
302
|
files: ne[r]
|
|
302
303
|
}
|
|
303
304
|
}) : d = !0;
|
|
@@ -317,7 +318,7 @@ ${e}` : e;
|
|
|
317
318
|
X(!1);
|
|
318
319
|
return;
|
|
319
320
|
}
|
|
320
|
-
((N = ne[r]) == null ? void 0 : N.length) > 0 ?
|
|
321
|
+
((N = ne[r]) == null ? void 0 : N.length) > 0 ? In(l) : Ae(l);
|
|
321
322
|
}), Ue = (t) => new Promise((n, o) => $(void 0, null, function* () {
|
|
322
323
|
const d = (t == null ? void 0 : t.promptVariables).filter((l) => l.type ? !((l.type === Ee.User || l.type === void 0) && l.key === "query") && !((l.type === Ee.System || l.type === void 0) && l.key === "datetime") : l.key !== "query").map((l) => {
|
|
323
324
|
var c;
|
|
@@ -327,7 +328,7 @@ ${e}` : e;
|
|
|
327
328
|
ge(d.sort((l, v) => l.key.localeCompare(v.key))), yield t == null ? void 0 : t.setPromptVariables(d).catch((l) => {
|
|
328
329
|
console.error(l), T("error", l.message);
|
|
329
330
|
}), n();
|
|
330
|
-
})),
|
|
331
|
+
})), In = (t) => {
|
|
331
332
|
var s, d, l;
|
|
332
333
|
if (be(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(i != null && i.id))
|
|
333
334
|
return;
|
|
@@ -335,7 +336,7 @@ ${e}` : e;
|
|
|
335
336
|
let o = [], r = /* @__PURE__ */ new Set();
|
|
336
337
|
(l = ne[n]) == null || l.forEach((v) => {
|
|
337
338
|
r.has(v.id) || (o.push(v), r.add(v.id));
|
|
338
|
-
}), be(!0),
|
|
339
|
+
}), be(!0), Ae(t, o);
|
|
339
340
|
};
|
|
340
341
|
E(() => {
|
|
341
342
|
if (!Le || !e)
|
|
@@ -345,13 +346,13 @@ ${e}` : e;
|
|
|
345
346
|
const o = Be(t, J, ne[e.id], (i == null ? void 0 : i.type) || 0);
|
|
346
347
|
let r;
|
|
347
348
|
try {
|
|
348
|
-
|
|
349
|
+
_ ? r = yield _ == null ? void 0 : _({
|
|
349
350
|
applicationId: i.id,
|
|
350
351
|
sessionId: e.id,
|
|
351
352
|
message: {
|
|
352
353
|
content: o,
|
|
353
354
|
sessionId: e.id,
|
|
354
|
-
role:
|
|
355
|
+
role: zt.User,
|
|
355
356
|
files: ne[e.id]
|
|
356
357
|
}
|
|
357
358
|
}) : r = !0;
|
|
@@ -362,23 +363,23 @@ ${e}` : e;
|
|
|
362
363
|
X(!1);
|
|
363
364
|
return;
|
|
364
365
|
}
|
|
365
|
-
|
|
366
|
+
Ae(t), qe(void 0);
|
|
366
367
|
});
|
|
367
368
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
368
369
|
e == null || e.removeEventListener("ready", n);
|
|
369
370
|
};
|
|
370
371
|
}, [Le, e]);
|
|
371
|
-
const
|
|
372
|
+
const Ae = (t, n) => $(void 0, null, function* () {
|
|
372
373
|
var u, N, x;
|
|
373
374
|
const o = (u = e == null ? void 0 : e.data) == null ? void 0 : u.id;
|
|
374
375
|
if (!o)
|
|
375
376
|
return;
|
|
376
|
-
|
|
377
|
+
q(!0), V(!0);
|
|
377
378
|
const r = Be(t, J, n, (i == null ? void 0 : i.type) || 0);
|
|
378
379
|
let s;
|
|
379
|
-
if (i.type ===
|
|
380
|
+
if (i.type === Y.Agent)
|
|
380
381
|
s = void 0;
|
|
381
|
-
else if (i.type ===
|
|
382
|
+
else if (i.type === Y.Dialog && ((N = i.arrange) != null && N.length) && i.arrange[0].visionOpen) {
|
|
382
383
|
const m = J && J.length ? J.filter(Boolean) : [];
|
|
383
384
|
s = m.length ? m : void 0;
|
|
384
385
|
} else
|
|
@@ -403,11 +404,11 @@ ${e}` : e;
|
|
|
403
404
|
referenceFirst: !1
|
|
404
405
|
};
|
|
405
406
|
if (f != null && f.promptVariables) {
|
|
406
|
-
const m = M == null ? void 0 : M.reduce((
|
|
407
|
+
const m = M == null ? void 0 : M.reduce((B, oe) => (B[oe.key] = oe.value, B), {});
|
|
407
408
|
c.formatValues = m;
|
|
408
409
|
}
|
|
409
410
|
if (f != null && f.knowledges) {
|
|
410
|
-
const m =
|
|
411
|
+
const m = mn;
|
|
411
412
|
c.knowledges = m;
|
|
412
413
|
}
|
|
413
414
|
const I = {
|
|
@@ -432,9 +433,9 @@ ${e}` : e;
|
|
|
432
433
|
}, d = (c) => {
|
|
433
434
|
if (!c.sessionId || c.sessionId && c.sessionId !== Ye.current || c.role === ae.User)
|
|
434
435
|
return;
|
|
435
|
-
if (c.index === -1 && c.code !== 200 && c.code !== 11915 && (s(),
|
|
436
|
+
if (c.index === -1 && c.code !== 200 && c.code !== 11915 && (s(), V(!1), q(!1), y.current = y.current.filter((N) => !N.isWaiting), L([...y.current]), y.current = [...y.current], c.content)) {
|
|
436
437
|
se.config({
|
|
437
|
-
getContainer: () => (
|
|
438
|
+
getContainer: () => (S == null ? void 0 : S.current) || document.body,
|
|
438
439
|
prefixCls: "gbot-notification"
|
|
439
440
|
}), se.error({
|
|
440
441
|
message: c.content
|
|
@@ -449,11 +450,11 @@ ${e}` : e;
|
|
|
449
450
|
o = u, n === null && (n = requestAnimationFrame(r));
|
|
450
451
|
return;
|
|
451
452
|
}
|
|
452
|
-
s(), c.code === 11915 && (
|
|
453
|
+
s(), c.code === 11915 && (V(!1), q(!1), u.isLoading = !1, u.content = "请您换个问题问我吧~", u.isSensitive = !0, L([u, ...y.current])), c.index === -2 && (V(!1), q(!1), u.isLoading = !1, u.content = "回答已中止~", u.isSuspend = !0, L([u, ...y.current])), c.index === -1 && (V(!1), q(!1), u.isLoading = !1, u.reference = c.reference, L([u, ...y.current]), i.id && ye && ye({
|
|
453
454
|
applicationId: i.id,
|
|
454
455
|
sessionId: t,
|
|
455
456
|
message: u
|
|
456
|
-
})), c.index === -3 && (
|
|
457
|
+
})), c.index === -3 && (V(!1), q(!1), u.isLoading = !1, u.reference = c.reference, u.relatedQuesion = c.relatedQuesion, L([u, ...y.current]));
|
|
457
458
|
}, l = () => {
|
|
458
459
|
e.addEventListener("message:updated", d);
|
|
459
460
|
};
|
|
@@ -475,42 +476,38 @@ ${e}` : e;
|
|
|
475
476
|
if (!P)
|
|
476
477
|
return;
|
|
477
478
|
const t = P.questionContextMaxLength || 4e3;
|
|
478
|
-
|
|
479
|
-
}, [P,
|
|
479
|
+
tn(t);
|
|
480
|
+
}, [P, H]), E(() => {
|
|
480
481
|
Pe && te(Pe.text);
|
|
481
|
-
}, [Pe])
|
|
482
|
-
$t.config({
|
|
483
|
-
getContainer: () => (z == null ? void 0 : z.current) || document.body,
|
|
484
|
-
prefixCls: "gbot-message",
|
|
485
|
-
maxCount: 5
|
|
486
|
-
});
|
|
487
|
-
}, [z]);
|
|
482
|
+
}, [Pe]);
|
|
488
483
|
const T = (t, n, o) => {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
484
|
+
si(S, () => {
|
|
485
|
+
Zn.open({
|
|
486
|
+
type: t,
|
|
487
|
+
content: n,
|
|
488
|
+
key: o
|
|
489
|
+
});
|
|
493
490
|
});
|
|
494
491
|
}, ft = (t) => {
|
|
495
492
|
const n = t.size;
|
|
496
493
|
return n <= 0 ? (T("error", "该文件为空,请重新上传"), !1) : n > Ve * ti ? (T("error", `图片须小于${Ve}M`), !1) : (ve((o) => o.length >= Z ? (T("warning", `图片最多上传${Z}张`), o) : [...o, t]), !1);
|
|
497
|
-
},
|
|
494
|
+
}, Nn = () => {
|
|
498
495
|
var t;
|
|
499
|
-
return (i.type ===
|
|
500
|
-
},
|
|
496
|
+
return (i.type === Y.Agent && (f == null ? void 0 : f.imageUpload) || i.type === Y.Dialog && ((t = i.arrange) == null ? void 0 : t.length) && !!i.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && !R;
|
|
497
|
+
}, En = () => !!z && (f == null ? void 0 : f.fileUpload) && (i == null ? void 0 : i.id) && !R, gt = (t) => {
|
|
501
498
|
var N, x;
|
|
502
499
|
const n = Array.from(t || []).filter(Boolean);
|
|
503
500
|
if (!n.length)
|
|
504
501
|
return;
|
|
505
|
-
const o =
|
|
502
|
+
const o = Nn(), r = En(), s = [], d = [];
|
|
506
503
|
let l = 0, v = 0, c = 0;
|
|
507
504
|
n.forEach((m) => {
|
|
508
|
-
var
|
|
509
|
-
if (((
|
|
505
|
+
var At, Ht, Mt;
|
|
506
|
+
if (((At = m.type) == null ? void 0 : At.startsWith("image/")) || !!Bt(m.name)) {
|
|
510
507
|
o ? s.push(m) : l++;
|
|
511
508
|
return;
|
|
512
509
|
}
|
|
513
|
-
const oe = (Mt = (
|
|
510
|
+
const oe = (Mt = (Ht = m.name) == null ? void 0 : Ht.split(".").pop()) == null ? void 0 : Mt.toLowerCase();
|
|
514
511
|
if (oi.includes(m.type) || ["pdf", "doc", "docx"].includes(oe || "")) {
|
|
515
512
|
r ? d.push(m) : v++;
|
|
516
513
|
return;
|
|
@@ -529,8 +526,8 @@ ${e}` : e;
|
|
|
529
526
|
} else
|
|
530
527
|
c && I.push(`存在不支持的文件类型,已忽略${c}个文件`);
|
|
531
528
|
if (I.length && T("warning", I.join(";"), "precheck-warn"), s.length) {
|
|
532
|
-
const m = Math.max(0, Z - ce.length),
|
|
533
|
-
|
|
529
|
+
const m = Math.max(0, Z - ce.length), B = s.slice(0, m);
|
|
530
|
+
B.forEach((oe) => ft(oe)), s.length > B.length && T("warning", `最多上传${Z}张图片`);
|
|
534
531
|
}
|
|
535
532
|
d.length && ((x = (N = fe.current) == null ? void 0 : N.appendFiles) == null || x.call(N, d));
|
|
536
533
|
}, ut = (t) => {
|
|
@@ -556,11 +553,11 @@ ${e}` : e;
|
|
|
556
553
|
ie.current = null, o(r);
|
|
557
554
|
});
|
|
558
555
|
})), ie.current);
|
|
559
|
-
}),
|
|
556
|
+
}), Ln = (t) => $(void 0, null, function* () {
|
|
560
557
|
const n = yield mt();
|
|
561
|
-
return
|
|
562
|
-
}),
|
|
563
|
-
const o =
|
|
558
|
+
return Pn(n, t);
|
|
559
|
+
}), Pn = (t, n) => {
|
|
560
|
+
const o = Bt(n.name);
|
|
564
561
|
return new Promise((r) => {
|
|
565
562
|
var d;
|
|
566
563
|
const s = {
|
|
@@ -569,8 +566,8 @@ ${e}` : e;
|
|
|
569
566
|
knowledgeId: ((d = t.data) == null ? void 0 : d.id) || "",
|
|
570
567
|
type: 1
|
|
571
568
|
};
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
H == null || H.postTicket(s).then((l) => {
|
|
570
|
+
H.uploadMinioFile(l.minio, n).then(() => {
|
|
574
571
|
var u, N;
|
|
575
572
|
const v = (u = l.minio.endpoints) == null ? void 0 : u[0], c = l.minio.bucket, I = (N = l.minio.fileKeys) == null ? void 0 : N[0];
|
|
576
573
|
r(`${l.minio.useSSL ? "https:" : location.protocol}//${v}/${c}/${I}`);
|
|
@@ -581,7 +578,7 @@ ${e}` : e;
|
|
|
581
578
|
});
|
|
582
579
|
};
|
|
583
580
|
E(() => {
|
|
584
|
-
const t =
|
|
581
|
+
const t = A.current;
|
|
585
582
|
t && !it && t.scrollTo({
|
|
586
583
|
top: t.scrollHeight
|
|
587
584
|
});
|
|
@@ -592,38 +589,38 @@ ${e}` : e;
|
|
|
592
589
|
const r = $e(je({}, n.file), {
|
|
593
590
|
type: 1
|
|
594
591
|
});
|
|
595
|
-
|
|
592
|
+
H == null || H.postApplicationIdSessionKnowledgeSessionFile(i == null ? void 0 : i.id, t, r).finally(() => {
|
|
596
593
|
var s;
|
|
597
594
|
(s = fe.current) == null || s.update().finally(o);
|
|
598
595
|
});
|
|
599
|
-
}),
|
|
596
|
+
}), Tn = () => {
|
|
600
597
|
var t;
|
|
601
|
-
(t = e == null ? void 0 : e.data) != null && t.id && (
|
|
602
|
-
},
|
|
603
|
-
const n =
|
|
598
|
+
(t = e == null ? void 0 : e.data) != null && t.id && (V(!1), e.suspend());
|
|
599
|
+
}, Dn = (t) => {
|
|
600
|
+
const n = A.current;
|
|
604
601
|
n && setTimeout(() => {
|
|
605
602
|
n.scrollTo({
|
|
606
603
|
top: n.scrollHeight,
|
|
607
604
|
behavior: t == null ? void 0 : t.behavior
|
|
608
605
|
});
|
|
609
606
|
}, t == null ? void 0 : t.ms);
|
|
610
|
-
},
|
|
611
|
-
if (!
|
|
607
|
+
}, On = () => {
|
|
608
|
+
if (!A.current)
|
|
612
609
|
return;
|
|
613
|
-
const t =
|
|
614
|
-
|
|
615
|
-
},
|
|
610
|
+
const t = A.current.scrollTop <= -80;
|
|
611
|
+
hn(t);
|
|
612
|
+
}, Rn = ze((t) => {
|
|
616
613
|
var n, o;
|
|
617
614
|
(n = ke.current) == null || n.update(t), (o = ke.current) == null || o.focus();
|
|
618
|
-
}),
|
|
615
|
+
}), Fn = ze((t) => {
|
|
619
616
|
dt(t);
|
|
620
|
-
}),
|
|
617
|
+
}), Un = ze(() => {
|
|
621
618
|
var n;
|
|
622
619
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
623
620
|
return;
|
|
624
621
|
y.current = [...w.slice(1, w.length)], L(y.current);
|
|
625
622
|
const t = new he("", e.data.id, ae.System);
|
|
626
|
-
t.isWaiting = !0, y.current = [t, ...y.current], L(y.current),
|
|
623
|
+
t.isWaiting = !0, y.current = [t, ...y.current], L(y.current), q(!0), V(!0), e.answerAgain();
|
|
627
624
|
});
|
|
628
625
|
E(() => {
|
|
629
626
|
var t, n;
|
|
@@ -636,7 +633,7 @@ ${e}` : e;
|
|
|
636
633
|
const n = w[w.length - 1].messageTime;
|
|
637
634
|
e.fetchMessages({
|
|
638
635
|
endTime: n,
|
|
639
|
-
pageSize:
|
|
636
|
+
pageSize: qt
|
|
640
637
|
}).then((r) => {
|
|
641
638
|
const s = r || [];
|
|
642
639
|
if (!s || !(s != null && s.length)) {
|
|
@@ -645,7 +642,7 @@ ${e}` : e;
|
|
|
645
642
|
}
|
|
646
643
|
s.length < 10 ? ue(!1) : ue(!0), L([...w, ...s.reverse()]);
|
|
647
644
|
});
|
|
648
|
-
},
|
|
645
|
+
}, Hn = (t) => $(void 0, null, function* () {
|
|
649
646
|
var n, o;
|
|
650
647
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
651
648
|
O(t);
|
|
@@ -654,19 +651,19 @@ ${e}` : e;
|
|
|
654
651
|
return;
|
|
655
652
|
O(t);
|
|
656
653
|
}
|
|
657
|
-
}),
|
|
654
|
+
}), He = () => $(void 0, null, function* () {
|
|
658
655
|
e ? e.fetchData().then((t) => {
|
|
659
656
|
var n;
|
|
660
657
|
(n = e == null ? void 0 : e.data) != null && n.id && (O(t.netOpen), pe(t.enableNetOpen));
|
|
661
658
|
}) : (O(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), pe(i.arrange[0].enableNetOpen));
|
|
662
659
|
});
|
|
663
660
|
E(() => {
|
|
664
|
-
|
|
661
|
+
He();
|
|
665
662
|
}, [e]), E(() => {
|
|
666
663
|
requestAnimationFrame(() => {
|
|
667
664
|
var n, o;
|
|
668
|
-
if (
|
|
669
|
-
const r = document.getElementById("chat-main"), s = (n =
|
|
665
|
+
if (A.current) {
|
|
666
|
+
const r = document.getElementById("chat-main"), s = (n = A.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), d = (o = A.current) == null ? void 0 : o.querySelector(".infinite-scroll-component");
|
|
670
667
|
if (!s || !d || !r)
|
|
671
668
|
return;
|
|
672
669
|
const l = r.offsetHeight;
|
|
@@ -707,9 +704,9 @@ ${e}` : e;
|
|
|
707
704
|
}).then((t) => {
|
|
708
705
|
var n, o;
|
|
709
706
|
return b == null || b(t), Q(!1), O(!!((n = t.data) != null && n.netOpen)), pe(!!((o = t.data) != null && o.enableNetOpen)), Ue(t), t;
|
|
710
|
-
}), wt = !!w.length, kt =
|
|
707
|
+
}), wt = !!w.length, kt = Kn(() => {
|
|
711
708
|
var t;
|
|
712
|
-
return i.arrange && ((t = i.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ g(
|
|
709
|
+
return i.arrange && ((t = i.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ g(Wt, {
|
|
713
710
|
application: i,
|
|
714
711
|
history: {
|
|
715
712
|
role: 1,
|
|
@@ -719,7 +716,7 @@ ${e}` : e;
|
|
|
719
716
|
sessionId: "",
|
|
720
717
|
reference: [],
|
|
721
718
|
searchReference: [],
|
|
722
|
-
messageTime:
|
|
719
|
+
messageTime: Kt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
|
|
723
720
|
actions: [],
|
|
724
721
|
isLoading: !1
|
|
725
722
|
},
|
|
@@ -727,7 +724,7 @@ ${e}` : e;
|
|
|
727
724
|
markdown: a == null ? void 0 : a.markdown
|
|
728
725
|
}) : null;
|
|
729
726
|
}, [i == null ? void 0 : i.arrange, wt]);
|
|
730
|
-
return
|
|
727
|
+
return Yn(h, () => ({
|
|
731
728
|
getCurrentInputText: () => {
|
|
732
729
|
var t;
|
|
733
730
|
return (t = ke.current) == null ? void 0 : t.getCurrentText();
|
|
@@ -740,11 +737,11 @@ ${e}` : e;
|
|
|
740
737
|
}));
|
|
741
738
|
}, [(bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id]), /* @__PURE__ */ F("div", {
|
|
742
739
|
className: "agent-chat",
|
|
743
|
-
children: [
|
|
740
|
+
children: [wn ? /* @__PURE__ */ g("div", {
|
|
744
741
|
className: "session-loading",
|
|
745
|
-
children: /* @__PURE__ */ g(
|
|
746
|
-
}) : /* @__PURE__ */ F(
|
|
747
|
-
children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ g(
|
|
742
|
+
children: /* @__PURE__ */ g($t, {})
|
|
743
|
+
}) : /* @__PURE__ */ F(Bn, {
|
|
744
|
+
children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ g(ui, {
|
|
748
745
|
ref: et,
|
|
749
746
|
appId: i.id,
|
|
750
747
|
currentSession: e,
|
|
@@ -754,7 +751,7 @@ ${e}` : e;
|
|
|
754
751
|
}), /* @__PURE__ */ F("div", {
|
|
755
752
|
className: "chat-main",
|
|
756
753
|
id: "chat-main",
|
|
757
|
-
style:
|
|
754
|
+
style: Xt,
|
|
758
755
|
children: [/* @__PURE__ */ g("div", {
|
|
759
756
|
className: "chat-main-wrapper",
|
|
760
757
|
id: "scrollableDiv",
|
|
@@ -764,9 +761,9 @@ ${e}` : e;
|
|
|
764
761
|
display: "flex",
|
|
765
762
|
flexDirection: "column-reverse"
|
|
766
763
|
},
|
|
767
|
-
ref:
|
|
768
|
-
onScroll:
|
|
769
|
-
children: (xt = e == null ? void 0 : e.data) != null && xt.id && (w != null && w.length) ? /* @__PURE__ */ F(
|
|
764
|
+
ref: A,
|
|
765
|
+
onScroll: On,
|
|
766
|
+
children: (xt = e == null ? void 0 : e.data) != null && xt.id && (w != null && w.length) ? /* @__PURE__ */ F(mi, {
|
|
770
767
|
dataLength: w.length,
|
|
771
768
|
next: An,
|
|
772
769
|
style: {
|
|
@@ -775,8 +772,8 @@ ${e}` : e;
|
|
|
775
772
|
overflowX: "hidden"
|
|
776
773
|
},
|
|
777
774
|
inverse: !0,
|
|
778
|
-
endMessage: w.length >
|
|
779
|
-
((Ct =
|
|
775
|
+
endMessage: w.length > qt && // 少于一页不展示这个提示
|
|
776
|
+
((Ct = A.current) != null && Ct.scrollTop) && ((It = A.current) == null ? void 0 : It.scrollTop) < -10 ? /* @__PURE__ */ g(Sn, {
|
|
780
777
|
plain: !0,
|
|
781
778
|
children: "没有更多数据了"
|
|
782
779
|
}) : null,
|
|
@@ -787,35 +784,35 @@ ${e}` : e;
|
|
|
787
784
|
textAlign: "center",
|
|
788
785
|
overflow: "hidden"
|
|
789
786
|
},
|
|
790
|
-
children: /* @__PURE__ */ g(
|
|
787
|
+
children: /* @__PURE__ */ g($t, {})
|
|
791
788
|
}),
|
|
792
789
|
scrollableTarget: "scrollableDiv",
|
|
793
|
-
children: [w.map((t, n) => /* @__PURE__ */ g(
|
|
790
|
+
children: [w.map((t, n) => /* @__PURE__ */ g(bi, {
|
|
794
791
|
application: i,
|
|
795
792
|
currentSession: e,
|
|
796
793
|
history: t,
|
|
797
794
|
docViewerUrl: U,
|
|
798
795
|
isLastHistory: n === 0,
|
|
799
|
-
onRelatedClick:
|
|
800
|
-
onAgainClick:
|
|
801
|
-
onEditClick:
|
|
796
|
+
onRelatedClick: Fn,
|
|
797
|
+
onAgainClick: Un,
|
|
798
|
+
onEditClick: Rn,
|
|
802
799
|
markdown: a == null ? void 0 : a.markdown
|
|
803
800
|
}, t.messageId + n)), !st && kt]
|
|
804
801
|
}) : /* @__PURE__ */ F("div", {
|
|
805
802
|
className: "main-empty",
|
|
806
|
-
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ g(
|
|
803
|
+
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ g(li, {
|
|
807
804
|
text: (
|
|
808
805
|
// 第一优先级:features配置
|
|
809
806
|
a != null && a.greeting && typeof a.greeting == "object" && a.greeting.text !== void 0 ? a.greeting.text : (
|
|
810
807
|
// 第二优先级:application.arrange[0].greetings
|
|
811
808
|
(Nt = i.arrange) != null && Nt.length && ((Et = i.arrange[0]) != null && Et.greetings) ? i.arrange[0].greetings : (
|
|
812
809
|
// 第三优先级:默认文本
|
|
813
|
-
|
|
810
|
+
_t.text
|
|
814
811
|
)
|
|
815
812
|
)
|
|
816
813
|
),
|
|
817
|
-
icon: a === void 0 || a.greeting === !0 || ((Lt = a.greeting) == null ? void 0 : Lt.icon) === void 0 ?
|
|
818
|
-
children: !!Ge.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ g(
|
|
814
|
+
icon: a === void 0 || a.greeting === !0 || ((Lt = a.greeting) == null ? void 0 : Lt.icon) === void 0 ? Gt || _t.icon : a.greeting.icon,
|
|
815
|
+
children: !!Ge.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ g(ai, {
|
|
819
816
|
ref: Oe,
|
|
820
817
|
sid: (Pt = e == null ? void 0 : e.data) == null ? void 0 : Pt.id,
|
|
821
818
|
isRecommendClearing: Ze,
|
|
@@ -857,14 +854,14 @@ ${e}` : e;
|
|
|
857
854
|
fontSize: 16
|
|
858
855
|
}
|
|
859
856
|
}),
|
|
860
|
-
onClick: () =>
|
|
857
|
+
onClick: () => Tn(),
|
|
861
858
|
children: "停止回答"
|
|
862
859
|
})
|
|
863
860
|
}), it && (w == null ? void 0 : w.length) > 0 && /* @__PURE__ */ g("div", {
|
|
864
861
|
className: "back-bottom",
|
|
865
862
|
children: /* @__PURE__ */ g(G, {
|
|
866
863
|
size: "small",
|
|
867
|
-
onClick: () =>
|
|
864
|
+
onClick: () => Dn({
|
|
868
865
|
behavior: "smooth"
|
|
869
866
|
}),
|
|
870
867
|
type: "link",
|
|
@@ -889,7 +886,7 @@ ${e}` : e;
|
|
|
889
886
|
upload: (o) => $(void 0, null, function* () {
|
|
890
887
|
Qe((r) => r + 1);
|
|
891
888
|
try {
|
|
892
|
-
return yield
|
|
889
|
+
return yield Ln(o);
|
|
893
890
|
} finally {
|
|
894
891
|
Qe((r) => Math.max(0, r - 1));
|
|
895
892
|
}
|
|
@@ -911,7 +908,7 @@ ${e}` : e;
|
|
|
911
908
|
className: "footer-upload-action",
|
|
912
909
|
onClick: (t) => t.preventDefault(),
|
|
913
910
|
children: [/* @__PURE__ */ F(Ne, {
|
|
914
|
-
children: [(i.type ===
|
|
911
|
+
children: [(i.type === Y.Agent && (f == null ? void 0 : f.imageUpload) || i.type === Y.Dialog && ((Tt = i.arrange) == null ? void 0 : Tt.length) && !!i.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && /* @__PURE__ */ g(Qn, {
|
|
915
912
|
multiple: !0,
|
|
916
913
|
disabled: ce.length >= Z || R,
|
|
917
914
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
@@ -919,7 +916,7 @@ ${e}` : e;
|
|
|
919
916
|
beforeUpload: ft,
|
|
920
917
|
className: "footer-upload-picture",
|
|
921
918
|
showUploadList: !1,
|
|
922
|
-
children: ce.length < Z ? /* @__PURE__ */ g(
|
|
919
|
+
children: ce.length < Z ? /* @__PURE__ */ g(Xn, {
|
|
923
920
|
placement: "topLeft",
|
|
924
921
|
overlayClassName: "footer-upload-tooltip",
|
|
925
922
|
title: /* @__PURE__ */ g("div", {
|
|
@@ -959,13 +956,13 @@ ${e}` : e;
|
|
|
959
956
|
}
|
|
960
957
|
})
|
|
961
958
|
})
|
|
962
|
-
}),
|
|
959
|
+
}), z && (f != null && f.fileUpload) && (i != null && i.id) ? /* @__PURE__ */ g(fi, {
|
|
963
960
|
appId: i == null ? void 0 : i.id,
|
|
964
961
|
ref: fe,
|
|
965
962
|
isFirstSession: ot,
|
|
966
963
|
docViewerUrl: U,
|
|
967
964
|
onStatusChange: (t) => $(void 0, null, function* () {
|
|
968
|
-
t !== "process" ? (be(!0),
|
|
965
|
+
t !== "process" ? (be(!0), He()) : be(!1);
|
|
969
966
|
}),
|
|
970
967
|
createSession: () => mt().then((t) => {
|
|
971
968
|
var o;
|
|
@@ -992,43 +989,43 @@ ${e}` : e;
|
|
|
992
989
|
});
|
|
993
990
|
},
|
|
994
991
|
onFileListChange: (t) => {
|
|
995
|
-
|
|
992
|
+
fn(t);
|
|
996
993
|
},
|
|
997
|
-
shouldContinue:
|
|
994
|
+
shouldContinue: un,
|
|
998
995
|
afterFilesClear: () => {
|
|
999
996
|
var n;
|
|
1000
997
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
1001
998
|
t && (de({
|
|
1002
999
|
[t]: []
|
|
1003
|
-
}),
|
|
1000
|
+
}), He());
|
|
1004
1001
|
}
|
|
1005
|
-
}) : null, (f == null ? void 0 : f.prompt) && (i == null ? void 0 : i.id) && /* @__PURE__ */ g(
|
|
1002
|
+
}) : null, (f == null ? void 0 : f.prompt) && (i == null ? void 0 : i.id) && /* @__PURE__ */ g(vi, {
|
|
1006
1003
|
appId: i.id,
|
|
1007
1004
|
list: [],
|
|
1008
|
-
search: Je ?
|
|
1005
|
+
search: Je ? rn : "",
|
|
1009
1006
|
onPromptSelect: (t) => {
|
|
1010
1007
|
te(t.context), me(t.context);
|
|
1011
1008
|
},
|
|
1012
1009
|
disabled: R
|
|
1013
1010
|
})]
|
|
1014
1011
|
}), /* @__PURE__ */ F(Ne, {
|
|
1015
|
-
children: [(f == null ? void 0 : f.connectNetwork) && i.type ===
|
|
1012
|
+
children: [(f == null ? void 0 : f.connectNetwork) && i.type === Y.Dialog && ((Ot = i.arrange) == null ? void 0 : Ot.length) && !!i.arrange[0].enableNetOpen && /* @__PURE__ */ g(yi, {
|
|
1016
1013
|
sessionId: (Rt = e == null ? void 0 : e.data) == null ? void 0 : Rt.id,
|
|
1017
1014
|
netStatus: D,
|
|
1018
|
-
enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) :
|
|
1015
|
+
enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : vn,
|
|
1019
1016
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
1020
1017
|
onNetStatusChange: (t) => {
|
|
1021
|
-
|
|
1018
|
+
Hn(t);
|
|
1022
1019
|
}
|
|
1023
|
-
}), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ g(
|
|
1020
|
+
}), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ g(pi, {
|
|
1024
1021
|
currentSessionId: (Ft = e == null ? void 0 : e.data) == null ? void 0 : Ft.id,
|
|
1025
1022
|
onSessionChange: (t, n) => {
|
|
1026
1023
|
te(void 0), Ie(!0), b == null || b(n);
|
|
1027
1024
|
},
|
|
1028
1025
|
disabled: R
|
|
1029
|
-
}),
|
|
1026
|
+
}), Zt && Jt === "float" && /* @__PURE__ */ g("div", {
|
|
1030
1027
|
className: "session-history-drawer-component",
|
|
1031
|
-
children: /* @__PURE__ */ g(
|
|
1028
|
+
children: /* @__PURE__ */ g(Gn, {
|
|
1032
1029
|
placement: "topRight",
|
|
1033
1030
|
showArrow: !1,
|
|
1034
1031
|
overlayClassName: "session-history-overlay",
|
|
@@ -1051,7 +1048,7 @@ ${e}` : e;
|
|
|
1051
1048
|
})
|
|
1052
1049
|
})
|
|
1053
1050
|
}), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ g(G, {
|
|
1054
|
-
icon: /* @__PURE__ */ g(
|
|
1051
|
+
icon: /* @__PURE__ */ g(di, {}),
|
|
1055
1052
|
className: "add-btn",
|
|
1056
1053
|
type: "primary",
|
|
1057
1054
|
disabled: nt || !e || !w.length || R,
|
|
@@ -1073,10 +1070,10 @@ ${e}` : e;
|
|
|
1073
1070
|
onDropCapture: ht,
|
|
1074
1071
|
onDragOver: pt,
|
|
1075
1072
|
onDragOverCapture: pt,
|
|
1076
|
-
children: [/* @__PURE__ */ g(
|
|
1073
|
+
children: [/* @__PURE__ */ g(ri, {
|
|
1077
1074
|
ref: ke,
|
|
1078
|
-
maxLength:
|
|
1079
|
-
text:
|
|
1075
|
+
maxLength: en,
|
|
1076
|
+
text: ln,
|
|
1080
1077
|
networkStatus: !1,
|
|
1081
1078
|
loading: rt || Ce,
|
|
1082
1079
|
disabled: Ke || Xe || R || rt || Ce,
|
|
@@ -1084,7 +1081,7 @@ ${e}` : e;
|
|
|
1084
1081
|
onChange: (t, n) => {
|
|
1085
1082
|
te(t);
|
|
1086
1083
|
const o = n.getText().replace(/[\n\s]+$/, "");
|
|
1087
|
-
me(o),
|
|
1084
|
+
me(o), an(o), Je || sn(!0);
|
|
1088
1085
|
},
|
|
1089
1086
|
clearAction: /* @__PURE__ */ g(Ne, {
|
|
1090
1087
|
size: 0,
|
|
@@ -1098,7 +1095,7 @@ ${e}` : e;
|
|
|
1098
1095
|
},
|
|
1099
1096
|
type: "icon-qingchujiyi"
|
|
1100
1097
|
}),
|
|
1101
|
-
onClick: () =>
|
|
1098
|
+
onClick: () => Cn()
|
|
1102
1099
|
})
|
|
1103
1100
|
})
|
|
1104
1101
|
}), !!Fe && /* @__PURE__ */ F("div", {
|
|
@@ -1107,17 +1104,17 @@ ${e}` : e;
|
|
|
1107
1104
|
})]
|
|
1108
1105
|
})]
|
|
1109
1106
|
})
|
|
1110
|
-
}), /* @__PURE__ */ g(
|
|
1111
|
-
tips:
|
|
1112
|
-
}), tt && /* @__PURE__ */ g(
|
|
1107
|
+
}), /* @__PURE__ */ g(ci, {
|
|
1108
|
+
tips: Qt
|
|
1109
|
+
}), tt && /* @__PURE__ */ g(gi, {
|
|
1113
1110
|
isvisible: tt,
|
|
1114
|
-
files:
|
|
1111
|
+
files: dn,
|
|
1115
1112
|
sessionId: (Ut = e == null ? void 0 : e.data) == null ? void 0 : Ut.id,
|
|
1116
1113
|
onClose: (t) => {
|
|
1117
|
-
|
|
1114
|
+
cn(!1), pn(!1);
|
|
1118
1115
|
}
|
|
1119
1116
|
})]
|
|
1120
|
-
}), at && /* @__PURE__ */ g(
|
|
1117
|
+
}), at && /* @__PURE__ */ g(hi, {
|
|
1121
1118
|
currentSession: e,
|
|
1122
1119
|
application: i,
|
|
1123
1120
|
networkStatus: D,
|
|
@@ -1132,5 +1129,5 @@ ${e}` : e;
|
|
|
1132
1129
|
});
|
|
1133
1130
|
});
|
|
1134
1131
|
export {
|
|
1135
|
-
|
|
1132
|
+
no as default
|
|
1136
1133
|
};
|