@glodon-aiot/agent-cli-ui 3.17.0-alpha.2 → 3.17.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/Dialog/AgentChat/index.mjs +453 -439
- 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/style10.css +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style19.css +1 -1
- package/dist/es/src/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/style26.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/style32.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,67 +1,67 @@
|
|
|
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 A = (
|
|
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 = (k, u, i) => u in k ? An(k, u, { enumerable: !0, configurable: !0, writable: !0, value: i }) : k[u] = i, je = (k, u) => {
|
|
6
|
+
for (var i in u || (u = {}))
|
|
7
|
+
zn.call(u, i) && Ae(k, i, u[i]);
|
|
8
|
+
if (At)
|
|
9
|
+
for (var i of At(u))
|
|
10
|
+
Vn.call(u, i) && Ae(k, i, u[i]);
|
|
11
|
+
return k;
|
|
12
|
+
}, $e = (k, u) => jn(k, $n(u));
|
|
13
|
+
var A = (k, u, i) => (Ae(k, typeof u != "symbol" ? u + "" : u, i), i);
|
|
14
|
+
var j = (k, u, i) => new Promise((R, e) => {
|
|
15
|
+
var x = (P) => {
|
|
16
16
|
try {
|
|
17
|
-
w(
|
|
17
|
+
w(i.next(P));
|
|
18
18
|
} catch (T) {
|
|
19
19
|
e(T);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, V = (P) => {
|
|
22
22
|
try {
|
|
23
|
-
w(
|
|
23
|
+
w(i.throw(P));
|
|
24
24
|
} catch (T) {
|
|
25
25
|
e(T);
|
|
26
26
|
}
|
|
27
|
-
}, w = (P) => P.done ?
|
|
28
|
-
w((
|
|
27
|
+
}, w = (P) => P.done ? R(P.value) : Promise.resolve(P.value).then(x, V);
|
|
28
|
+
w((i = i.apply(k, 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 $, 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 Ee, 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 Ne } 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 ki = _n(Wt), _t = {
|
|
60
|
+
icon: vi,
|
|
61
61
|
text: "今天我能帮你什么?"
|
|
62
62
|
};
|
|
63
63
|
class he {
|
|
64
|
-
constructor(
|
|
64
|
+
constructor(u, i, R, e, x) {
|
|
65
65
|
A(this, "messageTime");
|
|
66
66
|
A(this, "isWaiting");
|
|
67
67
|
A(this, "messageId");
|
|
@@ -73,81 +73,90 @@ class he {
|
|
|
73
73
|
A(this, "imageContent");
|
|
74
74
|
// 新增:支持对话型应用的图片内容
|
|
75
75
|
A(this, "comment");
|
|
76
|
-
this.content =
|
|
76
|
+
this.content = u, this.sessionId = i, this.role = R, this.files = e, this.content = u, this.role = R, 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 = (k, u, i, R) => {
|
|
82
|
+
let e = k;
|
|
83
|
+
if (R === 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
|
+
}, wi = (k) => {
|
|
99
|
+
const u = Math.floor(k / 3600), i = Math.floor(k % 3600 / 60), R = k % 60, e = (x) => String(x).padStart(2, "0");
|
|
100
|
+
return `${e(u)}:${e(i)}:${e(R)}`;
|
|
101
|
+
}, Ji = qn((k, u) => {
|
|
102
|
+
var wt, bt, xt, Ct, It, Et, Nt, Lt, Pt, Tt, Dt, Ot, Rt, Ut;
|
|
100
103
|
const {
|
|
101
|
-
application:
|
|
102
|
-
docViewerUrl:
|
|
104
|
+
application: i,
|
|
105
|
+
docViewerUrl: R = "",
|
|
103
106
|
currentSession: e,
|
|
104
|
-
onCreateSession:
|
|
105
|
-
embeddingService:
|
|
107
|
+
onCreateSession: x,
|
|
108
|
+
embeddingService: V,
|
|
106
109
|
setCurrentSession: w,
|
|
107
110
|
networkStatus: P,
|
|
108
111
|
setNetworkStatus: T
|
|
109
|
-
} =
|
|
110
|
-
service:
|
|
112
|
+
} = k, [y, E] = g([]), [Yt, me] = g(), [Le, qe] = g(), U = Y(null), {
|
|
113
|
+
service: F,
|
|
111
114
|
agentClient: N,
|
|
112
|
-
depId:
|
|
113
|
-
footer:
|
|
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, ke] = g([]), [Qe, Se] = g(0), [Xe, nn] = g(!1);
|
|
131
|
+
C(() => {
|
|
132
|
+
nn(Qe > 0);
|
|
133
|
+
}, [Qe]);
|
|
134
|
+
const we = 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), [M, 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), [kn, K] = g(!1), [wn, 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 = wi(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 (wn === 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
170
|
e && (m.current = []), E([]);
|
|
162
|
-
const t =
|
|
171
|
+
const t = U.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
178
|
m.current = [...d], E([...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(), E([...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
189
|
m.current = [], E([]), 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) {
|
|
@@ -221,413 +230,413 @@ ${e}` : e;
|
|
|
221
230
|
a.isContext = !0, E([a, ...y]);
|
|
222
231
|
});
|
|
223
232
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
233
|
+
C(() => {
|
|
234
|
+
i != null && i.id && (F == null || F.getRecommendQues(i.id).then((t) => {
|
|
235
|
+
on(t);
|
|
227
236
|
}));
|
|
228
|
-
}, [
|
|
229
|
-
const
|
|
237
|
+
}, [Qt, i]);
|
|
238
|
+
const dt = (t) => j(void 0, null, function* () {
|
|
230
239
|
var H, 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 (!(M == null ? void 0 : M.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("变量值不能为空", M == null ? void 0 : M.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
|
-
ve([]),
|
|
271
|
+
ve([]), ke([]);
|
|
263
272
|
const a = (H = e == null ? void 0 : e.data) == null ? void 0 : H.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
|
-
w == null || w(
|
|
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
|
+
w == null || w(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
|
-
}),
|
|
320
|
+
((D = ne[a]) == null ? void 0 : D.length) > 0 ? In(r) : Me(r);
|
|
321
|
+
}), Fe = (t) => new Promise((n, s) => j(void 0, null, function* () {
|
|
313
322
|
const d = (t == null ? void 0 : t.promptVariables).filter((r) => r.type ? !((r.type === Ne.User || r.type === void 0) && r.key === "query") && !((r.type === Ne.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 = M.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 = () => j(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 H, D,
|
|
371
|
+
const Me = (t, n) => j(void 0, null, function* () {
|
|
372
|
+
var H, D, b;
|
|
364
373
|
const s = (H = e == null ? void 0 : e.data) == null ? void 0 : H.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], E(m.current),
|
|
386
|
-
applicationId:
|
|
394
|
+
me(void 0), te(void 0), m.current = [d, ...y], E(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
400
|
r.isWaiting = !0, m.current = [r, ...m.current], E(m.current);
|
|
392
|
-
const
|
|
393
|
-
stream:
|
|
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 = M == null ? void 0 : M.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([]), ke([]), 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), E([...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 && E([r, ...m.current]), o.code === 11915 && (B(!1), W(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, E([r, ...m.current])), o.index === -2 && (B(!1), W(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, E([r, ...m.current])), o.index === -1 && (B(!1), W(!1), r.isLoading = !1, r.reference = o.reference, E([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, E([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]),
|
|
465
|
+
}, [e]), C(() => {
|
|
457
466
|
if (!N)
|
|
458
467
|
return;
|
|
459
468
|
const t = N.questionContextMaxLength || 4e3;
|
|
460
|
-
|
|
461
|
-
}, [N,
|
|
469
|
+
tn(t);
|
|
470
|
+
}, [N, F]), 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
|
+
}, En = () => {
|
|
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
|
+
}, Nn = () => !!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 = En(), a = Nn(), 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 = [], H = r + h + v;
|
|
503
512
|
if (!a && !s)
|
|
504
|
-
H &&
|
|
513
|
+
H && I.push(`当前不支持上传文件/图片,已忽略${H}个文件`);
|
|
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 = () => j(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
|
-
w == null || w(a),
|
|
544
|
+
var o, d;
|
|
545
|
+
w == null || w(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) => j(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
|
-
|
|
563
|
+
F == null || F.postTicket(o).then((r) => {
|
|
564
|
+
F.uploadMinioFile(r.minio, n).then(() => {
|
|
556
565
|
var H, D;
|
|
557
|
-
const
|
|
558
|
-
a(`${r.minio.useSSL ? "https:" : location.protocol}//${
|
|
566
|
+
const h = (H = r.minio.endpoints) == null ? void 0 : H[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 = U.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
|
+
F == null || F.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 = U.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 (!U.current)
|
|
594
603
|
return;
|
|
595
|
-
const t =
|
|
596
|
-
|
|
597
|
-
},
|
|
604
|
+
const t = U.current.scrollTop <= -80;
|
|
605
|
+
hn(t);
|
|
606
|
+
}, Rn = ze((t) => {
|
|
598
607
|
var n, s;
|
|
599
|
-
(n =
|
|
600
|
-
}),
|
|
601
|
-
|
|
602
|
-
}),
|
|
608
|
+
(n = we.current) == null || n.update(t), (s = we.current) == null || s.focus();
|
|
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
615
|
m.current = [...y.slice(1, y.length)], E(m.current);
|
|
607
616
|
const t = new he("", e.data.id, ae.System);
|
|
608
|
-
t.isWaiting = !0, m.current = [t, ...m.current], E(m.current), W(!0),
|
|
617
|
+
t.isWaiting = !0, m.current = [t, ...m.current], E(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), E([...y, ...o.reverse()]);
|
|
629
638
|
});
|
|
630
|
-
},
|
|
639
|
+
}, Hn = (t) => j(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 = () => j(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 (U.current) {
|
|
660
|
+
const a = document.getElementById("chat-main"), o = (n = U.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), d = (s = U.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 = ((N == null ? void 0 : N.promptVariables) || []).filter((
|
|
671
|
-
var
|
|
679
|
+
const a = ((N == null ? void 0 : N.promptVariables) || []).filter((o) => o.type ? !(o.type === Ne.User && o.key === "query") && !(o.type === Ne.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
692
|
return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
|
|
684
693
|
N == null || N.removeEventListener("ready", t);
|
|
685
694
|
};
|
|
686
695
|
}, [e, N, l == null ? void 0 : l.promptVariables]);
|
|
687
|
-
const
|
|
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 w == null || w(t),
|
|
692
|
-
}),
|
|
700
|
+
return w == null || w(t), S(!1), T(!!((n = t.data) != null && n.netOpen)), pe(!!((s = t.data) != null && s.enableNetOpen)), Fe(t), t;
|
|
701
|
+
}), kt = 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
|
-
return (t =
|
|
724
|
+
return (t = we.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
|
+
}, [(wt = e == null ? void 0 : e.data) == null ? void 0 : wt.id]), /* @__PURE__ */ $("div", {
|
|
724
733
|
className: "agent-chat",
|
|
725
|
-
children: [
|
|
734
|
+
children: [kn ? /* @__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__ */ $(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: M,
|
|
734
743
|
setPromptVariables: ge,
|
|
735
744
|
setCurrentSession: w
|
|
736
|
-
}), /* @__PURE__ */
|
|
745
|
+
}), /* @__PURE__ */ $("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: U,
|
|
759
|
+
onScroll: On,
|
|
760
|
+
children: (bt = e == null ? void 0 : e.data) != null && bt.id && (y != null && y.length) ? /* @__PURE__ */ $(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 = U.current) != null && xt.scrollTop) && ((Ct = U.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(ki, {
|
|
785
|
+
application: i,
|
|
777
786
|
currentSession: e,
|
|
778
787
|
history: t,
|
|
779
|
-
docViewerUrl:
|
|
788
|
+
docViewerUrl: R,
|
|
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 && kt]
|
|
795
|
+
}) : /* @__PURE__ */ $("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 && ((Et = i.arrange[0]) != null && Et.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 || ((Nt = l.greeting) == null ? void 0 : Nt.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
|
+
}), kt]
|
|
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,53 @@ ${e}` : e;
|
|
|
860
869
|
})]
|
|
861
870
|
}), /* @__PURE__ */ f("div", {
|
|
862
871
|
className: "chat-footer",
|
|
863
|
-
children: /* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ $("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) => j(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)), ke((s) => s.filter((a, o) => o !== n));
|
|
881
890
|
}
|
|
882
891
|
},
|
|
883
892
|
onUrlChange: (s) => {
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
return
|
|
893
|
+
ke((a) => {
|
|
894
|
+
const o = [...a];
|
|
895
|
+
return o[n] = s, o;
|
|
887
896
|
});
|
|
888
897
|
}
|
|
889
898
|
}, n))
|
|
890
|
-
}), /* @__PURE__ */
|
|
899
|
+
}), /* @__PURE__ */ $(Ee, {
|
|
891
900
|
className: "footer-upload-action",
|
|
892
901
|
onClick: (t) => t.preventDefault(),
|
|
893
|
-
children: [/* @__PURE__ */
|
|
894
|
-
children: [(
|
|
902
|
+
children: [/* @__PURE__ */ $(Ee, {
|
|
903
|
+
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, {
|
|
895
904
|
multiple: !0,
|
|
896
|
-
disabled: ce.length >=
|
|
905
|
+
disabled: ce.length >= Z || O,
|
|
897
906
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
898
907
|
listType: "picture-card",
|
|
899
|
-
beforeUpload:
|
|
908
|
+
beforeUpload: ft,
|
|
900
909
|
className: "footer-upload-picture",
|
|
901
910
|
showUploadList: !1,
|
|
902
|
-
children: ce.length <
|
|
911
|
+
children: ce.length < Z ? /* @__PURE__ */ f(Xn, {
|
|
903
912
|
placement: "topLeft",
|
|
904
913
|
overlayClassName: "footer-upload-tooltip",
|
|
905
914
|
title: /* @__PURE__ */ f("div", {
|
|
906
915
|
children: `支持上传.jpg .png .jpeg
|
|
907
|
-
.bmp格式的图片数据,单文件最大${
|
|
916
|
+
.bmp格式的图片数据,单文件最大${Ve}M,最多${Z}张`
|
|
908
917
|
}),
|
|
909
|
-
children: /* @__PURE__ */ f(
|
|
918
|
+
children: /* @__PURE__ */ f(G, {
|
|
910
919
|
type: "text",
|
|
911
920
|
className: "camera-out-btn",
|
|
912
921
|
style: {
|
|
@@ -922,7 +931,7 @@ ${e}` : e;
|
|
|
922
931
|
}
|
|
923
932
|
})
|
|
924
933
|
})
|
|
925
|
-
}) : /* @__PURE__ */ f(
|
|
934
|
+
}) : /* @__PURE__ */ f(G, {
|
|
926
935
|
type: "text",
|
|
927
936
|
className: "camera-out-btn",
|
|
928
937
|
style: {
|
|
@@ -939,20 +948,20 @@ ${e}` : e;
|
|
|
939
948
|
}
|
|
940
949
|
})
|
|
941
950
|
})
|
|
942
|
-
}),
|
|
943
|
-
appId:
|
|
951
|
+
}), V && (c != null && c.fileUpload) && (i != null && i.id) ? /* @__PURE__ */ f(ci, {
|
|
952
|
+
appId: i == null ? void 0 : i.id,
|
|
944
953
|
ref: fe,
|
|
945
|
-
isFirstSession:
|
|
946
|
-
docViewerUrl:
|
|
947
|
-
onStatusChange: (t) =>
|
|
948
|
-
t !== "process" ? (be(!0),
|
|
954
|
+
isFirstSession: ot,
|
|
955
|
+
docViewerUrl: R,
|
|
956
|
+
onStatusChange: (t) => j(void 0, null, function* () {
|
|
957
|
+
t !== "process" ? (be(!0), He()) : be(!1);
|
|
949
958
|
}),
|
|
950
|
-
createSession: () =>
|
|
959
|
+
createSession: () => mt().then((t) => {
|
|
951
960
|
var s;
|
|
952
961
|
return ((s = t.data) == null ? void 0 : s.id) || "";
|
|
953
962
|
}),
|
|
954
|
-
sid: (
|
|
955
|
-
disabled:
|
|
963
|
+
sid: (Tt = e == null ? void 0 : e.data) == null ? void 0 : Tt.id,
|
|
964
|
+
disabled: Re || O,
|
|
956
965
|
afterFileAdd: (t, n) => {
|
|
957
966
|
n && de((s) => {
|
|
958
967
|
const a = s[n] || [];
|
|
@@ -965,50 +974,50 @@ ${e}` : e;
|
|
|
965
974
|
var s;
|
|
966
975
|
const n = (s = e == null ? void 0 : e.data) == null ? void 0 : s.id;
|
|
967
976
|
n && de((a) => {
|
|
968
|
-
const
|
|
977
|
+
const o = a[n] || [];
|
|
969
978
|
return {
|
|
970
|
-
[n]:
|
|
979
|
+
[n]: o.filter((d) => d.id !== t)
|
|
971
980
|
};
|
|
972
981
|
});
|
|
973
982
|
},
|
|
974
983
|
onFileListChange: (t) => {
|
|
975
|
-
|
|
984
|
+
fn(t);
|
|
976
985
|
},
|
|
977
|
-
shouldContinue:
|
|
986
|
+
shouldContinue: un,
|
|
978
987
|
afterFilesClear: () => {
|
|
979
988
|
var n;
|
|
980
989
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
981
990
|
t && (de({
|
|
982
991
|
[t]: []
|
|
983
|
-
}),
|
|
992
|
+
}), He());
|
|
984
993
|
}
|
|
985
|
-
}) : null, (c == null ? void 0 : c.prompt) && (
|
|
986
|
-
appId:
|
|
994
|
+
}) : null, (c == null ? void 0 : c.prompt) && (i == null ? void 0 : i.id) && /* @__PURE__ */ f(mi, {
|
|
995
|
+
appId: i.id,
|
|
987
996
|
list: [],
|
|
988
|
-
search:
|
|
997
|
+
search: Je ? rn : "",
|
|
989
998
|
onPromptSelect: (t) => {
|
|
990
999
|
te(t.context), me(t.context);
|
|
991
1000
|
},
|
|
992
1001
|
disabled: O
|
|
993
1002
|
})]
|
|
994
|
-
}), /* @__PURE__ */
|
|
995
|
-
children: [(c == null ? void 0 : c.connectNetwork) &&
|
|
996
|
-
sessionId: (
|
|
1003
|
+
}), /* @__PURE__ */ $(Ee, {
|
|
1004
|
+
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, {
|
|
1005
|
+
sessionId: (Ot = e == null ? void 0 : e.data) == null ? void 0 : Ot.id,
|
|
997
1006
|
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) :
|
|
1007
|
+
enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) : vn,
|
|
999
1008
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
1000
1009
|
onNetStatusChange: (t) => {
|
|
1001
|
-
|
|
1010
|
+
Hn(t);
|
|
1002
1011
|
}
|
|
1003
|
-
}), (c == null ? void 0 : c.sessionList) && /* @__PURE__ */ f(
|
|
1004
|
-
currentSessionId: (
|
|
1012
|
+
}), (c == null ? void 0 : c.sessionList) && /* @__PURE__ */ f(gi, {
|
|
1013
|
+
currentSessionId: (Rt = e == null ? void 0 : e.data) == null ? void 0 : Rt.id,
|
|
1005
1014
|
onSessionChange: (t, n) => {
|
|
1006
1015
|
te(void 0), Ie(!0), w == null || w(n);
|
|
1007
1016
|
},
|
|
1008
1017
|
disabled: O
|
|
1009
|
-
}),
|
|
1018
|
+
}), Zt && Jt === "float" && /* @__PURE__ */ f("div", {
|
|
1010
1019
|
className: "session-history-drawer-component",
|
|
1011
|
-
children: /* @__PURE__ */ f(
|
|
1020
|
+
children: /* @__PURE__ */ f(Gn, {
|
|
1012
1021
|
placement: "topRight",
|
|
1013
1022
|
showArrow: !1,
|
|
1014
1023
|
overlayClassName: "session-history-overlay",
|
|
@@ -1017,7 +1026,7 @@ ${e}` : e;
|
|
|
1017
1026
|
},
|
|
1018
1027
|
getPopupContainer: (t) => t.parentNode,
|
|
1019
1028
|
content: "会话历史记录",
|
|
1020
|
-
children: /* @__PURE__ */ f(
|
|
1029
|
+
children: /* @__PURE__ */ f(G, {
|
|
1021
1030
|
className: "history-overlay-action",
|
|
1022
1031
|
disabled: O,
|
|
1023
1032
|
type: "text",
|
|
@@ -1027,47 +1036,49 @@ ${e}` : e;
|
|
|
1027
1036
|
fontSize: 24
|
|
1028
1037
|
}
|
|
1029
1038
|
}),
|
|
1030
|
-
onClick: () =>
|
|
1039
|
+
onClick: () => lt(!0)
|
|
1031
1040
|
})
|
|
1032
1041
|
})
|
|
1033
|
-
}), (c == null ? void 0 : c.sessionOpen) && /* @__PURE__ */ f(
|
|
1034
|
-
icon: /* @__PURE__ */ f(
|
|
1042
|
+
}), (c == null ? void 0 : c.sessionOpen) && /* @__PURE__ */ f(G, {
|
|
1043
|
+
icon: /* @__PURE__ */ f(li, {}),
|
|
1035
1044
|
className: "add-btn",
|
|
1036
1045
|
type: "primary",
|
|
1037
|
-
disabled:
|
|
1046
|
+
disabled: nt || !e || !y.length || O,
|
|
1038
1047
|
onClick: () => {
|
|
1039
1048
|
var t, n;
|
|
1040
|
-
Ie(!1), w == null || w(null), ie.current = null, T(!1), (t =
|
|
1049
|
+
Ie(!1), w == null || w(null), ie.current = null, T(!1), (t = et.current) == null || t.clear(), (n = Oe.current) == null || n.clear();
|
|
1041
1050
|
},
|
|
1042
1051
|
children: "新会话"
|
|
1043
1052
|
})]
|
|
1053
|
+
}), !!Ue && /* @__PURE__ */ f("div", {
|
|
1054
|
+
className: "remainingSeconds-mark"
|
|
1044
1055
|
})]
|
|
1045
|
-
}), /* @__PURE__ */
|
|
1056
|
+
}), /* @__PURE__ */ $("div", {
|
|
1046
1057
|
className: "footer-textarea",
|
|
1047
|
-
onPaste:
|
|
1048
|
-
onPasteCapture:
|
|
1049
|
-
onDrop:
|
|
1050
|
-
onDropCapture:
|
|
1051
|
-
onDragOver:
|
|
1052
|
-
onDragOverCapture:
|
|
1053
|
-
children: /* @__PURE__ */ f(
|
|
1054
|
-
ref:
|
|
1055
|
-
maxLength:
|
|
1056
|
-
text:
|
|
1058
|
+
onPaste: ut,
|
|
1059
|
+
onPasteCapture: ut,
|
|
1060
|
+
onDrop: ht,
|
|
1061
|
+
onDropCapture: ht,
|
|
1062
|
+
onDragOver: pt,
|
|
1063
|
+
onDragOverCapture: pt,
|
|
1064
|
+
children: [/* @__PURE__ */ f(oi, {
|
|
1065
|
+
ref: we,
|
|
1066
|
+
maxLength: en,
|
|
1067
|
+
text: ln,
|
|
1057
1068
|
networkStatus: !1,
|
|
1058
|
-
loading:
|
|
1059
|
-
disabled:
|
|
1060
|
-
onTextSend:
|
|
1069
|
+
loading: rt || Ce,
|
|
1070
|
+
disabled: Ke || Xe || O || rt || Ce,
|
|
1071
|
+
onTextSend: dt,
|
|
1061
1072
|
onChange: (t, n) => {
|
|
1062
1073
|
te(t);
|
|
1063
1074
|
const s = n.getText().replace(/[\n\s]+$/, "");
|
|
1064
|
-
me(s),
|
|
1075
|
+
me(s), an(s), Je || sn(!0);
|
|
1065
1076
|
},
|
|
1066
1077
|
clearAction: /* @__PURE__ */ f(Ee, {
|
|
1067
1078
|
size: 0,
|
|
1068
|
-
children: /* @__PURE__ */ f(
|
|
1079
|
+
children: /* @__PURE__ */ f(G, {
|
|
1069
1080
|
type: "link",
|
|
1070
|
-
disabled:
|
|
1081
|
+
disabled: Re || O,
|
|
1071
1082
|
ghost: !0,
|
|
1072
1083
|
icon: /* @__PURE__ */ f(re, {
|
|
1073
1084
|
style: {
|
|
@@ -1075,30 +1086,33 @@ ${e}` : e;
|
|
|
1075
1086
|
},
|
|
1076
1087
|
type: "icon-qingchujiyi"
|
|
1077
1088
|
}),
|
|
1078
|
-
onClick: () =>
|
|
1089
|
+
onClick: () => Cn()
|
|
1079
1090
|
})
|
|
1080
1091
|
})
|
|
1081
|
-
})
|
|
1092
|
+
}), !!Ue && /* @__PURE__ */ $("div", {
|
|
1093
|
+
className: "remainingSeconds-time",
|
|
1094
|
+
children: ["您之前对话触发敏感词拦截,当前处于禁言状态,暂时无法发送消息,剩余禁言时长", Ue]
|
|
1095
|
+
})]
|
|
1082
1096
|
})]
|
|
1083
1097
|
})
|
|
1084
|
-
}), /* @__PURE__ */ f(
|
|
1085
|
-
tips:
|
|
1086
|
-
}),
|
|
1087
|
-
isvisible:
|
|
1088
|
-
files:
|
|
1089
|
-
sessionId: (
|
|
1098
|
+
}), /* @__PURE__ */ f(ai, {
|
|
1099
|
+
tips: St
|
|
1100
|
+
}), tt && /* @__PURE__ */ f(di, {
|
|
1101
|
+
isvisible: tt,
|
|
1102
|
+
files: dn,
|
|
1103
|
+
sessionId: (Ut = e == null ? void 0 : e.data) == null ? void 0 : Ut.id,
|
|
1090
1104
|
onClose: (t) => {
|
|
1091
|
-
|
|
1105
|
+
cn(!1), pn(!1);
|
|
1092
1106
|
}
|
|
1093
1107
|
})]
|
|
1094
|
-
}),
|
|
1108
|
+
}), at && /* @__PURE__ */ f(ui, {
|
|
1095
1109
|
currentSession: e,
|
|
1096
|
-
application:
|
|
1110
|
+
application: i,
|
|
1097
1111
|
networkStatus: P,
|
|
1098
1112
|
setCurrentSession: w,
|
|
1099
1113
|
disabled: O,
|
|
1100
|
-
isSessionHistoryVisible:
|
|
1101
|
-
setIsSessionHistoryVisible:
|
|
1114
|
+
isSessionHistoryVisible: at,
|
|
1115
|
+
setIsSessionHistoryVisible: lt,
|
|
1102
1116
|
onSessionChange: (t) => {
|
|
1103
1117
|
Ie(!0);
|
|
1104
1118
|
}
|
|
@@ -1106,5 +1120,5 @@ ${e}` : e;
|
|
|
1106
1120
|
});
|
|
1107
1121
|
});
|
|
1108
1122
|
export {
|
|
1109
|
-
|
|
1123
|
+
Ji as default
|
|
1110
1124
|
};
|