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