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