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