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