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