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