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