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