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