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