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