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