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