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