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