@glodon-aiot/agent-cli-ui 3.6.1-alpha.14 → 3.6.2-alpha.16
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/PromptManager/PromptList/PromptListItem.mjs +16 -16
- package/dist/es/Dialog/AgentChat/index.mjs +294 -285
- 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/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style21.css +1 -1
- package/dist/es/src/style22.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/style30.css +1 -1
- package/dist/es/src/style32.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/lib/index.js +52 -52
- package/package.json +3 -3
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var De = (w, h,
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var yn = Object.defineProperty, pn = Object.defineProperties;
|
|
2
|
+
var vn = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ct = Object.getOwnPropertySymbols;
|
|
4
|
+
var bn = Object.prototype.hasOwnProperty, xn = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var De = (w, h, i) => h in w ? yn(w, h, { enumerable: !0, configurable: !0, writable: !0, value: i }) : w[h] = i, Fe = (w, h) => {
|
|
6
|
+
for (var i in h || (h = {}))
|
|
7
|
+
bn.call(h, i) && De(w, i, h[i]);
|
|
8
|
+
if (Ct)
|
|
9
|
+
for (var i of Ct(h))
|
|
10
|
+
xn.call(h, i) && De(w, i, h[i]);
|
|
11
11
|
return w;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var z = (w, h,
|
|
12
|
+
}, je = (w, h) => pn(w, vn(h));
|
|
13
|
+
var j = (w, h, i) => (De(w, typeof h != "symbol" ? h + "" : h, i), i);
|
|
14
|
+
var z = (w, h, i) => new Promise((U, e) => {
|
|
15
15
|
var x = (P) => {
|
|
16
16
|
try {
|
|
17
|
-
p(
|
|
17
|
+
p(i.next(P));
|
|
18
18
|
} catch (E) {
|
|
19
19
|
e(E);
|
|
20
20
|
}
|
|
21
21
|
}, X = (P) => {
|
|
22
22
|
try {
|
|
23
|
-
p(
|
|
23
|
+
p(i.throw(P));
|
|
24
24
|
} catch (E) {
|
|
25
25
|
e(E);
|
|
26
26
|
}
|
|
27
|
-
}, p = (P) => P.done ?
|
|
28
|
-
p((
|
|
27
|
+
}, p = (P) => P.done ? U(P.value) : Promise.resolve(P.value).then(x, X);
|
|
28
|
+
p((i = i.apply(w, h)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as d, jsxs as A, Fragment as
|
|
31
|
-
import { memo as
|
|
32
|
-
/* empty css */import { Spin as
|
|
33
|
-
import
|
|
34
|
-
import { IHistoryRole as ie, ApplicationTypes as oe, ChatMessageRole as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
30
|
+
import { jsx as d, jsxs as A, Fragment as kn } from "react/jsx-runtime";
|
|
31
|
+
import { memo as wn, forwardRef as Cn, useState as u, useRef as _, useContext as In, useEffect as L, useMemo as Nn, useImperativeHandle as Ln } from "react";
|
|
32
|
+
/* empty css */import { Spin as It, Divider as Pn, Button as G, Space as Ce, Upload as En, Tooltip as Tn, Popover as On, notification as ne, message as m } from "antd";
|
|
33
|
+
import fe from "../../components/Iconfont/index.mjs";
|
|
34
|
+
import { IHistoryRole as ie, ApplicationTypes as oe, ChatMessageRole as Nt, PromptVariableType as Ie } from "@glodon-aiot/apis";
|
|
35
|
+
import Et from "./HistoryItem/index.mjs";
|
|
36
|
+
import Tt from "dayjs";
|
|
37
37
|
import { v4 as Ve } from "uuid";
|
|
38
|
-
import
|
|
39
|
-
import { configuration as
|
|
40
|
-
import { NET_OPEN_STATUS as K, MB as
|
|
41
|
-
import
|
|
42
|
-
import { getImageExtension as
|
|
38
|
+
import Hn from "../../context.mjs";
|
|
39
|
+
import { configuration as Rn } from "@glodon-aiot/bot-client-sdk";
|
|
40
|
+
import { NET_OPEN_STATUS as K, MB as Dn } from "../../constant.mjs";
|
|
41
|
+
import Fn from "../../components/FilePreview/index.mjs";
|
|
42
|
+
import { getImageExtension as jn } from "../../utils/index.mjs";
|
|
43
43
|
import Un from "../../QuillEditor/index.mjs";
|
|
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
|
-
import { useSessionState as
|
|
58
|
-
import
|
|
59
|
-
const
|
|
60
|
-
icon:
|
|
44
|
+
import Mn from "../../components/Recommend/index.mjs";
|
|
45
|
+
import Vn from "../../components/Greeting/index.mjs";
|
|
46
|
+
import zn from "../../Footer/index.mjs";
|
|
47
|
+
import { CameraOutlined as An, PlusOutlined as $n } from "@ant-design/icons";
|
|
48
|
+
import qn from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
49
|
+
import Bn from "../UploadingPrompt/index.mjs";
|
|
50
|
+
import Wn from "./PromptSetting/index.mjs";
|
|
51
|
+
import { useMemoizedFn as Ue } from "ahooks";
|
|
52
|
+
import Yn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
|
+
import Kn from "./Tools/SessionHistoryDrawer/index.mjs";
|
|
54
|
+
import Qn from "react-infinite-scroll-component";
|
|
55
|
+
import _n from "./Tools/ConnectToNetwork/index.mjs";
|
|
56
|
+
import Gn from "./Tools/PromptManager/index.mjs";
|
|
57
|
+
import { useSessionState as Xn } from "../../hooks/useSessionState.mjs";
|
|
58
|
+
import Zn from "../../assets/icon.svg.mjs";
|
|
59
|
+
const Jn = wn(Et), Lt = {
|
|
60
|
+
icon: Zn,
|
|
61
61
|
text: "今天我能帮你什么?"
|
|
62
62
|
};
|
|
63
63
|
class me {
|
|
64
|
-
constructor(h,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
constructor(h, i, U, e, x) {
|
|
65
|
+
j(this, "messageTime");
|
|
66
|
+
j(this, "isWaiting");
|
|
67
|
+
j(this, "messageId");
|
|
68
|
+
j(this, "isContext");
|
|
69
|
+
j(this, "actions");
|
|
70
|
+
j(this, "reference");
|
|
71
|
+
j(this, "isSensitive");
|
|
72
|
+
j(this, "isSuspend");
|
|
73
|
+
j(this, "imageContent");
|
|
74
74
|
// 新增:支持对话型应用的图片内容
|
|
75
|
-
|
|
76
|
-
this.content = h, this.sessionId =
|
|
75
|
+
j(this, "comment");
|
|
76
|
+
this.content = h, this.sessionId = i, this.role = U, this.files = e, this.content = h, this.role = U, this.sessionId = i, this.files = e, this.imageContent = x, this.messageTime = Tt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Ve(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
77
77
|
isAgree: 0
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const Pt = 10, Me = (w, h, i, U) => {
|
|
82
82
|
let e = w;
|
|
83
|
-
if (
|
|
84
|
-
if (
|
|
85
|
-
const x =
|
|
83
|
+
if (U === oe.Agent) {
|
|
84
|
+
if (i && i.length > 0) {
|
|
85
|
+
const x = i.map((X) => `[${X.name.replace(/\.[^/.]+$/, "")}](${X.url})`).join(`
|
|
86
86
|
`);
|
|
87
87
|
e = x ? `${x}
|
|
88
88
|
${e}` : e;
|
|
@@ -91,45 +91,45 @@ ${e}` : e;
|
|
|
91
91
|
${e}`);
|
|
92
92
|
}
|
|
93
93
|
return e;
|
|
94
|
-
},
|
|
95
|
-
var lt, dt, ct,
|
|
94
|
+
}, Oi = Cn((w, h) => {
|
|
95
|
+
var lt, dt, ct, gt, ft, mt, ut, ht, yt, pt, vt, bt, xt, kt;
|
|
96
96
|
const {
|
|
97
|
-
application:
|
|
98
|
-
docViewerUrl:
|
|
97
|
+
application: i,
|
|
98
|
+
docViewerUrl: U = "",
|
|
99
99
|
currentSession: e,
|
|
100
100
|
onCreateSession: x,
|
|
101
101
|
embeddingService: X,
|
|
102
102
|
setCurrentSession: p,
|
|
103
103
|
networkStatus: P,
|
|
104
104
|
setNetworkStatus: E
|
|
105
|
-
} = w, [v, C] = u([]), [
|
|
105
|
+
} = w, [v, C] = u([]), [Ot, ue] = u(), [Ne, ze] = u(), T = _(null), {
|
|
106
106
|
service: O,
|
|
107
107
|
agentClient: I,
|
|
108
|
-
depId:
|
|
109
|
-
footer:
|
|
110
|
-
transform:
|
|
108
|
+
depId: Ht,
|
|
109
|
+
footer: Rt,
|
|
110
|
+
transform: f,
|
|
111
111
|
defaultInput: Le,
|
|
112
112
|
onMessage: he,
|
|
113
113
|
onHistoryLoad: Ae,
|
|
114
114
|
beforeMessageSend: $,
|
|
115
|
-
bodyStyle:
|
|
115
|
+
bodyStyle: Dt,
|
|
116
116
|
disabled: H,
|
|
117
|
-
features:
|
|
118
|
-
popupContainer:
|
|
119
|
-
icon:
|
|
120
|
-
sider:
|
|
117
|
+
features: s,
|
|
118
|
+
popupContainer: g,
|
|
119
|
+
icon: Ft,
|
|
120
|
+
sider: jt,
|
|
121
121
|
mode: Ut
|
|
122
|
-
} =
|
|
122
|
+
} = In(Hn), [$e, Pe] = u(!1), y = _(v), qe = _(void 0), [Mt, Vt] = u(0), [se, Z] = u(), [re, ae] = u(""), [Be, Ee] = u(!1), ye = _(null), [We, zt] = u([]), [Ye, J] = u(!1), [Ke, At] = u(!1), [$t, qt] = u(""), [Bt, S] = u(), [ee, le] = u({}), pe = _(null), Qe = _(null), Te = _(null), [_e, Wt] = u(!1), [Yt, Kt] = u([]), [Qt, ve] = u(!0), [_t, Gt] = u(!0), [Ge, M] = u(!1), [Oe, q] = u(!1), [Xe, Xt] = u(!1), [R, de] = u(typeof (s == null ? void 0 : s.promptVariables) == "object" ? s.promptVariables.default || [] : []), [Zt, Jt] = u(typeof (s == null ? void 0 : s.knowledges) == "object" && s.knowledges.default || void 0), [Ze, V] = u(!1), [Je, ce] = u(!1), [St, te] = u(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), [Se, be] = u(!1), [en, B] = u(!1), [tn, nn] = u(null), [xe, Q] = u(!1), [et, tt] = u(!1), {
|
|
123
123
|
isSwitchingToExistingSession: nt,
|
|
124
124
|
setIsSwitchingToExistingSession: ke
|
|
125
|
-
} =
|
|
125
|
+
} = Xn();
|
|
126
126
|
L(() => {
|
|
127
|
-
if (
|
|
127
|
+
if (nn(e), e === null)
|
|
128
128
|
B(!1);
|
|
129
129
|
else if (e === void 0)
|
|
130
130
|
B(!0);
|
|
131
131
|
else {
|
|
132
|
-
if (
|
|
132
|
+
if (tn === null) {
|
|
133
133
|
if (nt) {
|
|
134
134
|
B(!0), ke(!1);
|
|
135
135
|
return;
|
|
@@ -148,15 +148,15 @@ ${e}`);
|
|
|
148
148
|
}), !((a = e == null ? void 0 : e.data) != null && a.id))
|
|
149
149
|
return;
|
|
150
150
|
if (q(!1), M(!1), (l = e.messages) != null && l.length) {
|
|
151
|
-
const c = [...e.messages.filter((
|
|
151
|
+
const c = [...e.messages.filter((r) => r == null ? void 0 : r.messageId)].reverse();
|
|
152
152
|
y.current = [...c], C([...c]), B(!1);
|
|
153
153
|
}
|
|
154
|
-
const n = (
|
|
154
|
+
const n = (o) => {
|
|
155
155
|
var c;
|
|
156
|
-
(c = e == null ? void 0 : e.data) != null && c.id && (y.current = [...
|
|
157
|
-
applicationId:
|
|
156
|
+
(c = e == null ? void 0 : e.data) != null && c.id && (y.current = [...o].reverse(), C([...o].reverse()), !o || o.length < 10 ? ce(!1) : ce(!0), B(!1), Ae && Ae({
|
|
157
|
+
applicationId: i.id,
|
|
158
158
|
sessionId: e.data.id,
|
|
159
|
-
histories:
|
|
159
|
+
histories: o
|
|
160
160
|
}));
|
|
161
161
|
};
|
|
162
162
|
return e.addEventListener("history:loaded", n), () => {
|
|
@@ -165,7 +165,7 @@ ${e}`);
|
|
|
165
165
|
}, [e]), L(() => {
|
|
166
166
|
const t = () => {
|
|
167
167
|
var n;
|
|
168
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && de(e.promptVariables.sort((a, l) => a.key.localeCompare(l.key))), e.knowledges &&
|
|
168
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && de(e.promptVariables.sort((a, l) => a.key.localeCompare(l.key))), e.knowledges && Jt(e.knowledges), E(e.netOpen));
|
|
169
169
|
};
|
|
170
170
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
171
171
|
e == null || e.removeEventListener("data:updated", t);
|
|
@@ -177,7 +177,7 @@ ${e}`);
|
|
|
177
177
|
const t = (a) => {
|
|
178
178
|
var l;
|
|
179
179
|
console.error(a.message, a.cause, "e.case"), ne.config({
|
|
180
|
-
getContainer: () => (
|
|
180
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
181
181
|
prefixCls: "gbot-notification"
|
|
182
182
|
}), ne.error({
|
|
183
183
|
message: ((l = a.cause) == null ? void 0 : l.message) || a.message
|
|
@@ -190,14 +190,14 @@ ${e}`);
|
|
|
190
190
|
e == null || e.removeEventListener("error", t);
|
|
191
191
|
};
|
|
192
192
|
}, [e]);
|
|
193
|
-
const
|
|
193
|
+
const on = () => {
|
|
194
194
|
var a;
|
|
195
|
-
if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(
|
|
195
|
+
if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(i != null && i.id))
|
|
196
196
|
return;
|
|
197
197
|
const t = e.data.id, n = v[v.length - 1];
|
|
198
198
|
if (n && n.isContext) {
|
|
199
199
|
m.config({
|
|
200
|
-
getContainer: () => (
|
|
200
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
201
201
|
prefixCls: "gbot-message"
|
|
202
202
|
}), m.success("已开启新话题"), m.config({
|
|
203
203
|
getContainer: void 0,
|
|
@@ -211,15 +211,15 @@ ${e}`);
|
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
213
|
L(() => {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
i != null && i.id && (O == null || O.getRecommendQues(i.id).then((t) => {
|
|
215
|
+
zt(t);
|
|
216
216
|
}));
|
|
217
|
-
}, [
|
|
217
|
+
}, [Ht, i]);
|
|
218
218
|
const it = (t) => z(void 0, null, function* () {
|
|
219
219
|
var W, Y;
|
|
220
220
|
if (H) {
|
|
221
221
|
m.config({
|
|
222
|
-
getContainer: () => (
|
|
222
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
223
223
|
prefixCls: "gbot-message"
|
|
224
224
|
}), m.error("发送功能被禁用"), m.config({
|
|
225
225
|
getContainer: void 0,
|
|
@@ -227,10 +227,10 @@ ${e}`);
|
|
|
227
227
|
});
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
const n = t ||
|
|
230
|
+
const n = t || Ot;
|
|
231
231
|
if (!(n != null && n.trim())) {
|
|
232
232
|
m.config({
|
|
233
|
-
getContainer: () => (
|
|
233
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
234
234
|
prefixCls: "gbot-message"
|
|
235
235
|
}), m.error("请输入你想问的"), m.config({
|
|
236
236
|
getContainer: void 0,
|
|
@@ -239,9 +239,9 @@ ${e}`);
|
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
if (!(R == null ? void 0 : R.every((k) => !!(k != null && k.value))))
|
|
242
|
-
if (
|
|
242
|
+
if (f != null && f.promptVariables) {
|
|
243
243
|
m.config({
|
|
244
|
-
getContainer: () => (
|
|
244
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
245
245
|
prefixCls: "gbot-message"
|
|
246
246
|
}), m.error("变量值不能为空"), m.config({
|
|
247
247
|
getContainer: void 0,
|
|
@@ -252,7 +252,7 @@ ${e}`);
|
|
|
252
252
|
console.error("变量值不能为空", R == null ? void 0 : R.map((k) => !!(k != null && k.value)));
|
|
253
253
|
if (Oe) {
|
|
254
254
|
m.config({
|
|
255
|
-
getContainer: () => (
|
|
255
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
256
256
|
prefixCls: "gbot-message"
|
|
257
257
|
}), m.error("正在回复中"), m.config({
|
|
258
258
|
getContainer: void 0,
|
|
@@ -262,7 +262,7 @@ ${e}`);
|
|
|
262
262
|
}
|
|
263
263
|
if ($e) {
|
|
264
264
|
m.config({
|
|
265
|
-
getContainer: () => (
|
|
265
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
266
266
|
prefixCls: "gbot-message"
|
|
267
267
|
}), m.error("等待初始化"), m.config({
|
|
268
268
|
getContainer: void 0,
|
|
@@ -270,9 +270,9 @@ ${e}`);
|
|
|
270
270
|
});
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
|
-
if (!
|
|
273
|
+
if (!Qt) {
|
|
274
274
|
m.config({
|
|
275
|
-
getContainer: () => (
|
|
275
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
276
276
|
prefixCls: "gbot-message"
|
|
277
277
|
}), m.error("正在解析文件"), m.config({
|
|
278
278
|
getContainer: void 0,
|
|
@@ -282,7 +282,7 @@ ${e}`);
|
|
|
282
282
|
}
|
|
283
283
|
if (Be) {
|
|
284
284
|
m.config({
|
|
285
|
-
getContainer: () => (
|
|
285
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
286
286
|
prefixCls: "gbot-message"
|
|
287
287
|
}), m.error("正在上传图片"), m.config({
|
|
288
288
|
getContainer: void 0,
|
|
@@ -298,8 +298,8 @@ ${e}`);
|
|
|
298
298
|
Q(!0), x == null || x({
|
|
299
299
|
netOpen: P ? K.OPEN : K.CLOSE
|
|
300
300
|
}).then((k) => {
|
|
301
|
-
var F,
|
|
302
|
-
V(!0), E(!!((F = k.data) != null && F.netOpen)), te(!!((
|
|
301
|
+
var F, ge;
|
|
302
|
+
V(!0), E(!!((F = k.data) != null && F.netOpen)), te(!!((ge = k.data) != null && ge.enableNetOpen)), we(k).then(() => {
|
|
303
303
|
p == null || p(k), V(!1), ze(n);
|
|
304
304
|
});
|
|
305
305
|
}).catch((k) => {
|
|
@@ -310,16 +310,16 @@ ${e}`);
|
|
|
310
310
|
if (xe)
|
|
311
311
|
return;
|
|
312
312
|
Q(!0), be(!0);
|
|
313
|
-
const
|
|
313
|
+
const o = Me(n, re, ee[l], (i == null ? void 0 : i.type) || 0);
|
|
314
314
|
let c;
|
|
315
315
|
try {
|
|
316
316
|
$ ? c = yield $ == null ? void 0 : $({
|
|
317
|
-
applicationId:
|
|
317
|
+
applicationId: i.id,
|
|
318
318
|
sessionId: l,
|
|
319
319
|
message: {
|
|
320
|
-
content:
|
|
320
|
+
content: o,
|
|
321
321
|
sessionId: l,
|
|
322
|
-
role:
|
|
322
|
+
role: Nt.User,
|
|
323
323
|
files: ee[l]
|
|
324
324
|
}
|
|
325
325
|
}) : c = !0;
|
|
@@ -330,8 +330,8 @@ ${e}`);
|
|
|
330
330
|
Q(!1);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
|
-
let
|
|
334
|
-
typeof c == "object" && (
|
|
333
|
+
let r = n;
|
|
334
|
+
typeof c == "object" && (r = c.content || n);
|
|
335
335
|
const N = yield (() => new Promise((k) => {
|
|
336
336
|
de((F) => (k(F), F));
|
|
337
337
|
}))();
|
|
@@ -339,29 +339,29 @@ ${e}`);
|
|
|
339
339
|
Q(!1);
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
|
-
((Y = ee[l]) == null ? void 0 : Y.length) > 0 ?
|
|
342
|
+
((Y = ee[l]) == null ? void 0 : Y.length) > 0 ? sn(r) : He(r);
|
|
343
343
|
}), we = (t) => new Promise((n, a) => z(void 0, null, function* () {
|
|
344
|
-
const c = (t == null ? void 0 : t.promptVariables).filter((
|
|
344
|
+
const c = (t == null ? void 0 : t.promptVariables).filter((r) => r.type ? !((r.type === Ie.User || r.type === void 0) && r.key === "query") && !((r.type === Ie.System || r.type === void 0) && r.key === "datetime") : r.key !== "query").map((r) => {
|
|
345
345
|
var N;
|
|
346
|
-
const b = (N = R.find((D) => D.key ===
|
|
347
|
-
return
|
|
346
|
+
const b = (N = R.find((D) => D.key === r.key && D.type === r.type)) == null ? void 0 : N.value;
|
|
347
|
+
return r.value = b || "", r;
|
|
348
348
|
});
|
|
349
|
-
de(c.sort((
|
|
350
|
-
console.error(
|
|
351
|
-
getContainer: () => (
|
|
349
|
+
de(c.sort((r, b) => r.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(c).catch((r) => {
|
|
350
|
+
console.error(r), m.config({
|
|
351
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
352
352
|
prefixCls: "gbot-message"
|
|
353
|
-
}), m.error(
|
|
353
|
+
}), m.error(r.message), m.config({
|
|
354
354
|
getContainer: void 0,
|
|
355
355
|
prefixCls: "gbot-message"
|
|
356
356
|
});
|
|
357
357
|
}), n();
|
|
358
|
-
})),
|
|
359
|
-
var
|
|
360
|
-
if (ve(!1), !((
|
|
358
|
+
})), sn = (t) => {
|
|
359
|
+
var o, c, r;
|
|
360
|
+
if (ve(!1), !((o = e == null ? void 0 : e.data) != null && o.id) || !(i != null && i.id))
|
|
361
361
|
return;
|
|
362
362
|
const n = ((c = e.data) == null ? void 0 : c.id) || "";
|
|
363
363
|
let a = [], l = /* @__PURE__ */ new Set();
|
|
364
|
-
(
|
|
364
|
+
(r = ee[n]) == null || r.forEach((b) => {
|
|
365
365
|
l.has(b.id) || (a.push(b), l.add(b.id));
|
|
366
366
|
}), ve(!0), He(t, a);
|
|
367
367
|
};
|
|
@@ -370,20 +370,20 @@ ${e}`);
|
|
|
370
370
|
return;
|
|
371
371
|
const t = Ne, n = () => z(void 0, null, function* () {
|
|
372
372
|
be(!0);
|
|
373
|
-
const a = Me(t, re, ee[e.id], (
|
|
373
|
+
const a = Me(t, re, ee[e.id], (i == null ? void 0 : i.type) || 0);
|
|
374
374
|
let l;
|
|
375
375
|
try {
|
|
376
376
|
$ ? l = yield $ == null ? void 0 : $({
|
|
377
|
-
applicationId:
|
|
377
|
+
applicationId: i.id,
|
|
378
378
|
sessionId: e.id,
|
|
379
379
|
message: {
|
|
380
380
|
content: a,
|
|
381
381
|
sessionId: e.id,
|
|
382
|
-
role:
|
|
382
|
+
role: Nt.User,
|
|
383
383
|
files: ee[e.id]
|
|
384
384
|
}
|
|
385
385
|
}) : l = !0;
|
|
386
|
-
} catch (
|
|
386
|
+
} catch (o) {
|
|
387
387
|
l = !1;
|
|
388
388
|
}
|
|
389
389
|
if (be(!1), l === !1) {
|
|
@@ -402,34 +402,34 @@ ${e}`);
|
|
|
402
402
|
if (!a)
|
|
403
403
|
return;
|
|
404
404
|
q(!0), M(!0);
|
|
405
|
-
const l = Me(t, re, n, (
|
|
406
|
-
let
|
|
407
|
-
|
|
405
|
+
const l = Me(t, re, n, (i == null ? void 0 : i.type) || 0);
|
|
406
|
+
let o;
|
|
407
|
+
i.type === oe.Agent ? o = void 0 : i.type === oe.Dialog && ((Y = i.arrange) != null && Y.length) && i.arrange[0].visionOpen ? o = re ? [re] : void 0 : o = void 0;
|
|
408
408
|
const c = new me(
|
|
409
409
|
l,
|
|
410
410
|
a,
|
|
411
411
|
ie.User,
|
|
412
412
|
n,
|
|
413
|
-
|
|
413
|
+
o
|
|
414
414
|
// 新增:传入图片内容
|
|
415
415
|
);
|
|
416
|
-
ue(void 0), S(void 0), y.current = [c, ...v], C(y.current),
|
|
417
|
-
applicationId:
|
|
416
|
+
ue(void 0), S(void 0), y.current = [c, ...v], C(y.current), i.id && he && he({
|
|
417
|
+
applicationId: i.id,
|
|
418
418
|
sessionId: a,
|
|
419
419
|
message: c
|
|
420
420
|
});
|
|
421
|
-
const
|
|
422
|
-
|
|
421
|
+
const r = new me("", a, ie.System);
|
|
422
|
+
r.isWaiting = !0, y.current = [r, ...y.current], C(y.current);
|
|
423
423
|
const b = (n == null ? void 0 : n.map((F) => F.id)) || [], N = {
|
|
424
|
-
stream:
|
|
424
|
+
stream: Rn.stream,
|
|
425
425
|
referenceFirst: !1
|
|
426
426
|
};
|
|
427
|
-
if (
|
|
428
|
-
const F = R == null ? void 0 : R.reduce((
|
|
427
|
+
if (f != null && f.promptVariables) {
|
|
428
|
+
const F = R == null ? void 0 : R.reduce((ge, wt) => (ge[wt.key] = wt.value, ge), {});
|
|
429
429
|
N.formatValues = F;
|
|
430
430
|
}
|
|
431
|
-
if (
|
|
432
|
-
const F =
|
|
431
|
+
if (f != null && f.knowledges) {
|
|
432
|
+
const F = Zt;
|
|
433
433
|
N.knowledges = F;
|
|
434
434
|
}
|
|
435
435
|
const D = {
|
|
@@ -437,7 +437,7 @@ ${e}`);
|
|
|
437
437
|
fileIds: b,
|
|
438
438
|
files: n
|
|
439
439
|
};
|
|
440
|
-
|
|
440
|
+
o && o.length > 0 && (D.imageContent = o), yield e.send(D, N), le({
|
|
441
441
|
[a]: []
|
|
442
442
|
}), (k = pe.current) == null || k.update(), Q(!1);
|
|
443
443
|
});
|
|
@@ -446,27 +446,27 @@ ${e}`);
|
|
|
446
446
|
const t = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
|
|
447
447
|
if (!t)
|
|
448
448
|
return;
|
|
449
|
-
const n = (
|
|
450
|
-
if (!
|
|
449
|
+
const n = (o) => {
|
|
450
|
+
if (!o.sessionId || o.sessionId && o.sessionId !== qe.current || o.role === ie.User)
|
|
451
451
|
return;
|
|
452
|
-
if (
|
|
452
|
+
if (o.index === -1 && o.code !== 200 && o.code !== 11915 && (M(!1), q(!1), y.current = y.current.filter((b) => !b.isWaiting), C([...y.current]), y.current = [...y.current], o.content)) {
|
|
453
453
|
ne.config({
|
|
454
|
-
getContainer: () => (
|
|
454
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
455
455
|
prefixCls: "gbot-notification"
|
|
456
456
|
}), ne.error({
|
|
457
|
-
message:
|
|
457
|
+
message: o.content
|
|
458
458
|
}), ne.config({
|
|
459
459
|
getContainer: void 0,
|
|
460
460
|
prefixCls: "gbot-notification"
|
|
461
461
|
});
|
|
462
462
|
return;
|
|
463
463
|
}
|
|
464
|
-
const c =
|
|
465
|
-
|
|
466
|
-
applicationId:
|
|
464
|
+
const c = o.actions || [], r = new me(o.content, t, ie.Robot);
|
|
465
|
+
r.messageId = o.messageId || Ve(), r.reasoningContent = o.reasoningContent, r.searchReference = o.searchReference, r.thinkingSecs = o.thinkingSecs, r.thinkingStatus = o.thinkingStatus, r.actions = c, r.isLoading = !0, r.searchingStatus = o.searchingStatus, y.current = y.current.filter((b) => !b.isWaiting).filter((b) => !b.isReplying), o.index === void 0 && C([r, ...y.current]), o.code === 11915 && (M(!1), q(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, C([r, ...y.current])), o.index === -2 && (M(!1), q(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, C([r, ...y.current])), o.index === -1 && (M(!1), q(!1), r.isLoading = !1, r.reference = o.reference, C([r, ...y.current]), i.id && he && he({
|
|
466
|
+
applicationId: i.id,
|
|
467
467
|
sessionId: t,
|
|
468
|
-
message:
|
|
469
|
-
})),
|
|
468
|
+
message: r
|
|
469
|
+
})), o.index === -3 && (M(!1), q(!1), r.isLoading = !1, r.reference = o.reference, r.relatedQuesion = o.relatedQuesion, C([r, ...y.current]));
|
|
470
470
|
}, a = () => {
|
|
471
471
|
e.addEventListener("message:updated", n);
|
|
472
472
|
};
|
|
@@ -488,49 +488,49 @@ ${e}`);
|
|
|
488
488
|
if (!I)
|
|
489
489
|
return;
|
|
490
490
|
const t = I.questionContextMaxLength || 4e3;
|
|
491
|
-
|
|
491
|
+
Vt(t);
|
|
492
492
|
}, [I, O]), L(() => {
|
|
493
493
|
Le && S(Le.text);
|
|
494
494
|
}, [Le]);
|
|
495
|
-
const
|
|
495
|
+
const rn = (t) => {
|
|
496
496
|
const n = t.size;
|
|
497
497
|
return n <= 0 ? (m.config({
|
|
498
|
-
getContainer: () => (
|
|
498
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
499
499
|
prefixCls: "gbot-message"
|
|
500
500
|
}), m.error("该文件为空,请重新上传"), m.config({
|
|
501
501
|
getContainer: void 0,
|
|
502
502
|
prefixCls: "gbot-message"
|
|
503
|
-
}), !1) : n > 20 *
|
|
504
|
-
getContainer: () => (
|
|
503
|
+
}), !1) : n > 20 * Dn ? (m.config({
|
|
504
|
+
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
505
505
|
prefixCls: "gbot-message"
|
|
506
506
|
}), m.error("图片须小于20M"), m.config({
|
|
507
507
|
getContainer: void 0,
|
|
508
508
|
prefixCls: "gbot-message"
|
|
509
509
|
}), !1) : (Z(t), !1);
|
|
510
|
-
},
|
|
510
|
+
}, an = (t) => z(void 0, null, function* () {
|
|
511
511
|
var n;
|
|
512
512
|
return Z(t), (n = e == null ? void 0 : e.data) != null && n.id ? ot(e, t) : new Promise((a) => {
|
|
513
513
|
V(!0), x == null || x({
|
|
514
514
|
netOpen: P ? K.OPEN : K.CLOSE
|
|
515
515
|
}).then((l) => {
|
|
516
|
-
var
|
|
517
|
-
p == null || p(l), V(!1), E(!!((
|
|
516
|
+
var o, c;
|
|
517
|
+
p == null || p(l), V(!1), E(!!((o = l.data) != null && o.netOpen)), te(!!((c = l.data) != null && c.enableNetOpen)), we(l), a(ot(l, t));
|
|
518
518
|
});
|
|
519
519
|
});
|
|
520
520
|
}), ot = (t, n) => {
|
|
521
|
-
const a =
|
|
521
|
+
const a = jn(n.name);
|
|
522
522
|
return new Promise((l) => {
|
|
523
523
|
var c;
|
|
524
|
-
const
|
|
524
|
+
const o = {
|
|
525
525
|
files: [`${Ve()}.${a}`],
|
|
526
526
|
isv: "minio",
|
|
527
527
|
knowledgeId: ((c = t.data) == null ? void 0 : c.id) || "",
|
|
528
528
|
type: 1
|
|
529
529
|
};
|
|
530
|
-
Ee(!0), O == null || O.postTicket(
|
|
531
|
-
O.uploadMinioFile(
|
|
530
|
+
Ee(!0), O == null || O.postTicket(o).then((r) => {
|
|
531
|
+
O.uploadMinioFile(r.minio, n).then(() => {
|
|
532
532
|
var W, Y;
|
|
533
|
-
const b = (W =
|
|
533
|
+
const b = (W = r.minio.endpoints) == null ? void 0 : W[0], N = r.minio.bucket, D = (Y = r.minio.fileKeys) == null ? void 0 : Y[0];
|
|
534
534
|
l(`${location.protocol}//${b}/${N}/${D}`);
|
|
535
535
|
}).catch(() => {
|
|
536
536
|
ae(""), Z(void 0);
|
|
@@ -549,19 +549,19 @@ ${e}`);
|
|
|
549
549
|
});
|
|
550
550
|
}, [v]);
|
|
551
551
|
const st = (t, n) => new Promise((a) => {
|
|
552
|
-
if (!n.file.url || !(
|
|
552
|
+
if (!n.file.url || !(i != null && i.id))
|
|
553
553
|
return a();
|
|
554
|
-
const l =
|
|
554
|
+
const l = je(Fe({}, n.file), {
|
|
555
555
|
type: 1
|
|
556
556
|
});
|
|
557
|
-
O == null || O.postApplicationIdSessionKnowledgeSessionFile(
|
|
558
|
-
var
|
|
559
|
-
(
|
|
557
|
+
O == null || O.postApplicationIdSessionKnowledgeSessionFile(i == null ? void 0 : i.id, t, l).finally(() => {
|
|
558
|
+
var o;
|
|
559
|
+
(o = pe.current) == null || o.update().finally(a);
|
|
560
560
|
});
|
|
561
|
-
}),
|
|
561
|
+
}), ln = () => {
|
|
562
562
|
var t;
|
|
563
563
|
(t = e == null ? void 0 : e.data) != null && t.id && (M(!1), e.suspend());
|
|
564
|
-
},
|
|
564
|
+
}, dn = (t) => {
|
|
565
565
|
const n = T.current;
|
|
566
566
|
n && setTimeout(() => {
|
|
567
567
|
n.scrollTo({
|
|
@@ -569,17 +569,17 @@ ${e}`);
|
|
|
569
569
|
behavior: t == null ? void 0 : t.behavior
|
|
570
570
|
});
|
|
571
571
|
}, t == null ? void 0 : t.ms);
|
|
572
|
-
},
|
|
572
|
+
}, cn = () => {
|
|
573
573
|
if (!T.current)
|
|
574
574
|
return;
|
|
575
575
|
const t = T.current.scrollTop <= -80;
|
|
576
|
-
|
|
577
|
-
},
|
|
576
|
+
Xt(t);
|
|
577
|
+
}, gn = Ue((t) => {
|
|
578
578
|
var n, a;
|
|
579
579
|
(n = ye.current) == null || n.update(t), (a = ye.current) == null || a.focus();
|
|
580
|
-
}), fn =
|
|
580
|
+
}), fn = Ue((t) => {
|
|
581
581
|
it(t);
|
|
582
|
-
}),
|
|
582
|
+
}), mn = Ue(() => {
|
|
583
583
|
var n;
|
|
584
584
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
585
585
|
return;
|
|
@@ -591,23 +591,23 @@ ${e}`);
|
|
|
591
591
|
var t, n;
|
|
592
592
|
qe.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Ze && ((n = Te.current) == null || n.clear());
|
|
593
593
|
}, [e]);
|
|
594
|
-
const
|
|
594
|
+
const un = () => {
|
|
595
595
|
var a;
|
|
596
596
|
if (!((a = e == null ? void 0 : e.data) != null && a.id))
|
|
597
597
|
return;
|
|
598
598
|
const n = v[v.length - 1].messageTime;
|
|
599
599
|
e.fetchMessages({
|
|
600
600
|
endTime: n,
|
|
601
|
-
pageSize:
|
|
601
|
+
pageSize: Pt
|
|
602
602
|
}).then((l) => {
|
|
603
|
-
const
|
|
604
|
-
if (!
|
|
603
|
+
const o = l || [];
|
|
604
|
+
if (!o || !(o != null && o.length)) {
|
|
605
605
|
ce(!1);
|
|
606
606
|
return;
|
|
607
607
|
}
|
|
608
|
-
|
|
608
|
+
o.length < 10 ? ce(!1) : ce(!0), C([...v, ...o.reverse()]);
|
|
609
609
|
});
|
|
610
|
-
},
|
|
610
|
+
}, hn = (t) => z(void 0, null, function* () {
|
|
611
611
|
var n, a;
|
|
612
612
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
613
613
|
E(t);
|
|
@@ -620,7 +620,7 @@ ${e}`);
|
|
|
620
620
|
e ? e.fetchData().then((t) => {
|
|
621
621
|
var n;
|
|
622
622
|
(n = e == null ? void 0 : e.data) != null && n.id && (E(t.netOpen), te(t.enableNetOpen));
|
|
623
|
-
}) : (E(typeof (
|
|
623
|
+
}) : (E(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), te(i.arrange[0].enableNetOpen));
|
|
624
624
|
});
|
|
625
625
|
L(() => {
|
|
626
626
|
Re();
|
|
@@ -628,18 +628,18 @@ ${e}`);
|
|
|
628
628
|
requestAnimationFrame(() => {
|
|
629
629
|
var n, a;
|
|
630
630
|
if (T.current) {
|
|
631
|
-
const l = document.getElementById("chat-main"),
|
|
632
|
-
if (!
|
|
631
|
+
const l = document.getElementById("chat-main"), o = (n = T.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), c = (a = T.current) == null ? void 0 : a.querySelector(".infinite-scroll-component");
|
|
632
|
+
if (!o || !c || !l)
|
|
633
633
|
return;
|
|
634
|
-
const
|
|
635
|
-
if (c.offsetHeight <=
|
|
636
|
-
if (
|
|
634
|
+
const r = l.offsetHeight;
|
|
635
|
+
if (c.offsetHeight <= r) {
|
|
636
|
+
if (o.style.height === "100%")
|
|
637
637
|
return;
|
|
638
|
-
|
|
638
|
+
o.style.height = "100%";
|
|
639
639
|
} else {
|
|
640
|
-
if (
|
|
640
|
+
if (o.style.height === "auto")
|
|
641
641
|
return;
|
|
642
|
-
|
|
642
|
+
o.style.height = "auto";
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
});
|
|
@@ -647,49 +647,49 @@ ${e}`);
|
|
|
647
647
|
if (e)
|
|
648
648
|
return;
|
|
649
649
|
const t = () => {
|
|
650
|
-
const l = ((I == null ? void 0 : I.promptVariables) || []).filter((
|
|
650
|
+
const l = ((I == null ? void 0 : I.promptVariables) || []).filter((o) => o.type ? !(o.type === Ie.User && o.key === "query") && !(o.type === Ie.System && o.key === "datetime") && o.status === 1 : o.key !== "query" && o.status === 1).map((o, c) => {
|
|
651
651
|
var b, N;
|
|
652
|
-
let
|
|
653
|
-
return typeof (
|
|
652
|
+
let r = "";
|
|
653
|
+
return typeof (s == null ? void 0 : s.promptVariables) == "object" && (r = ((N = (b = s.promptVariables.default) == null ? void 0 : b.find((D) => D.key === o.key && D.type === o.type)) == null ? void 0 : N.value) || ""), {
|
|
654
654
|
id: c + "",
|
|
655
|
-
key:
|
|
656
|
-
name:
|
|
657
|
-
value:
|
|
658
|
-
type:
|
|
655
|
+
key: o.key,
|
|
656
|
+
name: o.name,
|
|
657
|
+
value: r,
|
|
658
|
+
type: o.type
|
|
659
659
|
};
|
|
660
660
|
});
|
|
661
|
-
de([...l].sort((
|
|
661
|
+
de([...l].sort((o, c) => o.key.localeCompare(c.key)));
|
|
662
662
|
};
|
|
663
663
|
return I != null && I.ready ? t() : I == null || I.addEventListener("ready", t), () => {
|
|
664
664
|
I == null || I.removeEventListener("ready", t);
|
|
665
665
|
};
|
|
666
|
-
}, [e, I,
|
|
666
|
+
}, [e, I, s == null ? void 0 : s.promptVariables]);
|
|
667
667
|
const rt = () => x == null ? void 0 : x({
|
|
668
668
|
netOpen: P ? K.OPEN : K.CLOSE
|
|
669
669
|
}).then((t) => {
|
|
670
670
|
var n, a;
|
|
671
671
|
return p == null || p(t), V(!1), E(!!((n = t.data) != null && n.netOpen)), te(!!((a = t.data) != null && a.enableNetOpen)), we(t), t;
|
|
672
|
-
}), at =
|
|
672
|
+
}), at = Nn(() => {
|
|
673
673
|
var t;
|
|
674
|
-
return
|
|
675
|
-
application:
|
|
674
|
+
return i.arrange && ((t = i.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ d(Et, {
|
|
675
|
+
application: i,
|
|
676
676
|
history: {
|
|
677
677
|
role: 1,
|
|
678
|
-
content:
|
|
678
|
+
content: i.arrange[0].openingContent,
|
|
679
679
|
code: 200,
|
|
680
680
|
messageId: "opening-message",
|
|
681
681
|
sessionId: "",
|
|
682
682
|
reference: [],
|
|
683
683
|
searchReference: [],
|
|
684
|
-
messageTime:
|
|
684
|
+
messageTime: Tt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
|
|
685
685
|
actions: [],
|
|
686
686
|
isLoading: !1
|
|
687
687
|
},
|
|
688
688
|
actions: !!v.length,
|
|
689
|
-
markdown:
|
|
689
|
+
markdown: s == null ? void 0 : s.markdown
|
|
690
690
|
}) : null;
|
|
691
|
-
}, [
|
|
692
|
-
return
|
|
691
|
+
}, [i == null ? void 0 : i.arrange, v]);
|
|
692
|
+
return Ln(h, () => ({
|
|
693
693
|
getCurrentInputText: () => {
|
|
694
694
|
var t;
|
|
695
695
|
return (t = ye.current) == null ? void 0 : t.getCurrentText();
|
|
@@ -697,18 +697,18 @@ ${e}`);
|
|
|
697
697
|
})), L(() => {
|
|
698
698
|
var n;
|
|
699
699
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
700
|
-
t && le((a) =>
|
|
700
|
+
t && le((a) => je(Fe({}, a), {
|
|
701
701
|
[t]: []
|
|
702
702
|
}));
|
|
703
703
|
}, [(lt = e == null ? void 0 : e.data) == null ? void 0 : lt.id]), /* @__PURE__ */ A("div", {
|
|
704
704
|
className: "agent-chat",
|
|
705
|
-
children: [
|
|
705
|
+
children: [en ? /* @__PURE__ */ d("div", {
|
|
706
706
|
className: "session-loading",
|
|
707
|
-
children: /* @__PURE__ */ d(
|
|
708
|
-
}) : /* @__PURE__ */ A(
|
|
709
|
-
children: [(
|
|
707
|
+
children: /* @__PURE__ */ d(It, {})
|
|
708
|
+
}) : /* @__PURE__ */ A(kn, {
|
|
709
|
+
children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ d(Wn, {
|
|
710
710
|
ref: Qe,
|
|
711
|
-
appId:
|
|
711
|
+
appId: i.id,
|
|
712
712
|
currentSession: e,
|
|
713
713
|
promptVariables: R,
|
|
714
714
|
setPromptVariables: de,
|
|
@@ -716,7 +716,7 @@ ${e}`);
|
|
|
716
716
|
}), /* @__PURE__ */ A("div", {
|
|
717
717
|
className: "chat-main",
|
|
718
718
|
id: "chat-main",
|
|
719
|
-
style:
|
|
719
|
+
style: Dt,
|
|
720
720
|
children: [/* @__PURE__ */ d("div", {
|
|
721
721
|
className: "chat-main-wrapper",
|
|
722
722
|
id: "scrollableDiv",
|
|
@@ -727,18 +727,18 @@ ${e}`);
|
|
|
727
727
|
flexDirection: "column-reverse"
|
|
728
728
|
},
|
|
729
729
|
ref: T,
|
|
730
|
-
onScroll:
|
|
731
|
-
children: (dt = e == null ? void 0 : e.data) != null && dt.id && (v != null && v.length) ? /* @__PURE__ */ A(
|
|
730
|
+
onScroll: cn,
|
|
731
|
+
children: (dt = e == null ? void 0 : e.data) != null && dt.id && (v != null && v.length) ? /* @__PURE__ */ A(Qn, {
|
|
732
732
|
dataLength: v.length,
|
|
733
|
-
next:
|
|
733
|
+
next: un,
|
|
734
734
|
style: {
|
|
735
735
|
display: "flex",
|
|
736
736
|
flexDirection: "column-reverse",
|
|
737
737
|
overflowX: "hidden"
|
|
738
738
|
},
|
|
739
739
|
inverse: !0,
|
|
740
|
-
endMessage: v.length >
|
|
741
|
-
((ct = T.current) != null && ct.scrollTop) && ((
|
|
740
|
+
endMessage: v.length > Pt && // 少于一页不展示这个提示
|
|
741
|
+
((ct = T.current) != null && ct.scrollTop) && ((gt = T.current) == null ? void 0 : gt.scrollTop) < -10 ? /* @__PURE__ */ d(Pn, {
|
|
742
742
|
plain: !0,
|
|
743
743
|
children: "没有更多数据了"
|
|
744
744
|
}) : null,
|
|
@@ -749,42 +749,51 @@ ${e}`);
|
|
|
749
749
|
textAlign: "center",
|
|
750
750
|
overflow: "hidden"
|
|
751
751
|
},
|
|
752
|
-
children: /* @__PURE__ */ d(
|
|
752
|
+
children: /* @__PURE__ */ d(It, {})
|
|
753
753
|
}),
|
|
754
754
|
scrollableTarget: "scrollableDiv",
|
|
755
|
-
children: [v.map((t, n) => /* @__PURE__ */ d(
|
|
756
|
-
application:
|
|
755
|
+
children: [v.map((t, n) => /* @__PURE__ */ d(Jn, {
|
|
756
|
+
application: i,
|
|
757
757
|
currentSession: e,
|
|
758
758
|
history: t,
|
|
759
|
-
docViewerUrl:
|
|
759
|
+
docViewerUrl: U,
|
|
760
760
|
isLastHistory: n === 0,
|
|
761
761
|
onRelatedClick: fn,
|
|
762
|
-
onAgainClick:
|
|
763
|
-
onEditClick:
|
|
764
|
-
markdown:
|
|
762
|
+
onAgainClick: mn,
|
|
763
|
+
onEditClick: gn,
|
|
764
|
+
markdown: s == null ? void 0 : s.markdown
|
|
765
765
|
}, t.messageId + n)), !Je && at]
|
|
766
766
|
}) : /* @__PURE__ */ A("div", {
|
|
767
767
|
className: "main-empty",
|
|
768
|
-
children: [(
|
|
769
|
-
text:
|
|
770
|
-
|
|
771
|
-
|
|
768
|
+
children: [(s == null ? void 0 : s.greeting) !== !1 && /* @__PURE__ */ d(Vn, {
|
|
769
|
+
text: (
|
|
770
|
+
// 第一优先级:features配置
|
|
771
|
+
s != null && s.greeting && typeof s.greeting == "object" && s.greeting.text !== void 0 ? s.greeting.text : (
|
|
772
|
+
// 第二优先级:application.arrange[0].greetings
|
|
773
|
+
(ft = i.arrange) != null && ft.length && ((mt = i.arrange[0]) != null && mt.greetings) ? i.arrange[0].greetings : (
|
|
774
|
+
// 第三优先级:默认文本
|
|
775
|
+
Lt.text
|
|
776
|
+
)
|
|
777
|
+
)
|
|
778
|
+
),
|
|
779
|
+
icon: s === void 0 || s.greeting === !0 || ((ut = s.greeting) == null ? void 0 : ut.icon) === void 0 ? Ft || Lt.icon : s.greeting.icon,
|
|
780
|
+
children: !!We.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__ */ d(Mn, {
|
|
772
781
|
ref: Te,
|
|
773
|
-
sid: (
|
|
782
|
+
sid: (ht = e == null ? void 0 : e.data) == null ? void 0 : ht.id,
|
|
774
783
|
isRecommendClearing: Ye,
|
|
775
784
|
data: We,
|
|
776
|
-
layoutBreakpoints: typeof (
|
|
785
|
+
layoutBreakpoints: typeof (s == null ? void 0 : s.greeting) == "object" ? s.greeting.layoutBreakpoints : void 0,
|
|
777
786
|
onItemClick: (t) => {
|
|
778
|
-
var a, l,
|
|
787
|
+
var a, l, o;
|
|
779
788
|
if (ue(t == null ? void 0 : t.question), S(t == null ? void 0 : t.question), Ye)
|
|
780
789
|
return;
|
|
781
790
|
t != null && t.id && J(!0);
|
|
782
791
|
const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
783
|
-
|
|
784
|
-
var c,
|
|
792
|
+
f != null && f.fileUpload ? (o = (l = pe.current) == null ? void 0 : l.clear()) == null || o.then(() => {
|
|
793
|
+
var c, r;
|
|
785
794
|
t != null && t.id && (n ? (c = st(n, t)) == null || c.finally(() => {
|
|
786
795
|
J(!1);
|
|
787
|
-
}) : (J(!1), V(!0), (
|
|
796
|
+
}) : (J(!1), V(!0), (r = rt()) == null || r.then((b) => {
|
|
788
797
|
var N;
|
|
789
798
|
(N = st(b.id, t)) == null || N.finally(() => {
|
|
790
799
|
J(!1);
|
|
@@ -804,24 +813,24 @@ ${e}`);
|
|
|
804
813
|
},
|
|
805
814
|
ghost: !0,
|
|
806
815
|
size: "small",
|
|
807
|
-
icon: /* @__PURE__ */ d(
|
|
816
|
+
icon: /* @__PURE__ */ d(fe, {
|
|
808
817
|
type: "icon-zantinghuida",
|
|
809
818
|
style: {
|
|
810
819
|
fontSize: 16
|
|
811
820
|
}
|
|
812
821
|
}),
|
|
813
|
-
onClick: () =>
|
|
822
|
+
onClick: () => ln(),
|
|
814
823
|
children: "停止回答"
|
|
815
824
|
})
|
|
816
825
|
}), Xe && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ d("div", {
|
|
817
826
|
className: "back-bottom",
|
|
818
827
|
children: /* @__PURE__ */ d(G, {
|
|
819
828
|
size: "small",
|
|
820
|
-
onClick: () =>
|
|
829
|
+
onClick: () => dn({
|
|
821
830
|
behavior: "smooth"
|
|
822
831
|
}),
|
|
823
832
|
type: "link",
|
|
824
|
-
icon: /* @__PURE__ */ d(
|
|
833
|
+
icon: /* @__PURE__ */ d(fe, {
|
|
825
834
|
type: "icon-yijianhuidaodibu",
|
|
826
835
|
style: {
|
|
827
836
|
fontSize: 24
|
|
@@ -835,10 +844,10 @@ ${e}`);
|
|
|
835
844
|
className: "chat-footer-input",
|
|
836
845
|
children: [se && /* @__PURE__ */ d("div", {
|
|
837
846
|
className: "input-files",
|
|
838
|
-
children: /* @__PURE__ */ d(
|
|
847
|
+
children: /* @__PURE__ */ d(Fn, {
|
|
839
848
|
file: se,
|
|
840
849
|
actions: {
|
|
841
|
-
upload:
|
|
850
|
+
upload: an,
|
|
842
851
|
remove: () => {
|
|
843
852
|
ae(""), Z(void 0);
|
|
844
853
|
}
|
|
@@ -849,11 +858,11 @@ ${e}`);
|
|
|
849
858
|
className: "footer-upload-action",
|
|
850
859
|
onClick: (t) => t.preventDefault(),
|
|
851
860
|
children: [/* @__PURE__ */ A(Ce, {
|
|
852
|
-
children: [(
|
|
861
|
+
children: [(i.type === oe.Agent && (f == null ? void 0 : f.imageUpload) || i.type === oe.Dialog && ((yt = i.arrange) == null ? void 0 : yt.length) && !!i.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && /* @__PURE__ */ d(En, {
|
|
853
862
|
disabled: !!se || H,
|
|
854
863
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
855
864
|
listType: "picture-card",
|
|
856
|
-
beforeUpload:
|
|
865
|
+
beforeUpload: rn,
|
|
857
866
|
className: "footer-upload-picture",
|
|
858
867
|
showUploadList: !1,
|
|
859
868
|
children: se ? /* @__PURE__ */ d(G, {
|
|
@@ -865,13 +874,13 @@ ${e}`);
|
|
|
865
874
|
bottom: "-2px"
|
|
866
875
|
},
|
|
867
876
|
disabled: !!se || H,
|
|
868
|
-
icon: /* @__PURE__ */ d(
|
|
877
|
+
icon: /* @__PURE__ */ d(An, {
|
|
869
878
|
className: "icon-tianjia",
|
|
870
879
|
style: {
|
|
871
880
|
fontSize: "22px"
|
|
872
881
|
}
|
|
873
882
|
})
|
|
874
|
-
}) : /* @__PURE__ */ d(
|
|
883
|
+
}) : /* @__PURE__ */ d(Tn, {
|
|
875
884
|
placement: "topLeft",
|
|
876
885
|
overlayClassName: "footer-upload-tooltip",
|
|
877
886
|
title: /* @__PURE__ */ d("div", {
|
|
@@ -885,7 +894,7 @@ ${e}`);
|
|
|
885
894
|
position: "relative",
|
|
886
895
|
bottom: "-2px"
|
|
887
896
|
},
|
|
888
|
-
icon: /* @__PURE__ */ d(
|
|
897
|
+
icon: /* @__PURE__ */ d(fe, {
|
|
889
898
|
type: "icon-Vector",
|
|
890
899
|
className: "icon-tianjia",
|
|
891
900
|
style: {
|
|
@@ -894,11 +903,11 @@ ${e}`);
|
|
|
894
903
|
})
|
|
895
904
|
})
|
|
896
905
|
})
|
|
897
|
-
}), X && (
|
|
898
|
-
appId:
|
|
906
|
+
}), X && (f != null && f.fileUpload) && (i != null && i.id) ? /* @__PURE__ */ d(qn, {
|
|
907
|
+
appId: i == null ? void 0 : i.id,
|
|
899
908
|
ref: pe,
|
|
900
909
|
isFirstSession: Ze,
|
|
901
|
-
docViewerUrl:
|
|
910
|
+
docViewerUrl: U,
|
|
902
911
|
onStatusChange: (t) => z(void 0, null, function* () {
|
|
903
912
|
t !== "process" ? (ve(!0), Re()) : ve(!1);
|
|
904
913
|
}),
|
|
@@ -906,13 +915,13 @@ ${e}`);
|
|
|
906
915
|
V(!0), x == null || x({
|
|
907
916
|
netOpen: P ? K.OPEN : K.CLOSE
|
|
908
917
|
}).then((n) => {
|
|
909
|
-
var l,
|
|
910
|
-
p == null || p(n), V(!1), E(!!((l = n.data) != null && l.netOpen)), te(!!((
|
|
918
|
+
var l, o, c;
|
|
919
|
+
p == null || p(n), V(!1), E(!!((l = n.data) != null && l.netOpen)), te(!!((o = n.data) != null && o.enableNetOpen)), we(n);
|
|
911
920
|
const a = ((c = n.data) == null ? void 0 : c.id) || "";
|
|
912
921
|
t(a);
|
|
913
922
|
});
|
|
914
923
|
}),
|
|
915
|
-
sid: (
|
|
924
|
+
sid: (pt = e == null ? void 0 : e.data) == null ? void 0 : pt.id,
|
|
916
925
|
disabled: Oe || H,
|
|
917
926
|
afterFileAdd: (t, n) => {
|
|
918
927
|
n && le((a) => {
|
|
@@ -926,16 +935,16 @@ ${e}`);
|
|
|
926
935
|
var a;
|
|
927
936
|
const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
928
937
|
n && le((l) => {
|
|
929
|
-
const
|
|
938
|
+
const o = l[n] || [];
|
|
930
939
|
return {
|
|
931
|
-
[n]:
|
|
940
|
+
[n]: o.filter((c) => c.id !== t)
|
|
932
941
|
};
|
|
933
942
|
});
|
|
934
943
|
},
|
|
935
944
|
onFileListChange: (t) => {
|
|
936
|
-
|
|
945
|
+
Kt(t);
|
|
937
946
|
},
|
|
938
|
-
shouldContinue:
|
|
947
|
+
shouldContinue: _t,
|
|
939
948
|
afterFilesClear: () => {
|
|
940
949
|
var n;
|
|
941
950
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
@@ -943,33 +952,33 @@ ${e}`);
|
|
|
943
952
|
[t]: []
|
|
944
953
|
}), Re());
|
|
945
954
|
}
|
|
946
|
-
}) : null, (
|
|
947
|
-
appId:
|
|
955
|
+
}) : null, (f == null ? void 0 : f.prompt) && (i == null ? void 0 : i.id) && /* @__PURE__ */ d(Gn, {
|
|
956
|
+
appId: i.id,
|
|
948
957
|
list: [],
|
|
949
|
-
search: Ke ?
|
|
958
|
+
search: Ke ? $t : "",
|
|
950
959
|
onPromptSelect: (t) => {
|
|
951
960
|
S(t.context), ue(t.context);
|
|
952
961
|
},
|
|
953
962
|
disabled: H
|
|
954
963
|
})]
|
|
955
964
|
}), /* @__PURE__ */ A(Ce, {
|
|
956
|
-
children: [(
|
|
957
|
-
sessionId: (
|
|
965
|
+
children: [(f == null ? void 0 : f.connectNetwork) && i.type === oe.Dialog && ((vt = i.arrange) == null ? void 0 : vt.length) && !!i.arrange[0].enableNetOpen && /* @__PURE__ */ d(_n, {
|
|
966
|
+
sessionId: (bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id,
|
|
958
967
|
netStatus: P,
|
|
959
|
-
enable: typeof (
|
|
968
|
+
enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) : St,
|
|
960
969
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
961
970
|
onNetStatusChange: (t) => {
|
|
962
|
-
|
|
971
|
+
hn(t);
|
|
963
972
|
}
|
|
964
|
-
}), (
|
|
965
|
-
currentSessionId: (
|
|
973
|
+
}), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ d(Yn, {
|
|
974
|
+
currentSessionId: (xt = e == null ? void 0 : e.data) == null ? void 0 : xt.id,
|
|
966
975
|
onSessionChange: (t, n) => {
|
|
967
976
|
S(void 0), ke(!0), p == null || p(n);
|
|
968
977
|
},
|
|
969
978
|
disabled: H
|
|
970
|
-
}),
|
|
979
|
+
}), jt && Ut === "float" && /* @__PURE__ */ d("div", {
|
|
971
980
|
className: "session-history-drawer-component",
|
|
972
|
-
children: /* @__PURE__ */ d(
|
|
981
|
+
children: /* @__PURE__ */ d(On, {
|
|
973
982
|
placement: "topRight",
|
|
974
983
|
showArrow: !1,
|
|
975
984
|
overlayClassName: "session-history-overlay",
|
|
@@ -982,7 +991,7 @@ ${e}`);
|
|
|
982
991
|
className: "history-overlay-action",
|
|
983
992
|
disabled: H,
|
|
984
993
|
type: "text",
|
|
985
|
-
icon: /* @__PURE__ */ d(
|
|
994
|
+
icon: /* @__PURE__ */ d(fe, {
|
|
986
995
|
type: "icon-lishijilu",
|
|
987
996
|
style: {
|
|
988
997
|
fontSize: 24
|
|
@@ -991,8 +1000,8 @@ ${e}`);
|
|
|
991
1000
|
onClick: () => tt(!0)
|
|
992
1001
|
})
|
|
993
1002
|
})
|
|
994
|
-
}), (
|
|
995
|
-
icon: /* @__PURE__ */ d(
|
|
1003
|
+
}), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ d(G, {
|
|
1004
|
+
icon: /* @__PURE__ */ d($n, {}),
|
|
996
1005
|
className: "add-btn",
|
|
997
1006
|
type: "primary",
|
|
998
1007
|
disabled: Ge || !e || !v.length || H,
|
|
@@ -1007,8 +1016,8 @@ ${e}`);
|
|
|
1007
1016
|
className: "footer-textarea",
|
|
1008
1017
|
children: /* @__PURE__ */ d(Un, {
|
|
1009
1018
|
ref: ye,
|
|
1010
|
-
maxLength:
|
|
1011
|
-
text:
|
|
1019
|
+
maxLength: Mt,
|
|
1020
|
+
text: Bt,
|
|
1012
1021
|
networkStatus: !1,
|
|
1013
1022
|
loading: Se || xe,
|
|
1014
1023
|
disabled: $e || Be || H || Se || xe,
|
|
@@ -1016,7 +1025,7 @@ ${e}`);
|
|
|
1016
1025
|
onChange: (t, n) => {
|
|
1017
1026
|
S(t);
|
|
1018
1027
|
const a = n.getText().replace(/[\n\s]+$/, "");
|
|
1019
|
-
ue(a),
|
|
1028
|
+
ue(a), qt(a), Ke || At(!0);
|
|
1020
1029
|
},
|
|
1021
1030
|
clearAction: /* @__PURE__ */ d(Ce, {
|
|
1022
1031
|
size: 0,
|
|
@@ -1024,31 +1033,31 @@ ${e}`);
|
|
|
1024
1033
|
type: "link",
|
|
1025
1034
|
disabled: Oe || H,
|
|
1026
1035
|
ghost: !0,
|
|
1027
|
-
icon: /* @__PURE__ */ d(
|
|
1036
|
+
icon: /* @__PURE__ */ d(fe, {
|
|
1028
1037
|
style: {
|
|
1029
1038
|
fontSize: 22
|
|
1030
1039
|
},
|
|
1031
1040
|
type: "icon-qingchujiyi"
|
|
1032
1041
|
}),
|
|
1033
|
-
onClick: () =>
|
|
1042
|
+
onClick: () => on()
|
|
1034
1043
|
})
|
|
1035
1044
|
})
|
|
1036
1045
|
})
|
|
1037
1046
|
})]
|
|
1038
1047
|
})
|
|
1039
|
-
}), /* @__PURE__ */ d(
|
|
1040
|
-
tips:
|
|
1041
|
-
}), _e && /* @__PURE__ */ d(
|
|
1048
|
+
}), /* @__PURE__ */ d(zn, {
|
|
1049
|
+
tips: Rt
|
|
1050
|
+
}), _e && /* @__PURE__ */ d(Bn, {
|
|
1042
1051
|
isvisible: _e,
|
|
1043
|
-
files:
|
|
1044
|
-
sessionId: (
|
|
1052
|
+
files: Yt,
|
|
1053
|
+
sessionId: (kt = e == null ? void 0 : e.data) == null ? void 0 : kt.id,
|
|
1045
1054
|
onClose: (t) => {
|
|
1046
|
-
|
|
1055
|
+
Wt(!1), Gt(!1);
|
|
1047
1056
|
}
|
|
1048
1057
|
})]
|
|
1049
|
-
}), et && /* @__PURE__ */ d(
|
|
1058
|
+
}), et && /* @__PURE__ */ d(Kn, {
|
|
1050
1059
|
currentSession: e,
|
|
1051
|
-
application:
|
|
1060
|
+
application: i,
|
|
1052
1061
|
networkStatus: P,
|
|
1053
1062
|
setCurrentSession: p,
|
|
1054
1063
|
disabled: H,
|
|
@@ -1061,5 +1070,5 @@ ${e}`);
|
|
|
1061
1070
|
});
|
|
1062
1071
|
});
|
|
1063
1072
|
export {
|
|
1064
|
-
|
|
1073
|
+
Oi as default
|
|
1065
1074
|
};
|