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