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