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