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