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