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