@glodon-aiot/agent-cli-ui 3.3.2-beta.15 → 3.3.2-beta.16
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/AgentClientUI.mjs +119 -109
- package/dist/es/Dialog/AgentChat/index.mjs +281 -269
- package/dist/es/Dialog/SessionList/index.mjs +35 -34
- package/dist/es/Dialog/index.mjs +101 -94
- package/dist/es/components/FilePreview/index.mjs +26 -25
- package/dist/es/index.mjs +238 -211
- 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/style.css +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/style22.css +1 -1
- package/dist/es/src/style23.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/style3.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style31.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +30 -30
- package/dist/src/AgentClientUI.d.ts +10 -2
- package/dist/src/Dialog/SessionList/index.d.ts +1 -0
- package/dist/src/Dialog/index.d.ts +9 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/types.d.ts +2 -1
- package/package.json +3 -3
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Kt = Object.defineProperty, Wt = Object.defineProperties;
|
|
2
|
+
var Qt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var tt = Object.getOwnPropertySymbols;
|
|
4
|
+
var _t = Object.prototype.hasOwnProperty, Gt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var we = (L, o, v) => o in L ? Kt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, nt = (L, o) => {
|
|
6
6
|
for (var v in o || (o = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var v of
|
|
10
|
-
|
|
7
|
+
_t.call(o, v) && we(L, v, o[v]);
|
|
8
|
+
if (tt)
|
|
9
|
+
for (var v of tt(o))
|
|
10
|
+
Gt.call(o, v) && we(L, v, o[v]);
|
|
11
11
|
return L;
|
|
12
|
-
},
|
|
13
|
-
var D = (L, o, v) => (
|
|
12
|
+
}, it = (L, o) => Wt(L, Qt(o));
|
|
13
|
+
var D = (L, o, v) => (we(L, typeof o != "symbol" ? o + "" : o, v), v);
|
|
14
14
|
var z = (L, o, v) => new Promise((e, x) => {
|
|
15
|
-
var
|
|
15
|
+
var fe = (I) => {
|
|
16
16
|
try {
|
|
17
17
|
H(v.next(I));
|
|
18
18
|
} catch (h) {
|
|
19
19
|
x(h);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, k = (I) => {
|
|
22
22
|
try {
|
|
23
23
|
H(v.throw(I));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
x(h);
|
|
26
26
|
}
|
|
27
|
-
}, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(
|
|
27
|
+
}, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(fe, k);
|
|
28
28
|
H((v = v.apply(L, o)).next());
|
|
29
29
|
});
|
|
30
30
|
import { jsx as c, jsxs as A } from "react/jsx-runtime";
|
|
31
|
-
import { memo as
|
|
32
|
-
/* empty css */import { Divider as
|
|
33
|
-
import
|
|
34
|
-
import { IHistoryRole as G, ChatMessageRole as
|
|
35
|
-
import
|
|
31
|
+
import { memo as Xt, useState as m, useRef as B, useContext as Zt, useEffect as T, useMemo as Jt } from "react";
|
|
32
|
+
/* empty css */import { Divider as St, Spin as en, Button as _, Space as le, Upload as tn, Tooltip as nn, notification as de, message as u } from "antd";
|
|
33
|
+
import ce from "../../components/Iconfont/index.mjs";
|
|
34
|
+
import { IHistoryRole as G, ChatMessageRole as ot } from "@glodon-aiot/apis";
|
|
35
|
+
import at from "./HistoryItem/index.mjs";
|
|
36
36
|
import lt from "dayjs";
|
|
37
|
-
import { v4 as
|
|
37
|
+
import { v4 as dt } from "uuid";
|
|
38
38
|
import on from "../../context.mjs";
|
|
39
39
|
import { configuration as sn } from "@glodon-aiot/bot-client-sdk";
|
|
40
40
|
import { MB as rn } from "../../constant.mjs";
|
|
41
|
-
import
|
|
42
|
-
import { getImageExtension as
|
|
41
|
+
import an from "../../components/FilePreview/index.mjs";
|
|
42
|
+
import { getImageExtension as ln } from "../../utils/index.mjs";
|
|
43
43
|
import dn from "../../QuillEditor/index.mjs";
|
|
44
44
|
import cn from "../../components/Recommend/index.mjs";
|
|
45
45
|
import fn from "../../components/Greeting/index.mjs";
|
|
46
46
|
import gn from "../../Footer/index.mjs";
|
|
47
47
|
import { CameraOutlined as un, PlusOutlined as hn } from "@ant-design/icons";
|
|
48
48
|
import mn from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import { useMemoizedFn as
|
|
49
|
+
import yn from "../UploadingPrompt/index.mjs";
|
|
50
|
+
import pn from "./PromptSetting/index.mjs";
|
|
51
|
+
import { useMemoizedFn as xe } from "ahooks";
|
|
52
52
|
import vn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
|
-
import
|
|
54
|
-
import
|
|
53
|
+
import bn from "react-infinite-scroll-component";
|
|
54
|
+
import kn from "./Tools/ConnectToNetwork/index.mjs";
|
|
55
55
|
import wn from "./Tools/PromptManager/index.mjs";
|
|
56
56
|
import xn from "../../assets/icon.svg.mjs";
|
|
57
|
-
const In =
|
|
57
|
+
const In = Xt(at), st = {
|
|
58
58
|
icon: xn,
|
|
59
59
|
text: "今天我能帮你什么?"
|
|
60
60
|
};
|
|
@@ -69,41 +69,41 @@ class J {
|
|
|
69
69
|
D(this, "isSensitive");
|
|
70
70
|
D(this, "isSuspend");
|
|
71
71
|
D(this, "comment");
|
|
72
|
-
this.content = o, this.sessionId = v, this.role = e, this.files = x, this.content = o, this.role = e, this.sessionId = v, this.files = x, this.messageTime = lt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId =
|
|
72
|
+
this.content = o, this.sessionId = v, this.role = e, this.files = x, this.content = o, this.role = e, this.sessionId = v, this.files = x, this.messageTime = lt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = dt(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
73
73
|
isAgree: 0
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
var
|
|
77
|
+
const rt = 10, Sn = (L) => {
|
|
78
|
+
var qe, Ye, Ke, We, Qe, _e, Ge, Xe, Ze, Je, Se;
|
|
79
79
|
const {
|
|
80
80
|
application: o,
|
|
81
81
|
docViewerUrl: v = "",
|
|
82
82
|
currentSession: e,
|
|
83
83
|
onCreateSession: x,
|
|
84
|
-
embeddingService:
|
|
85
|
-
setCurrentSession:
|
|
84
|
+
embeddingService: fe,
|
|
85
|
+
setCurrentSession: k,
|
|
86
86
|
networkStatus: H,
|
|
87
87
|
setNetworkStatus: I
|
|
88
|
-
} = L, [h, C] = m([]), [
|
|
88
|
+
} = L, [h, C] = m([]), [ct, S] = m(), [ge, Ie] = m(), P = B(null), {
|
|
89
89
|
service: F,
|
|
90
90
|
agentClient: N,
|
|
91
|
-
depId:
|
|
92
|
-
footer:
|
|
93
|
-
transform:
|
|
94
|
-
defaultInput:
|
|
91
|
+
depId: ft,
|
|
92
|
+
footer: gt,
|
|
93
|
+
transform: g,
|
|
94
|
+
defaultInput: ue,
|
|
95
95
|
onMessage: ee,
|
|
96
|
-
onHistoryLoad:
|
|
96
|
+
onHistoryLoad: Le,
|
|
97
97
|
beforeMessageSend: j,
|
|
98
|
-
bodyStyle:
|
|
98
|
+
bodyStyle: ut,
|
|
99
99
|
disabled: M,
|
|
100
|
-
features:
|
|
101
|
-
popupContainer:
|
|
102
|
-
icon:
|
|
103
|
-
} =
|
|
100
|
+
features: a,
|
|
101
|
+
popupContainer: f,
|
|
102
|
+
icon: ht
|
|
103
|
+
} = Zt(on), [Ce, he] = m(!1), y = B(h), Ne = B(), [mt, yt] = m(0), [X, q] = m(), [Y, te] = m(""), [Fe, me] = m(!1), ye = B(null), [Te, pt] = m([]), [Ee, K] = m(!1), [Pe, vt] = m(!1), [bt, kt] = m(""), [wt, W] = m(), [ne, ie] = m({}), oe = B(null), Re = B(null), pe = B(null), [De, xt] = m(!1), [It, Lt] = m([]), [Ct, se] = m(!0), [Nt, Ft] = m(!0), [He, O] = m(!1), [ve, V] = m(!1), [Me, Tt] = m(!1), [E, re] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Et, Pt] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [Oe, U] = m(!1), [Ue, Z] = m(!1), [Rt, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [ze, ae] = m(!1);
|
|
104
104
|
T(() => {
|
|
105
105
|
var r, i;
|
|
106
|
-
e && (
|
|
106
|
+
e && (y.current = []), C([]);
|
|
107
107
|
const t = P.current;
|
|
108
108
|
if (t && t.scrollTo({
|
|
109
109
|
top: 0
|
|
@@ -111,23 +111,23 @@ const st = 10, Sn = (L) => {
|
|
|
111
111
|
return;
|
|
112
112
|
if (V(!1), O(!1), (i = e.messages) != null && i.length) {
|
|
113
113
|
const s = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
|
|
114
|
-
|
|
114
|
+
y.current = [...s], C([...s]);
|
|
115
115
|
}
|
|
116
|
-
const n = (
|
|
116
|
+
const n = (l) => {
|
|
117
117
|
var s;
|
|
118
|
-
(s = e == null ? void 0 : e.data) != null && s.id && (
|
|
118
|
+
(s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...l].reverse(), C([...l].reverse()), !l || l.length < 10 ? Z(!1) : Z(!0), Le && Le({
|
|
119
119
|
applicationId: o.id,
|
|
120
120
|
sessionId: e.data.id,
|
|
121
|
-
histories:
|
|
121
|
+
histories: l
|
|
122
122
|
}));
|
|
123
123
|
};
|
|
124
124
|
return e.addEventListener("history:loaded", n), () => {
|
|
125
|
-
|
|
125
|
+
y.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
|
|
126
126
|
};
|
|
127
127
|
}, [e]), T(() => {
|
|
128
128
|
const t = () => {
|
|
129
129
|
var n;
|
|
130
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && re(e.promptVariables.sort((r, i) => r.key.localeCompare(i.key))), e.knowledges &&
|
|
130
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && re(e.promptVariables.sort((r, i) => r.key.localeCompare(i.key))), e.knowledges && Pt(e.knowledges), I(e.netOpen));
|
|
131
131
|
};
|
|
132
132
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
133
133
|
e == null || e.removeEventListener("data:updated", t);
|
|
@@ -137,20 +137,26 @@ const st = 10, Sn = (L) => {
|
|
|
137
137
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
138
138
|
return;
|
|
139
139
|
const t = (r) => {
|
|
140
|
-
console.error(r.message, r.cause, "e.case")
|
|
140
|
+
console.error(r.message, r.cause, "e.case"), de.config({
|
|
141
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
142
|
+
}), de.error({
|
|
143
|
+
message: r.cause.message
|
|
144
|
+
}), de.config({
|
|
145
|
+
getContainer: void 0
|
|
146
|
+
});
|
|
141
147
|
};
|
|
142
148
|
return e.addEventListener("error", t), () => {
|
|
143
149
|
e == null || e.removeEventListener("error", t);
|
|
144
150
|
};
|
|
145
151
|
}, [e]);
|
|
146
|
-
const
|
|
152
|
+
const Dt = () => {
|
|
147
153
|
var r;
|
|
148
154
|
if (!((r = e == null ? void 0 : e.data) != null && r.id) || !(o != null && o.id))
|
|
149
155
|
return;
|
|
150
156
|
const t = e.data.id, n = h[h.length - 1];
|
|
151
157
|
if (n && n.isContext) {
|
|
152
158
|
u.config({
|
|
153
|
-
getContainer: () => (
|
|
159
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
154
160
|
}), u.success("已开启新话题"), u.config({
|
|
155
161
|
getContainer: void 0
|
|
156
162
|
});
|
|
@@ -165,63 +171,63 @@ const st = 10, Sn = (L) => {
|
|
|
165
171
|
o != null && o.id && (F == null || F.getRecommendQues(o.id).then((t) => {
|
|
166
172
|
pt(t);
|
|
167
173
|
}));
|
|
168
|
-
}, [
|
|
169
|
-
const
|
|
170
|
-
var w,
|
|
174
|
+
}, [ft, o]);
|
|
175
|
+
const je = (t) => z(void 0, null, function* () {
|
|
176
|
+
var w, p;
|
|
171
177
|
if (M) {
|
|
172
178
|
u.config({
|
|
173
|
-
getContainer: () => (
|
|
179
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
174
180
|
}), u.error("发送功能被禁用"), u.config({
|
|
175
181
|
getContainer: void 0
|
|
176
182
|
});
|
|
177
183
|
return;
|
|
178
184
|
}
|
|
179
|
-
const n = t ||
|
|
185
|
+
const n = t || ct;
|
|
180
186
|
if (!(n != null && n.trim())) {
|
|
181
187
|
u.config({
|
|
182
|
-
getContainer: () => (
|
|
188
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
183
189
|
}), u.error("请输入你想问的"), u.config({
|
|
184
190
|
getContainer: void 0
|
|
185
191
|
});
|
|
186
192
|
return;
|
|
187
193
|
}
|
|
188
|
-
if (!(E == null ? void 0 : E.every((
|
|
189
|
-
if (
|
|
194
|
+
if (!(E == null ? void 0 : E.every((b) => !!(b != null && b.value))))
|
|
195
|
+
if (g != null && g.promptVariables) {
|
|
190
196
|
u.config({
|
|
191
|
-
getContainer: () => (
|
|
197
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
192
198
|
}), u.error("变量值不能为空"), u.config({
|
|
193
199
|
getContainer: void 0
|
|
194
200
|
});
|
|
195
201
|
return;
|
|
196
202
|
} else
|
|
197
|
-
console.error("变量值不能为空", E == null ? void 0 : E.map((
|
|
198
|
-
if (
|
|
203
|
+
console.error("变量值不能为空", E == null ? void 0 : E.map((b) => !!(b != null && b.value)));
|
|
204
|
+
if (ve) {
|
|
199
205
|
u.config({
|
|
200
|
-
getContainer: () => (
|
|
206
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
201
207
|
}), u.error("正在回复中"), u.config({
|
|
202
208
|
getContainer: void 0
|
|
203
209
|
});
|
|
204
210
|
return;
|
|
205
211
|
}
|
|
206
|
-
if (
|
|
212
|
+
if (Ce) {
|
|
207
213
|
u.config({
|
|
208
|
-
getContainer: () => (
|
|
214
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
209
215
|
}), u.error("等待初始化"), u.config({
|
|
210
216
|
getContainer: void 0
|
|
211
217
|
});
|
|
212
218
|
return;
|
|
213
219
|
}
|
|
214
|
-
if (!
|
|
220
|
+
if (!Ct) {
|
|
215
221
|
u.config({
|
|
216
|
-
getContainer: () => (
|
|
222
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
217
223
|
}), u.error("正在解析文件"), u.config({
|
|
218
224
|
getContainer: void 0
|
|
219
225
|
});
|
|
220
226
|
return;
|
|
221
227
|
}
|
|
222
|
-
if (
|
|
228
|
+
if (Fe) {
|
|
223
229
|
u.config({
|
|
224
|
-
getContainer: () => (
|
|
230
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
225
231
|
}), u.error("正在上传图片"), u.config({
|
|
226
232
|
getContainer: void 0
|
|
227
233
|
});
|
|
@@ -232,16 +238,16 @@ const st = 10, Sn = (L) => {
|
|
|
232
238
|
if (!i) {
|
|
233
239
|
x == null || x({
|
|
234
240
|
netOpen: H ? 1 : 2
|
|
235
|
-
}).then((
|
|
241
|
+
}).then((b) => {
|
|
236
242
|
var R, $;
|
|
237
|
-
U(!0), I(!!((R =
|
|
238
|
-
|
|
243
|
+
U(!0), I(!!((R = b.data) != null && R.netOpen)), Q(!!(($ = b.data) != null && $.enableNetOpen)), Ht(b).then(() => {
|
|
244
|
+
k == null || k(b), U(!1), Ie(n);
|
|
239
245
|
});
|
|
240
246
|
});
|
|
241
247
|
return;
|
|
242
248
|
}
|
|
243
|
-
|
|
244
|
-
const
|
|
249
|
+
ae(!0);
|
|
250
|
+
const l = Y ? `
|
|
245
251
|
${n}` : n;
|
|
246
252
|
let s;
|
|
247
253
|
try {
|
|
@@ -249,49 +255,55 @@ ${n}` : n;
|
|
|
249
255
|
applicationId: o.id,
|
|
250
256
|
sessionId: i,
|
|
251
257
|
message: {
|
|
252
|
-
content:
|
|
258
|
+
content: l,
|
|
253
259
|
sessionId: i,
|
|
254
|
-
role:
|
|
260
|
+
role: ot.User,
|
|
255
261
|
files: ne[i]
|
|
256
262
|
}
|
|
257
263
|
}) : s = !0;
|
|
258
|
-
} catch (
|
|
264
|
+
} catch (b) {
|
|
259
265
|
s = !1;
|
|
260
266
|
}
|
|
261
|
-
if (
|
|
267
|
+
if (ae(!1), s === !1)
|
|
262
268
|
return;
|
|
263
269
|
let d = n;
|
|
264
|
-
typeof s == "object" && (d = s.content || n), ((
|
|
265
|
-
}),
|
|
270
|
+
typeof s == "object" && (d = s.content || n), ((p = ne[i]) == null ? void 0 : p.length) > 0 ? Mt(d) : be(d);
|
|
271
|
+
}), Ht = (t) => new Promise((n, r) => z(void 0, null, function* () {
|
|
266
272
|
const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
|
|
267
|
-
var
|
|
268
|
-
const w = (
|
|
273
|
+
var p;
|
|
274
|
+
const w = (p = E.find((b) => b.key === d.key)) == null ? void 0 : p.value;
|
|
269
275
|
return d.value = w || "", d;
|
|
270
276
|
});
|
|
271
|
-
re(s.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(s)
|
|
272
|
-
|
|
277
|
+
re(s.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(s).catch((d) => {
|
|
278
|
+
console.error(d), u.config({
|
|
279
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
280
|
+
}), u.error(d.message), u.config({
|
|
281
|
+
getContainer: void 0
|
|
282
|
+
});
|
|
283
|
+
}), n();
|
|
284
|
+
})), Mt = (t) => {
|
|
273
285
|
var s, d, w;
|
|
274
286
|
if (se(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
|
|
275
287
|
return;
|
|
276
288
|
const n = ((d = e.data) == null ? void 0 : d.id) || "", r = [];
|
|
277
|
-
let i = [],
|
|
278
|
-
(w = ne[n]) == null || w.forEach((
|
|
279
|
-
|
|
280
|
-
}), Promise.all(i.map((
|
|
289
|
+
let i = [], l = /* @__PURE__ */ new Set();
|
|
290
|
+
(w = ne[n]) == null || w.forEach((p) => {
|
|
291
|
+
l.has(p.id) || (i.push(p), l.add(p.id));
|
|
292
|
+
}), Promise.all(i.map((p) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, p.id, {
|
|
281
293
|
enabled: 1
|
|
282
|
-
}).then((
|
|
283
|
-
r.push(
|
|
284
|
-
}))).then((
|
|
285
|
-
se(!0),
|
|
286
|
-
}).catch((
|
|
287
|
-
throw Error(
|
|
294
|
+
}).then((b) => {
|
|
295
|
+
r.push(p);
|
|
296
|
+
}))).then((p) => {
|
|
297
|
+
se(!0), be(t, r);
|
|
298
|
+
}).catch((p) => {
|
|
299
|
+
throw Error(p);
|
|
288
300
|
});
|
|
289
301
|
};
|
|
290
302
|
T(() => {
|
|
291
|
-
if (!
|
|
303
|
+
if (!ge || !e)
|
|
292
304
|
return;
|
|
293
|
-
const t =
|
|
294
|
-
|
|
305
|
+
const t = ge, n = () => z(void 0, null, function* () {
|
|
306
|
+
ae(!0);
|
|
295
307
|
const r = Y ? `
|
|
296
308
|
${t}` : t;
|
|
297
309
|
let i;
|
|
@@ -302,44 +314,44 @@ ${t}` : t;
|
|
|
302
314
|
message: {
|
|
303
315
|
content: r,
|
|
304
316
|
sessionId: e.id,
|
|
305
|
-
role:
|
|
317
|
+
role: ot.User,
|
|
306
318
|
files: ne[e.id]
|
|
307
319
|
}
|
|
308
320
|
}) : i = !0;
|
|
309
|
-
} catch (
|
|
321
|
+
} catch (l) {
|
|
310
322
|
i = !1;
|
|
311
323
|
}
|
|
312
|
-
|
|
324
|
+
ae(!1), i !== !1 && (be(t), Ie(void 0));
|
|
313
325
|
});
|
|
314
326
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
315
327
|
e == null || e.removeEventListener("ready", n);
|
|
316
328
|
};
|
|
317
|
-
}, [
|
|
318
|
-
const
|
|
319
|
-
var
|
|
320
|
-
const r = (
|
|
329
|
+
}, [ge, e]);
|
|
330
|
+
const be = (t, n) => z(void 0, null, function* () {
|
|
331
|
+
var p, b;
|
|
332
|
+
const r = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
|
|
321
333
|
if (!r)
|
|
322
334
|
return;
|
|
323
335
|
V(!0), O(!0);
|
|
324
336
|
const i = Y ? `
|
|
325
|
-
${t}` : t,
|
|
326
|
-
S(void 0), W(void 0),
|
|
337
|
+
${t}` : t, l = new J(i, r, G.User, n);
|
|
338
|
+
S(void 0), W(void 0), y.current = [l, ...h], C(y.current), o.id && ee && ee({
|
|
327
339
|
applicationId: o.id,
|
|
328
340
|
sessionId: r,
|
|
329
|
-
message:
|
|
341
|
+
message: l
|
|
330
342
|
});
|
|
331
343
|
const s = new J("", r, G.System);
|
|
332
|
-
s.isWaiting = !0,
|
|
344
|
+
s.isWaiting = !0, y.current = [s, ...y.current], C(y.current);
|
|
333
345
|
const d = (n == null ? void 0 : n.map((R) => R.id)) || [], w = {
|
|
334
346
|
stream: sn.stream,
|
|
335
347
|
referenceFirst: !1
|
|
336
348
|
};
|
|
337
|
-
if (
|
|
338
|
-
const R = E == null ? void 0 : E.reduce(($,
|
|
349
|
+
if (g != null && g.promptVariables) {
|
|
350
|
+
const R = E == null ? void 0 : E.reduce(($, et) => ($[et.key] = et.value, $), {});
|
|
339
351
|
w.formatValues = R, e.setPromptVariables(E);
|
|
340
352
|
}
|
|
341
|
-
if (
|
|
342
|
-
const R =
|
|
353
|
+
if (g != null && g.knowledges) {
|
|
354
|
+
const R = Et;
|
|
343
355
|
w.knowledges = R;
|
|
344
356
|
}
|
|
345
357
|
yield e.send({
|
|
@@ -347,7 +359,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
347
359
|
fileIds: d
|
|
348
360
|
}, w), ie({
|
|
349
361
|
[r]: []
|
|
350
|
-
}), (
|
|
362
|
+
}), (b = oe.current) == null || b.update();
|
|
351
363
|
});
|
|
352
364
|
T(() => {
|
|
353
365
|
var r;
|
|
@@ -355,18 +367,18 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
355
367
|
if (!t)
|
|
356
368
|
return;
|
|
357
369
|
const n = (i) => {
|
|
358
|
-
if (!i.sessionId || i.sessionId && i.sessionId !==
|
|
370
|
+
if (!i.sessionId || i.sessionId && i.sessionId !== Ne.current || i.role === G.User)
|
|
359
371
|
return;
|
|
360
|
-
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1),
|
|
361
|
-
return
|
|
372
|
+
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1), y.current = y.current.filter((d) => !d.isWaiting), C([...y.current]), y.current = [...y.current], i.content))
|
|
373
|
+
return de.error({
|
|
362
374
|
message: i.content
|
|
363
375
|
});
|
|
364
|
-
const
|
|
365
|
-
s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions =
|
|
376
|
+
const l = i.actions || [], s = new J(i.content, t, G.Robot);
|
|
377
|
+
s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = l, s.isLoading = !0, s.searchingStatus = i.searchingStatus, y.current = y.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...y.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...y.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...y.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...y.current]), o.id && ee && ee({
|
|
366
378
|
applicationId: o.id,
|
|
367
379
|
sessionId: t,
|
|
368
380
|
message: s
|
|
369
|
-
})), i.index === -3 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, s.relatedQuesion = i.relatedQuesion, C([s, ...
|
|
381
|
+
})), i.index === -3 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, s.relatedQuesion = i.relatedQuesion, C([s, ...y.current]));
|
|
370
382
|
};
|
|
371
383
|
return e.ready ? e.addEventListener("message:updated", n) : e.addEventListener("ready", () => {
|
|
372
384
|
e.addEventListener("message:updated", n);
|
|
@@ -375,89 +387,89 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
375
387
|
};
|
|
376
388
|
}, [e]), T(() => {
|
|
377
389
|
if (!e) {
|
|
378
|
-
|
|
390
|
+
he(!1);
|
|
379
391
|
return;
|
|
380
392
|
}
|
|
381
393
|
const t = (n) => {
|
|
382
|
-
|
|
394
|
+
he(n);
|
|
383
395
|
};
|
|
384
|
-
return
|
|
396
|
+
return he(e.frozen), e.addEventListener("frozen", t), () => {
|
|
385
397
|
e == null || e.removeEventListener("frozen", t);
|
|
386
398
|
};
|
|
387
399
|
}, [e]), T(() => {
|
|
388
400
|
if (!N)
|
|
389
401
|
return;
|
|
390
402
|
const t = N.questionContextMaxLength || 4e3;
|
|
391
|
-
|
|
403
|
+
yt(t);
|
|
392
404
|
}, [N, F]), T(() => {
|
|
393
|
-
|
|
394
|
-
}, [
|
|
395
|
-
const
|
|
405
|
+
ue && W(ue.text);
|
|
406
|
+
}, [ue]);
|
|
407
|
+
const Ot = (t) => {
|
|
396
408
|
const n = t.size;
|
|
397
409
|
return n <= 0 ? (u.config({
|
|
398
|
-
getContainer: () => (
|
|
410
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
399
411
|
}), u.error("该文件为空,请重新上传"), u.config({
|
|
400
412
|
getContainer: void 0
|
|
401
413
|
}), !1) : n > 20 * rn ? (u.config({
|
|
402
|
-
getContainer: () => (
|
|
414
|
+
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
403
415
|
}), u.error("图片须小于20M"), u.config({
|
|
404
416
|
getContainer: void 0
|
|
405
417
|
}), !1) : (q(t), !1);
|
|
406
|
-
},
|
|
418
|
+
}, Ut = (t) => z(void 0, null, function* () {
|
|
407
419
|
var n;
|
|
408
|
-
return q(t), (n = e == null ? void 0 : e.data) != null && n.id ?
|
|
420
|
+
return q(t), (n = e == null ? void 0 : e.data) != null && n.id ? Ve(e, t) : new Promise((r) => {
|
|
409
421
|
U(!0), x == null || x({
|
|
410
422
|
netOpen: H ? 1 : 2
|
|
411
423
|
}).then((i) => {
|
|
412
|
-
var
|
|
413
|
-
|
|
424
|
+
var l, s;
|
|
425
|
+
k == null || k(i), U(!1), I(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(Ve(i, t));
|
|
414
426
|
});
|
|
415
427
|
});
|
|
416
|
-
}),
|
|
417
|
-
const r =
|
|
428
|
+
}), Ve = (t, n) => {
|
|
429
|
+
const r = ln(n.name);
|
|
418
430
|
return new Promise((i) => {
|
|
419
431
|
var s;
|
|
420
|
-
const
|
|
421
|
-
files: [`${
|
|
432
|
+
const l = {
|
|
433
|
+
files: [`${dt()}.${r}`],
|
|
422
434
|
isv: "minio",
|
|
423
435
|
knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
|
|
424
436
|
type: 1
|
|
425
437
|
};
|
|
426
|
-
|
|
438
|
+
me(!0), F == null || F.postTicket(l).then((d) => {
|
|
427
439
|
F.uploadMinioFile(d.minio, n).then(() => {
|
|
428
440
|
var R, $;
|
|
429
|
-
const w = (R = d.minio.endpoints) == null ? void 0 : R[0],
|
|
430
|
-
i(`${location.protocol}//${w}/${
|
|
441
|
+
const w = (R = d.minio.endpoints) == null ? void 0 : R[0], p = d.minio.bucket, b = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
|
|
442
|
+
i(`${location.protocol}//${w}/${p}/${b}`);
|
|
431
443
|
}).catch(() => {
|
|
432
444
|
te(""), q(void 0);
|
|
433
445
|
}).finally(() => {
|
|
434
|
-
|
|
446
|
+
me(!1);
|
|
435
447
|
});
|
|
436
448
|
}).catch(() => {
|
|
437
|
-
te(""), q(void 0),
|
|
449
|
+
te(""), q(void 0), me(!1);
|
|
438
450
|
});
|
|
439
451
|
});
|
|
440
452
|
};
|
|
441
453
|
T(() => {
|
|
442
454
|
const t = P.current;
|
|
443
|
-
t && !
|
|
455
|
+
t && !Me && t.scrollTo({
|
|
444
456
|
top: t.scrollHeight
|
|
445
457
|
});
|
|
446
458
|
}, [h]);
|
|
447
|
-
const
|
|
459
|
+
const $e = (t, n) => new Promise((r) => {
|
|
448
460
|
if (!n.file.url || !(o != null && o.id))
|
|
449
461
|
return r();
|
|
450
|
-
const i = nt(
|
|
462
|
+
const i = it(nt({}, n.file), {
|
|
451
463
|
type: 1
|
|
452
464
|
});
|
|
453
465
|
F == null || F.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
|
|
454
|
-
var
|
|
455
|
-
(
|
|
466
|
+
var l;
|
|
467
|
+
(l = oe.current) == null || l.update().finally(r);
|
|
456
468
|
});
|
|
457
|
-
}),
|
|
469
|
+
}), zt = () => {
|
|
458
470
|
var t;
|
|
459
471
|
(t = e == null ? void 0 : e.data) != null && t.id && (O(!1), e.suspend());
|
|
460
|
-
},
|
|
472
|
+
}, jt = (t) => {
|
|
461
473
|
const n = P.current;
|
|
462
474
|
n && setTimeout(() => {
|
|
463
475
|
n.scrollTo({
|
|
@@ -465,45 +477,45 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
465
477
|
behavior: t == null ? void 0 : t.behavior
|
|
466
478
|
});
|
|
467
479
|
}, t == null ? void 0 : t.ms);
|
|
468
|
-
},
|
|
480
|
+
}, Vt = () => {
|
|
469
481
|
if (!P.current)
|
|
470
482
|
return;
|
|
471
483
|
const t = P.current.scrollTop <= -80;
|
|
472
|
-
|
|
473
|
-
},
|
|
484
|
+
Tt(t);
|
|
485
|
+
}, $t = xe((t) => {
|
|
474
486
|
var n, r;
|
|
475
|
-
(n =
|
|
476
|
-
}),
|
|
477
|
-
|
|
478
|
-
}),
|
|
487
|
+
(n = ye.current) == null || n.update(t), (r = ye.current) == null || r.focus();
|
|
488
|
+
}), At = xe((t) => {
|
|
489
|
+
je(t);
|
|
490
|
+
}), Bt = xe(() => {
|
|
479
491
|
var n;
|
|
480
492
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
481
493
|
return;
|
|
482
|
-
|
|
494
|
+
y.current = [...h.slice(1, h.length)], C(y.current);
|
|
483
495
|
const t = new J("", e.data.id, G.System);
|
|
484
|
-
t.isWaiting = !0,
|
|
496
|
+
t.isWaiting = !0, y.current = [t, ...y.current], C(y.current), V(!0), O(!0), e.answerAgain();
|
|
485
497
|
});
|
|
486
498
|
T(() => {
|
|
487
499
|
var t, n;
|
|
488
|
-
|
|
500
|
+
Ne.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Oe && ((n = pe.current) == null || n.clear());
|
|
489
501
|
}, [e]);
|
|
490
|
-
const
|
|
502
|
+
const qt = () => {
|
|
491
503
|
var r;
|
|
492
504
|
if (!((r = e == null ? void 0 : e.data) != null && r.id))
|
|
493
505
|
return;
|
|
494
506
|
const n = h[h.length - 1].messageTime;
|
|
495
507
|
e.fetchMessages({
|
|
496
508
|
endTime: n,
|
|
497
|
-
pageSize:
|
|
509
|
+
pageSize: rt
|
|
498
510
|
}).then((i) => {
|
|
499
|
-
const
|
|
500
|
-
if (!
|
|
511
|
+
const l = i || [];
|
|
512
|
+
if (!l || !(l != null && l.length)) {
|
|
501
513
|
Z(!1);
|
|
502
514
|
return;
|
|
503
515
|
}
|
|
504
|
-
|
|
516
|
+
l.length < 10 ? Z(!1) : Z(!0), C([...h, ...l.reverse()]);
|
|
505
517
|
});
|
|
506
|
-
},
|
|
518
|
+
}, Yt = (t) => z(void 0, null, function* () {
|
|
507
519
|
var n, r;
|
|
508
520
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
509
521
|
I(t);
|
|
@@ -523,11 +535,11 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
523
535
|
}, [e]), T(() => {
|
|
524
536
|
var t, n;
|
|
525
537
|
if (P.current) {
|
|
526
|
-
const r = document.getElementById("chat-main"), i = (t = P.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"),
|
|
527
|
-
if (!i || !
|
|
538
|
+
const r = document.getElementById("chat-main"), i = (t = P.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = P.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
|
|
539
|
+
if (!i || !l || !r)
|
|
528
540
|
return;
|
|
529
541
|
const s = r.offsetHeight;
|
|
530
|
-
if (
|
|
542
|
+
if (l.offsetHeight <= s) {
|
|
531
543
|
if (i.style.height === "100%")
|
|
532
544
|
return;
|
|
533
545
|
i.style.height = "100%";
|
|
@@ -542,32 +554,32 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
542
554
|
return;
|
|
543
555
|
const t = () => {
|
|
544
556
|
const i = ((N == null ? void 0 : N.promptVariables) || []).filter(
|
|
545
|
-
(
|
|
557
|
+
(l) => l.key !== "query" && l.status === 1
|
|
546
558
|
// 只要求输入被引用的变量
|
|
547
|
-
).map((
|
|
548
|
-
var w,
|
|
559
|
+
).map((l, s) => {
|
|
560
|
+
var w, p;
|
|
549
561
|
let d = "";
|
|
550
|
-
return typeof (
|
|
562
|
+
return typeof (a == null ? void 0 : a.promptVariables) == "object" && (d = ((p = (w = a.promptVariables.default) == null ? void 0 : w.find((b) => b.key === l.key)) == null ? void 0 : p.value) || ""), {
|
|
551
563
|
id: s + "",
|
|
552
|
-
key:
|
|
553
|
-
name:
|
|
564
|
+
key: l.key,
|
|
565
|
+
name: l.name,
|
|
554
566
|
value: d
|
|
555
567
|
};
|
|
556
568
|
});
|
|
557
|
-
re([...i].sort((
|
|
569
|
+
re([...i].sort((l, s) => l.key.localeCompare(s.key)));
|
|
558
570
|
};
|
|
559
571
|
return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
|
|
560
572
|
N == null || N.removeEventListener("ready", t);
|
|
561
573
|
};
|
|
562
|
-
}, [e, N,
|
|
563
|
-
const
|
|
574
|
+
}, [e, N, a == null ? void 0 : a.promptVariables]);
|
|
575
|
+
const Ae = () => x == null ? void 0 : x({
|
|
564
576
|
netOpen: H ? 1 : 2
|
|
565
577
|
}).then((t) => {
|
|
566
578
|
var n, r;
|
|
567
|
-
return
|
|
568
|
-
}),
|
|
579
|
+
return k == null || k(t), U(!1), I(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), t;
|
|
580
|
+
}), Be = Jt(() => {
|
|
569
581
|
var t;
|
|
570
|
-
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(
|
|
582
|
+
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(at, {
|
|
571
583
|
application: o,
|
|
572
584
|
history: {
|
|
573
585
|
role: 1,
|
|
@@ -582,22 +594,22 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
582
594
|
isLoading: !1
|
|
583
595
|
},
|
|
584
596
|
actions: !!h.length,
|
|
585
|
-
markdown:
|
|
597
|
+
markdown: a == null ? void 0 : a.markdown
|
|
586
598
|
}) : null;
|
|
587
599
|
}, [o == null ? void 0 : o.arrange, h]);
|
|
588
600
|
return /* @__PURE__ */ A("div", {
|
|
589
601
|
className: "agent-chat",
|
|
590
|
-
children: [(
|
|
591
|
-
ref:
|
|
602
|
+
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(pn, {
|
|
603
|
+
ref: Re,
|
|
592
604
|
appId: o.id,
|
|
593
605
|
currentSession: e,
|
|
594
606
|
promptVariables: E,
|
|
595
607
|
setPromptVariables: re,
|
|
596
|
-
setCurrentSession:
|
|
608
|
+
setCurrentSession: k
|
|
597
609
|
}), /* @__PURE__ */ A("div", {
|
|
598
610
|
className: "chat-main",
|
|
599
611
|
id: "chat-main",
|
|
600
|
-
style:
|
|
612
|
+
style: ut,
|
|
601
613
|
children: [/* @__PURE__ */ c("div", {
|
|
602
614
|
className: "chat-main-wrapper",
|
|
603
615
|
id: "scrollableDiv",
|
|
@@ -608,29 +620,29 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
608
620
|
flexDirection: "column-reverse"
|
|
609
621
|
},
|
|
610
622
|
ref: P,
|
|
611
|
-
onScroll:
|
|
612
|
-
children: (
|
|
623
|
+
onScroll: Vt,
|
|
624
|
+
children: (qe = e == null ? void 0 : e.data) != null && qe.id && (h != null && h.length) ? /* @__PURE__ */ A(bn, {
|
|
613
625
|
dataLength: h.length,
|
|
614
|
-
next:
|
|
626
|
+
next: qt,
|
|
615
627
|
style: {
|
|
616
628
|
display: "flex",
|
|
617
629
|
flexDirection: "column-reverse",
|
|
618
630
|
overflowX: "hidden"
|
|
619
631
|
},
|
|
620
632
|
inverse: !0,
|
|
621
|
-
endMessage: h.length >
|
|
622
|
-
((
|
|
633
|
+
endMessage: h.length > rt && // 少于一页不展示这个提示
|
|
634
|
+
((Ye = P.current) != null && Ye.scrollTop) && ((Ke = P.current) == null ? void 0 : Ke.scrollTop) < -10 ? /* @__PURE__ */ c(St, {
|
|
623
635
|
plain: !0,
|
|
624
636
|
children: "没有更多数据了"
|
|
625
637
|
}) : null,
|
|
626
|
-
hasMore:
|
|
638
|
+
hasMore: Ue,
|
|
627
639
|
loader: /* @__PURE__ */ c("div", {
|
|
628
640
|
style: {
|
|
629
641
|
height: "50px",
|
|
630
642
|
textAlign: "center",
|
|
631
643
|
overflow: "hidden"
|
|
632
644
|
},
|
|
633
|
-
children: /* @__PURE__ */ c(
|
|
645
|
+
children: /* @__PURE__ */ c(en, {})
|
|
634
646
|
}),
|
|
635
647
|
scrollableTarget: "scrollableDiv",
|
|
636
648
|
children: [h.map((t, n) => /* @__PURE__ */ c(In, {
|
|
@@ -639,43 +651,43 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
639
651
|
history: t,
|
|
640
652
|
docViewerUrl: v,
|
|
641
653
|
isLastHistory: n === 0,
|
|
642
|
-
onRelatedClick:
|
|
643
|
-
onAgainClick:
|
|
644
|
-
onEditClick:
|
|
645
|
-
markdown:
|
|
646
|
-
}, t.messageId + n)), !
|
|
654
|
+
onRelatedClick: At,
|
|
655
|
+
onAgainClick: Bt,
|
|
656
|
+
onEditClick: $t,
|
|
657
|
+
markdown: a == null ? void 0 : a.markdown
|
|
658
|
+
}, t.messageId + n)), !Ue && Be]
|
|
647
659
|
}) : /* @__PURE__ */ A("div", {
|
|
648
660
|
className: "main-empty",
|
|
649
|
-
children: [(
|
|
650
|
-
text:
|
|
651
|
-
icon:
|
|
652
|
-
children: !!
|
|
661
|
+
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(fn, {
|
|
662
|
+
text: a === void 0 || a.greeting === !0 || ((We = a.greeting) == null ? void 0 : We.text) === void 0 ? st.text : a.greeting.text,
|
|
663
|
+
icon: a === void 0 || a.greeting === !0 || ((Qe = a.greeting) == null ? void 0 : Qe.icon) === void 0 ? ht || st.icon : a.greeting.icon,
|
|
664
|
+
children: !!Te.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__ */ c(cn, {
|
|
653
665
|
ref: pe,
|
|
654
|
-
sid: (
|
|
655
|
-
isRecommendClearing:
|
|
656
|
-
data:
|
|
666
|
+
sid: (_e = e == null ? void 0 : e.data) == null ? void 0 : _e.id,
|
|
667
|
+
isRecommendClearing: Ee,
|
|
668
|
+
data: Te,
|
|
657
669
|
onItemClick: (t) => {
|
|
658
|
-
var r, i,
|
|
659
|
-
if (S(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question),
|
|
670
|
+
var r, i, l;
|
|
671
|
+
if (S(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Ee)
|
|
660
672
|
return;
|
|
661
673
|
t != null && t.id && K(!0);
|
|
662
674
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
663
|
-
|
|
675
|
+
g != null && g.fileUpload ? (l = (i = oe.current) == null ? void 0 : i.clear()) == null || l.then(() => {
|
|
664
676
|
var s, d;
|
|
665
|
-
t != null && t.id && (n ? (s =
|
|
677
|
+
t != null && t.id && (n ? (s = $e(n, t)) == null || s.finally(() => {
|
|
666
678
|
K(!1);
|
|
667
|
-
}) : (K(!1), U(!0), (d =
|
|
668
|
-
var
|
|
669
|
-
(
|
|
679
|
+
}) : (K(!1), U(!0), (d = Ae()) == null || d.then((w) => {
|
|
680
|
+
var p;
|
|
681
|
+
(p = $e(w.id, t)) == null || p.finally(() => {
|
|
670
682
|
K(!1);
|
|
671
683
|
});
|
|
672
684
|
})));
|
|
673
|
-
}) : n ? K(!1) : (K(!1), U(!0),
|
|
685
|
+
}) : n ? K(!1) : (K(!1), U(!0), Ae());
|
|
674
686
|
}
|
|
675
687
|
})
|
|
676
|
-
}),
|
|
688
|
+
}), Be]
|
|
677
689
|
})
|
|
678
|
-
}),
|
|
690
|
+
}), He && /* @__PURE__ */ c("div", {
|
|
679
691
|
className: "session-stop",
|
|
680
692
|
children: /* @__PURE__ */ c(_, {
|
|
681
693
|
type: "primary",
|
|
@@ -684,24 +696,24 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
684
696
|
},
|
|
685
697
|
ghost: !0,
|
|
686
698
|
size: "small",
|
|
687
|
-
icon: /* @__PURE__ */ c(
|
|
699
|
+
icon: /* @__PURE__ */ c(ce, {
|
|
688
700
|
type: "icon-zantinghuida",
|
|
689
701
|
style: {
|
|
690
702
|
fontSize: 16
|
|
691
703
|
}
|
|
692
704
|
}),
|
|
693
|
-
onClick: () =>
|
|
705
|
+
onClick: () => zt(),
|
|
694
706
|
children: "停止回答"
|
|
695
707
|
})
|
|
696
|
-
}),
|
|
708
|
+
}), Me && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
|
|
697
709
|
className: "back-bottom",
|
|
698
710
|
children: /* @__PURE__ */ c(_, {
|
|
699
711
|
size: "small",
|
|
700
|
-
onClick: () =>
|
|
712
|
+
onClick: () => jt({
|
|
701
713
|
behavior: "smooth"
|
|
702
714
|
}),
|
|
703
715
|
type: "link",
|
|
704
|
-
icon: /* @__PURE__ */ c(
|
|
716
|
+
icon: /* @__PURE__ */ c(ce, {
|
|
705
717
|
type: "icon-yijianhuidaodibu",
|
|
706
718
|
style: {
|
|
707
719
|
fontSize: 24
|
|
@@ -715,25 +727,25 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
715
727
|
className: "chat-footer-input",
|
|
716
728
|
children: [X && /* @__PURE__ */ c("div", {
|
|
717
729
|
className: "input-files",
|
|
718
|
-
children: /* @__PURE__ */ c(
|
|
730
|
+
children: /* @__PURE__ */ c(an, {
|
|
719
731
|
file: X,
|
|
720
732
|
actions: {
|
|
721
|
-
upload:
|
|
733
|
+
upload: Ut,
|
|
722
734
|
remove: () => {
|
|
723
735
|
q(void 0);
|
|
724
736
|
}
|
|
725
737
|
},
|
|
726
738
|
onUrlChange: (t) => te(t)
|
|
727
739
|
})
|
|
728
|
-
}), /* @__PURE__ */ A(
|
|
740
|
+
}), /* @__PURE__ */ A(le, {
|
|
729
741
|
className: "footer-upload-action",
|
|
730
742
|
onClick: (t) => t.preventDefault(),
|
|
731
|
-
children: [/* @__PURE__ */ A(
|
|
732
|
-
children: [o.type === 2 && (
|
|
743
|
+
children: [/* @__PURE__ */ A(le, {
|
|
744
|
+
children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(tn, {
|
|
733
745
|
disabled: !!X || M,
|
|
734
746
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
735
747
|
listType: "picture-card",
|
|
736
|
-
beforeUpload:
|
|
748
|
+
beforeUpload: Ot,
|
|
737
749
|
className: "footer-upload-picture",
|
|
738
750
|
showUploadList: !1,
|
|
739
751
|
children: X ? /* @__PURE__ */ c(_, {
|
|
@@ -751,7 +763,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
751
763
|
fontSize: "22px"
|
|
752
764
|
}
|
|
753
765
|
})
|
|
754
|
-
}) : /* @__PURE__ */ c(
|
|
766
|
+
}) : /* @__PURE__ */ c(nn, {
|
|
755
767
|
placement: "topLeft",
|
|
756
768
|
overlayClassName: "footer-upload-tooltip",
|
|
757
769
|
title: /* @__PURE__ */ c("div", {
|
|
@@ -765,7 +777,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
765
777
|
position: "relative",
|
|
766
778
|
bottom: "-2px"
|
|
767
779
|
},
|
|
768
|
-
icon: /* @__PURE__ */ c(
|
|
780
|
+
icon: /* @__PURE__ */ c(ce, {
|
|
769
781
|
type: "icon-Vector",
|
|
770
782
|
className: "icon-tianjia",
|
|
771
783
|
style: {
|
|
@@ -774,10 +786,10 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
774
786
|
})
|
|
775
787
|
})
|
|
776
788
|
})
|
|
777
|
-
}),
|
|
789
|
+
}), fe && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(mn, {
|
|
778
790
|
appId: o == null ? void 0 : o.id,
|
|
779
791
|
ref: oe,
|
|
780
|
-
isFirstSession:
|
|
792
|
+
isFirstSession: Oe,
|
|
781
793
|
docViewerUrl: v,
|
|
782
794
|
onStatusChange: (t) => z(void 0, null, function* () {
|
|
783
795
|
t !== "process" ? (se(!0), ke()) : se(!1);
|
|
@@ -786,14 +798,14 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
786
798
|
U(!0), x == null || x({
|
|
787
799
|
netOpen: H ? 1 : 2
|
|
788
800
|
}).then((n) => {
|
|
789
|
-
var i,
|
|
790
|
-
|
|
801
|
+
var i, l, s;
|
|
802
|
+
k == null || k(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
|
|
791
803
|
const r = ((s = n.data) == null ? void 0 : s.id) || "";
|
|
792
804
|
t(r);
|
|
793
805
|
});
|
|
794
806
|
}),
|
|
795
|
-
sid: (
|
|
796
|
-
disabled:
|
|
807
|
+
sid: (Ge = e == null ? void 0 : e.data) == null ? void 0 : Ge.id,
|
|
808
|
+
disabled: ve || M,
|
|
797
809
|
afterFileAdd: (t, n) => {
|
|
798
810
|
n && ie((r) => {
|
|
799
811
|
const i = r[n] || [];
|
|
@@ -806,16 +818,16 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
806
818
|
var r;
|
|
807
819
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
808
820
|
n && ie((i) => {
|
|
809
|
-
const
|
|
821
|
+
const l = i[n] || [];
|
|
810
822
|
return {
|
|
811
|
-
[n]:
|
|
823
|
+
[n]: l.filter((s) => s.id !== t)
|
|
812
824
|
};
|
|
813
825
|
});
|
|
814
826
|
},
|
|
815
827
|
onFileListChange: (t) => {
|
|
816
|
-
|
|
828
|
+
Lt(t);
|
|
817
829
|
},
|
|
818
|
-
shouldContinue:
|
|
830
|
+
shouldContinue: Nt,
|
|
819
831
|
afterFilesClear: () => {
|
|
820
832
|
var n;
|
|
821
833
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
@@ -823,38 +835,38 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
823
835
|
[t]: []
|
|
824
836
|
}), ke());
|
|
825
837
|
}
|
|
826
|
-
}) : null, (
|
|
838
|
+
}) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(wn, {
|
|
827
839
|
appId: o.id,
|
|
828
840
|
list: [],
|
|
829
|
-
search:
|
|
841
|
+
search: Pe ? bt : "",
|
|
830
842
|
onPromptSelect: (t) => {
|
|
831
843
|
W(t.context), S(t.context);
|
|
832
844
|
},
|
|
833
845
|
disabled: M
|
|
834
846
|
})]
|
|
835
|
-
}), /* @__PURE__ */ A(
|
|
836
|
-
children: [(
|
|
837
|
-
sessionId: (
|
|
847
|
+
}), /* @__PURE__ */ A(le, {
|
|
848
|
+
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((Xe = o.arrange) == null ? void 0 : Xe.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(kn, {
|
|
849
|
+
sessionId: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
|
|
838
850
|
netStatus: H,
|
|
839
|
-
enable: typeof (
|
|
851
|
+
enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Rt,
|
|
840
852
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
841
853
|
onNetStatusChange: (t) => {
|
|
842
|
-
|
|
854
|
+
Yt(t);
|
|
843
855
|
}
|
|
844
|
-
}), (
|
|
845
|
-
currentSessionId: (
|
|
856
|
+
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(vn, {
|
|
857
|
+
currentSessionId: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
|
|
846
858
|
onSessionChange: (t, n) => {
|
|
847
|
-
W(void 0),
|
|
859
|
+
W(void 0), k == null || k(n);
|
|
848
860
|
},
|
|
849
861
|
disabled: M
|
|
850
|
-
}), (
|
|
862
|
+
}), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(_, {
|
|
851
863
|
icon: /* @__PURE__ */ c(hn, {}),
|
|
852
864
|
className: "add-btn",
|
|
853
865
|
type: "primary",
|
|
854
|
-
disabled:
|
|
866
|
+
disabled: He || !e || !h.length || M,
|
|
855
867
|
onClick: () => {
|
|
856
868
|
var t, n;
|
|
857
|
-
|
|
869
|
+
k == null || k(void 0), I(!1), (t = Re.current) == null || t.clear(), (n = pe.current) == null || n.clear();
|
|
858
870
|
},
|
|
859
871
|
children: "新会话"
|
|
860
872
|
})]
|
|
@@ -862,44 +874,44 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
862
874
|
}), /* @__PURE__ */ c("div", {
|
|
863
875
|
className: "footer-textarea",
|
|
864
876
|
children: /* @__PURE__ */ c(dn, {
|
|
865
|
-
ref:
|
|
866
|
-
maxLength:
|
|
867
|
-
text:
|
|
877
|
+
ref: ye,
|
|
878
|
+
maxLength: mt,
|
|
879
|
+
text: wt,
|
|
868
880
|
networkStatus: !1,
|
|
869
|
-
loading:
|
|
870
|
-
disabled:
|
|
871
|
-
onTextSend:
|
|
881
|
+
loading: ze,
|
|
882
|
+
disabled: Ce || Fe || M || ze,
|
|
883
|
+
onTextSend: je,
|
|
872
884
|
onChange: (t, n) => {
|
|
873
885
|
W(t);
|
|
874
886
|
const r = n.getText().replace(/[\n\s]+$/, "");
|
|
875
|
-
S(r), kt(r),
|
|
887
|
+
S(r), kt(r), Pe || vt(!0);
|
|
876
888
|
},
|
|
877
|
-
clearAction: /* @__PURE__ */ c(
|
|
889
|
+
clearAction: /* @__PURE__ */ c(le, {
|
|
878
890
|
size: 0,
|
|
879
891
|
children: /* @__PURE__ */ c(_, {
|
|
880
892
|
type: "link",
|
|
881
|
-
disabled:
|
|
893
|
+
disabled: ve || M,
|
|
882
894
|
ghost: !0,
|
|
883
|
-
icon: /* @__PURE__ */ c(
|
|
895
|
+
icon: /* @__PURE__ */ c(ce, {
|
|
884
896
|
style: {
|
|
885
897
|
fontSize: 22
|
|
886
898
|
},
|
|
887
899
|
type: "icon-qingchujiyi"
|
|
888
900
|
}),
|
|
889
|
-
onClick: () =>
|
|
901
|
+
onClick: () => Dt()
|
|
890
902
|
})
|
|
891
903
|
})
|
|
892
904
|
})
|
|
893
905
|
})]
|
|
894
906
|
})
|
|
895
907
|
}), /* @__PURE__ */ c(gn, {
|
|
896
|
-
tips:
|
|
897
|
-
}),
|
|
898
|
-
isvisible:
|
|
899
|
-
files:
|
|
900
|
-
sessionId: (
|
|
908
|
+
tips: gt
|
|
909
|
+
}), De && /* @__PURE__ */ c(yn, {
|
|
910
|
+
isvisible: De,
|
|
911
|
+
files: It,
|
|
912
|
+
sessionId: (Se = e == null ? void 0 : e.data) == null ? void 0 : Se.id,
|
|
901
913
|
onClose: (t) => {
|
|
902
|
-
|
|
914
|
+
xt(!1), Ft(!1);
|
|
903
915
|
}
|
|
904
916
|
})]
|
|
905
917
|
});
|