@glodon-aiot/agent-cli-ui 3.11.0 → 3.11.1-alpha.1765331460
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionRefer/ReferItem/index.mjs +28 -28
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs +10 -10
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionRelated/index.mjs +2 -2
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +133 -118
- package/dist/es/Dialog/AgentChat/index.mjs +600 -569
- package/dist/es/Dialog/SessionList/index.mjs +271 -218
- package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +53 -53
- package/dist/es/components/FilePreview/index.mjs +6 -6
- package/dist/es/components/Iconfont/index.mjs +3 -3
- package/dist/es/packages/agent-cli-ui/package.json.mjs +11 -11
- package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/components/Markdown/Code/index.mjs +8 -8
- package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/components/Markdown/Image/index.mjs +3 -3
- package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/components/Markdown/index.mjs +24 -25
- package/dist/es/packages/react-components/dist/es/index.mjs +10 -0
- package/dist/es/src/style10.css +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style19.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style22.css +1 -1
- package/dist/es/src/style23.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style29.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style32.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +69 -68
- package/package.json +3 -3
- package/dist/es/node_modules/@glodon-aiot/react-components/dist/es/index.mjs +0 -10
- package/dist/es/node_modules/hast-util-from-parse5/lib/index.mjs +0 -162
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/index.mjs +0 -12
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/aria.mjs +0 -61
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/find.mjs +0 -33
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/html.mjs +0 -368
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/normalize.mjs +0 -6
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/svg.mjs +0 -566
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/case-insensitive-transform.mjs +0 -7
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/case-sensitive-transform.mjs +0 -6
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/create.mjs +0 -14
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/defined-info.mjs +0 -36
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/info.mjs +0 -28
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/merge.mjs +0 -10
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/schema.mjs +0 -21
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/types.mjs +0 -15
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xlink.mjs +0 -19
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xml.mjs +0 -15
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xmlns.mjs +0 -16
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/vfile-location/lib/index.mjs +0 -47
- package/dist/es/node_modules/hast-util-from-parse5/node_modules/web-namespaces/index.mjs +0 -11
- package/dist/es/node_modules/rehype-raw/lib/index.mjs +0 -26
- package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/decode-codepoint.mjs +0 -38
- package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/decode.mjs +0 -251
- package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/generated/decode-data-html.mjs +0 -7
- package/dist/es/node_modules/rehype-raw/node_modules/hast-util-raw/lib/index.mjs +0 -249
- package/dist/es/node_modules/rehype-raw/node_modules/hast-util-to-parse5/lib/index.mjs +0 -125
- package/dist/es/node_modules/rehype-raw/node_modules/html-void-elements/index.mjs +0 -4
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/doctype.mjs +0 -34
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/error-codes.mjs +0 -7
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/foreign-content.mjs +0 -103
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/html.mjs +0 -44
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/token.mjs +0 -14
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/unicode.mjs +0 -38
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/formatting-element-list.mjs +0 -91
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/index.mjs +0 -2308
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/open-element-stack.mjs +0 -220
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/serializer/index.mjs +0 -2
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tokenizer/index.mjs +0 -1948
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tokenizer/preprocessor.mjs +0 -92
- package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tree-adapters/default.mjs +0 -173
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/index.mjs +0 -12
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/aria.mjs +0 -61
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/find.mjs +0 -33
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/html.mjs +0 -368
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/normalize.mjs +0 -6
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/svg.mjs +0 -566
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/case-insensitive-transform.mjs +0 -7
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/case-sensitive-transform.mjs +0 -6
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/create.mjs +0 -17
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/defined-info.mjs +0 -27
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/info.mjs +0 -23
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/merge.mjs +0 -11
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/schema.mjs +0 -17
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/types.mjs +0 -15
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xlink.mjs +0 -19
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xml.mjs +0 -15
- package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xmlns.mjs +0 -16
- package/dist/es/node_modules/rehype-raw/node_modules/unist-util-visit/lib/index.mjs +0 -16
- package/dist/es/node_modules/rehype-raw/node_modules/web-namespaces/index.mjs +0 -11
- package/dist/es/node_modules/zwitch/index.mjs +0 -18
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +0 -44
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +0 -1
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +0 -36
- package/dist/src/utils/reactCompatibility.d.ts +0 -27
- package/dist/src/utils/testAntdPrefix.d.ts +0 -3
- /package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/Iconfont/index.mjs +0 -0
- /package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/components/Copy/index.mjs +0 -0
- /package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/components/Markdown/ATag/index.mjs +0 -0
- /package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/components/Markdown/Video/index.mjs +0 -0
- /package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/utils/clipboard.mjs +0 -0
- /package/dist/es/{node_modules/@glodon-aiot → packages}/react-components/dist/es/utils/markdown/index.mjs +0 -0
|
@@ -1,265 +1,307 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
for (var
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var
|
|
9
|
-
|
|
10
|
-
return
|
|
1
|
+
var De = Object.defineProperty;
|
|
2
|
+
var pe = Object.getOwnPropertySymbols;
|
|
3
|
+
var Ie = Object.prototype.hasOwnProperty, Re = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var ue = (N, g, a) => g in N ? De(N, g, { enumerable: !0, configurable: !0, writable: !0, value: a }) : N[g] = a, ye = (N, g) => {
|
|
5
|
+
for (var a in g || (g = {}))
|
|
6
|
+
Ie.call(g, a) && ue(N, a, g[a]);
|
|
7
|
+
if (pe)
|
|
8
|
+
for (var a of pe(g))
|
|
9
|
+
Re.call(g, a) && ue(N, a, g[a]);
|
|
10
|
+
return N;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var L = (N, g, a) => new Promise((r, O) => {
|
|
13
|
+
var b = (E) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
15
|
+
M(a.next(E));
|
|
16
|
+
} catch (x) {
|
|
17
|
+
O(x);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, ee = (E) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
|
|
21
|
+
M(a.throw(E));
|
|
22
|
+
} catch (x) {
|
|
23
|
+
O(x);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, M = (E) => E.done ? r(E.value) : Promise.resolve(E.value).then(b, ee);
|
|
26
|
+
M((a = a.apply(N, g)).next());
|
|
27
27
|
});
|
|
28
|
-
import { jsx as
|
|
29
|
-
import { forwardRef as
|
|
30
|
-
import { Button as
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
/* empty css */import { useMemoizedFn as
|
|
36
|
-
import { MAX_KNOWLEDGES_AND_FILES_COUNT as
|
|
37
|
-
import { useSessionState as
|
|
38
|
-
import { calcKnowledgesLeafCount as
|
|
39
|
-
const
|
|
28
|
+
import { jsx as f, jsxs as T } from "react/jsx-runtime";
|
|
29
|
+
import { forwardRef as Se, useState as k, useContext as Ye, useRef as V, useEffect as D, useImperativeHandle as $e, useMemo as He } from "react";
|
|
30
|
+
import { Button as Ve, Typography as Fe, Space as ge, Popconfirm as ve, Input as Ke, Divider as ze, notification as J } from "antd";
|
|
31
|
+
import p from "dayjs";
|
|
32
|
+
import Be from "classnames";
|
|
33
|
+
import Ae from "../../components/Iconfont/index.mjs";
|
|
34
|
+
import Ge from "../../context.mjs";
|
|
35
|
+
/* empty css */import { useMemoizedFn as Ne } from "ahooks";
|
|
36
|
+
import { MAX_KNOWLEDGES_AND_FILES_COUNT as F, NET_OPEN_STATUS as Ee } from "../../constant.mjs";
|
|
37
|
+
import { useSessionState as Ue } from "../../hooks/useSessionState.mjs";
|
|
38
|
+
import { calcKnowledgesLeafCount as we } from "../../utils/index.mjs";
|
|
39
|
+
const Q = 15, Xe = Se((N, g) => {
|
|
40
40
|
const {
|
|
41
|
-
currentSession:
|
|
42
|
-
setCurrentSession:
|
|
43
|
-
checkKnowledges:
|
|
44
|
-
application:
|
|
45
|
-
networkStatus:
|
|
46
|
-
isShowHeader:
|
|
47
|
-
afterSessionClick:
|
|
48
|
-
sessionId:
|
|
49
|
-
} =
|
|
41
|
+
currentSession: a,
|
|
42
|
+
setCurrentSession: r,
|
|
43
|
+
checkKnowledges: O,
|
|
44
|
+
application: b,
|
|
45
|
+
networkStatus: ee,
|
|
46
|
+
isShowHeader: M = !0,
|
|
47
|
+
afterSessionClick: E,
|
|
48
|
+
sessionId: x
|
|
49
|
+
} = N, [K, z] = k(), {
|
|
50
50
|
agentClient: u,
|
|
51
|
-
mode:
|
|
51
|
+
mode: te,
|
|
52
52
|
features: o,
|
|
53
|
-
popupContainer:
|
|
54
|
-
} =
|
|
55
|
-
sessions:
|
|
56
|
-
setSessions:
|
|
57
|
-
} =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
popupContainer: B
|
|
54
|
+
} = Ye(Ge), [ae, oe] = k(O), {
|
|
55
|
+
sessions: _,
|
|
56
|
+
setSessions: P
|
|
57
|
+
} = Ue(), [ne, G] = k(0), [be, I] = k(""), [ke, de] = k(null), j = 30, [U, R] = k(!1), [S, Y] = k(!0), [Oe, $] = k(!1), H = V(void 0), C = V(0), X = V(null), W = V(null), re = (e) => {
|
|
58
|
+
var n, s;
|
|
59
|
+
if (!(e != null && e.length))
|
|
60
|
+
return;
|
|
61
|
+
let t = (s = (n = e[0]) == null ? void 0 : n.data) == null ? void 0 : s.createdAt;
|
|
62
|
+
return e.forEach((d) => {
|
|
63
|
+
var l, m, h, y;
|
|
64
|
+
t ? (m = d.data) != null && m.createdAt && p((h = d.data) == null ? void 0 : h.createdAt).valueOf() < p(t).valueOf() && (t = (y = d.data) == null ? void 0 : y.createdAt) : t = (l = d.data) == null ? void 0 : l.createdAt;
|
|
65
|
+
}), t;
|
|
66
|
+
}, ie = Ne((e) => {
|
|
67
|
+
e.id && P((t) => [...t.map((d) => {
|
|
68
|
+
var l;
|
|
69
|
+
return ((l = d.data) == null ? void 0 : l.id) === e.id && (d.data = ye({}, e)), d;
|
|
70
|
+
})].sort((d, l) => {
|
|
71
|
+
var y, w;
|
|
72
|
+
const m = p((y = d.data) == null ? void 0 : y.createdAt).valueOf();
|
|
73
|
+
return p((w = l.data) == null ? void 0 : w.createdAt).valueOf() - m;
|
|
65
74
|
}));
|
|
66
75
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
D(() => {
|
|
77
|
+
if (te === "float") {
|
|
78
|
+
a === void 0 && !x && (r == null || r(null));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
R(!0), H.current = void 0, C.current = 0, u == null || u.getSessions({
|
|
82
|
+
pageSize: j
|
|
83
|
+
}).then((e) => L(void 0, null, function* () {
|
|
84
|
+
var t;
|
|
85
|
+
if (P([...e]), C.current = e.length, H.current = re(e), Y(e.length >= j), $(e.length < j), !((t = a == null ? void 0 : a.data) != null && t.id) && (e != null && e.length) && te === "inlay") {
|
|
86
|
+
const n = e[0];
|
|
87
|
+
x || r == null || r(n);
|
|
73
88
|
} else
|
|
74
|
-
|
|
75
|
-
}));
|
|
76
|
-
}, []),
|
|
77
|
-
var
|
|
78
|
-
if (!((
|
|
79
|
-
const
|
|
80
|
-
if (Array.isArray(
|
|
89
|
+
a === void 0 && (x || r == null || r(null));
|
|
90
|
+
})).finally(() => R(!1));
|
|
91
|
+
}, []), D(() => {
|
|
92
|
+
var e;
|
|
93
|
+
if (!((e = a == null ? void 0 : a.data) != null && e.id) && O === void 0) {
|
|
94
|
+
const t = typeof (o == null ? void 0 : o.knowledges) == "object" && o.knowledges.default || void 0;
|
|
95
|
+
if (Array.isArray(t) && t.some((d) => Array.isArray(d.fileIds) && d.fileIds.length === 0))
|
|
81
96
|
throw Error("fileIds cannot be an empty array");
|
|
82
|
-
if (
|
|
83
|
-
throw Error(`knowledges and fileIds total count cannot exceed ${
|
|
84
|
-
|
|
97
|
+
if (we(t || []) > F)
|
|
98
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${F}`);
|
|
99
|
+
oe(t);
|
|
85
100
|
return;
|
|
86
101
|
}
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
|
|
90
|
-
}, [
|
|
91
|
-
create(
|
|
92
|
-
return
|
|
102
|
+
oe(O);
|
|
103
|
+
}, [O]), D(() => {
|
|
104
|
+
a == null || a.addEventListener("data:updated", ie);
|
|
105
|
+
}, [a]), $e(g, () => ({
|
|
106
|
+
create(e) {
|
|
107
|
+
return le(e).then((t) => (r == null || r(t), t));
|
|
93
108
|
},
|
|
94
|
-
list: () => Promise.resolve(
|
|
109
|
+
list: () => Promise.resolve(_)
|
|
95
110
|
}));
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
return new Promise((n) =>
|
|
111
|
+
const le = (e) => {
|
|
112
|
+
const t = typeof (o == null ? void 0 : o.connectNetwork) == "object" && typeof (o == null ? void 0 : o.connectNetwork.default) == "boolean" ? o.connectNetwork.default : !1;
|
|
113
|
+
return new Promise((n) => L(void 0, null, function* () {
|
|
99
114
|
var m;
|
|
100
|
-
const
|
|
101
|
-
name:
|
|
115
|
+
const s = typeof (o == null ? void 0 : o.promptVariables) == "object" ? (o == null ? void 0 : o.promptVariables.default) || [] : void 0, d = yield u == null ? void 0 : u.loadSession("", {
|
|
116
|
+
name: e == null ? void 0 : e.name,
|
|
102
117
|
// @ts-ignore netOpen入参是number 响应是boolen
|
|
103
118
|
// 只有对话有联网 其它没有
|
|
104
119
|
// 不传netOpen会默认取defaultNetOpen
|
|
105
|
-
netOpen: (
|
|
106
|
-
knowledges: (m =
|
|
107
|
-
promptVariables:
|
|
108
|
-
}),
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
getContainer: () => (
|
|
120
|
+
netOpen: (b == null ? void 0 : b.type) === 0 ? e != null && e.netOpen ? e.netOpen : t ? Ee.OPEN : Ee.CLOSE : void 0,
|
|
121
|
+
knowledges: (m = a == null ? void 0 : a.data) != null && m.id ? e == null ? void 0 : e.knowledges : ae,
|
|
122
|
+
promptVariables: s
|
|
123
|
+
}), l = (h) => {
|
|
124
|
+
var y;
|
|
125
|
+
J.config({
|
|
126
|
+
getContainer: () => (B == null ? void 0 : B.current) || document.body,
|
|
112
127
|
prefixCls: "gbot-notification"
|
|
113
|
-
}),
|
|
114
|
-
message: ((
|
|
115
|
-
}),
|
|
128
|
+
}), J.error({
|
|
129
|
+
message: ((y = h.cause) == null ? void 0 : y.message) || h.message
|
|
130
|
+
}), J.config({
|
|
116
131
|
getContainer: void 0,
|
|
117
132
|
prefixCls: "gbot-notification"
|
|
118
133
|
});
|
|
119
134
|
};
|
|
120
|
-
d == null || d.addEventListener("error",
|
|
121
|
-
d == null || d.removeEventListener("error",
|
|
135
|
+
d == null || d.addEventListener("error", l), d == null || d.addEventListener("data:created", () => L(void 0, null, function* () {
|
|
136
|
+
d == null || d.removeEventListener("error", l), P([d, ..._]), n(d);
|
|
122
137
|
}));
|
|
123
138
|
}));
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
knowledges:
|
|
127
|
-
}).then((
|
|
128
|
-
|
|
139
|
+
}, Me = () => {
|
|
140
|
+
le({
|
|
141
|
+
knowledges: ae
|
|
142
|
+
}).then((e) => {
|
|
143
|
+
r == null || r(e);
|
|
129
144
|
});
|
|
130
|
-
},
|
|
131
|
-
u == null || u.removeSession(
|
|
132
|
-
var n,
|
|
133
|
-
const
|
|
134
|
-
var
|
|
135
|
-
return ((
|
|
145
|
+
}, xe = (e) => {
|
|
146
|
+
u == null || u.removeSession(e, !0).then(() => L(void 0, null, function* () {
|
|
147
|
+
var n, s;
|
|
148
|
+
const t = _.filter((d) => {
|
|
149
|
+
var l, m;
|
|
150
|
+
return ((l = d.data) == null ? void 0 : l.id) !== ((m = e.data) == null ? void 0 : m.id);
|
|
136
151
|
});
|
|
137
|
-
((n =
|
|
152
|
+
((n = e.data) == null ? void 0 : n.id) === ((s = a == null ? void 0 : a.data) == null ? void 0 : s.id) && (t != null && t.length ? r == null || r(t[0]) : r == null || r(null)), P([...t]);
|
|
138
153
|
}));
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
154
|
+
}, Le = () => L(void 0, null, function* () {
|
|
155
|
+
if (!(U || !S)) {
|
|
156
|
+
R(!0);
|
|
157
|
+
try {
|
|
158
|
+
const e = yield u == null ? void 0 : u.getSessions({
|
|
159
|
+
pageSize: j,
|
|
160
|
+
beforeTime: H.current
|
|
161
|
+
}), t = (e == null ? void 0 : e.length) || 0, n = t - C.current;
|
|
162
|
+
P([...e || []]), H.current = re(e || []), n <= 0 ? (Y(!1), $(!0)) : n < j ? (Y(!1), $(!0), C.current = t) : (Y(!0), $(!1), C.current = t);
|
|
163
|
+
} finally {
|
|
164
|
+
R(!1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
D(() => {
|
|
169
|
+
if (!X.current || !W.current)
|
|
170
|
+
return;
|
|
171
|
+
const e = X.current, t = W.current, n = new IntersectionObserver((s) => {
|
|
172
|
+
s[0].isIntersecting && S && !U && Le();
|
|
173
|
+
}, {
|
|
174
|
+
root: e,
|
|
175
|
+
rootMargin: "0px 0px 200px 0px",
|
|
176
|
+
threshold: 0
|
|
177
|
+
});
|
|
178
|
+
return n.observe(t), () => n.disconnect();
|
|
179
|
+
}, [S, U]);
|
|
180
|
+
const Te = (e) => {
|
|
181
|
+
var t, n;
|
|
182
|
+
z((t = e.data) == null ? void 0 : t.name), I(""), de(((n = e.data) == null ? void 0 : n.id) || null);
|
|
183
|
+
}, _e = (e) => {
|
|
184
|
+
const t = se(K || "");
|
|
185
|
+
if (t) {
|
|
186
|
+
I(t);
|
|
146
187
|
return;
|
|
147
188
|
}
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
}),
|
|
156
|
-
const
|
|
157
|
-
|
|
189
|
+
e.rename(K.trim()), e == null || e.addEventListener("data:updated", ie), ce();
|
|
190
|
+
}, Pe = () => {
|
|
191
|
+
ce();
|
|
192
|
+
}, ce = () => {
|
|
193
|
+
de(null), z(""), I(""), G((e) => e + 1);
|
|
194
|
+
}, se = (e) => !e || e.trim().length === 0 ? "会话名称不能为空" : e.length > Q ? `不能超过${Q}个字符` : "", je = (e) => L(void 0, null, function* () {
|
|
195
|
+
r == null || r(e), E == null || E(e);
|
|
196
|
+
}), Ce = (e) => {
|
|
197
|
+
const t = e.target.value;
|
|
198
|
+
z(t), I(se(t));
|
|
158
199
|
};
|
|
159
|
-
|
|
160
|
-
var
|
|
161
|
-
if (!(
|
|
200
|
+
D(() => {
|
|
201
|
+
var t, n, s, d;
|
|
202
|
+
if (!(a != null && a.id))
|
|
162
203
|
return;
|
|
163
|
-
const
|
|
164
|
-
if (typeof (o == null ? void 0 : o.knowledges) == "object" && ((
|
|
165
|
-
if (
|
|
204
|
+
const e = {};
|
|
205
|
+
if (typeof (o == null ? void 0 : o.knowledges) == "object" && ((t = o == null ? void 0 : o.knowledges) != null && t.default)) {
|
|
206
|
+
if (e.knowledges = (n = o == null ? void 0 : o.knowledges) == null ? void 0 : n.default, Array.isArray(e.knowledges) && e.knowledges.some((h) => Array.isArray(h.fileIds) && h.fileIds.length === 0))
|
|
166
207
|
throw Error("fileIds cannot be an empty array");
|
|
167
|
-
if (
|
|
168
|
-
throw Error(`knowledges and fileIds total count cannot exceed ${
|
|
208
|
+
if (we(e.knowledges) > F)
|
|
209
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${F}`);
|
|
169
210
|
}
|
|
170
|
-
typeof (o == null ? void 0 : o.promptVariables) == "object" && ((
|
|
171
|
-
}, [
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
return
|
|
175
|
-
var
|
|
176
|
-
const i =
|
|
211
|
+
typeof (o == null ? void 0 : o.promptVariables) == "object" && ((s = o == null ? void 0 : o.promptVariables) != null && s.default) && (e.promptVariables = (d = o == null ? void 0 : o.promptVariables) == null ? void 0 : d.default), u == null || u.loadSession(a.id, e);
|
|
212
|
+
}, [a]);
|
|
213
|
+
const fe = Ne((e) => {
|
|
214
|
+
const t = p().endOf("day"), n = t.subtract(1, "day"), s = t.subtract(7, "day"), d = t.subtract(30, "day"), l = [], m = [], h = [], y = [], w = {};
|
|
215
|
+
return e.forEach((c) => {
|
|
216
|
+
var A;
|
|
217
|
+
const i = p((A = c.data) == null ? void 0 : A.createdAt);
|
|
177
218
|
if (i.isAfter(n))
|
|
178
|
-
m.push(
|
|
179
|
-
else if (i.isAfter(
|
|
180
|
-
|
|
219
|
+
m.push(c);
|
|
220
|
+
else if (i.isAfter(s))
|
|
221
|
+
h.push(c);
|
|
181
222
|
else if (i.isAfter(d))
|
|
182
|
-
|
|
223
|
+
y.push(c);
|
|
183
224
|
else {
|
|
184
|
-
const
|
|
185
|
-
|
|
225
|
+
const v = i.format("YYYY-MM");
|
|
226
|
+
w[v] || (w[v] = []), w[v].push(c);
|
|
186
227
|
}
|
|
187
|
-
}), m.length > 0 &&
|
|
228
|
+
}), m.length > 0 && l.push({
|
|
188
229
|
title: "今天",
|
|
189
|
-
sessions: m.sort((
|
|
190
|
-
var
|
|
191
|
-
return
|
|
230
|
+
sessions: m.sort((c, i) => {
|
|
231
|
+
var A, v;
|
|
232
|
+
return p((A = i.data) == null ? void 0 : A.createdAt).valueOf() - p((v = c.data) == null ? void 0 : v.createdAt).valueOf();
|
|
192
233
|
}),
|
|
193
234
|
key: "today"
|
|
194
|
-
}),
|
|
235
|
+
}), h.length > 0 && l.push({
|
|
195
236
|
title: "7天内",
|
|
196
|
-
sessions:
|
|
197
|
-
var
|
|
198
|
-
return
|
|
237
|
+
sessions: h.sort((c, i) => {
|
|
238
|
+
var A, v;
|
|
239
|
+
return p((A = i.data) == null ? void 0 : A.createdAt).valueOf() - p((v = c.data) == null ? void 0 : v.createdAt).valueOf();
|
|
199
240
|
}),
|
|
200
241
|
key: "seven-days"
|
|
201
|
-
}),
|
|
242
|
+
}), y.length > 0 && l.push({
|
|
202
243
|
title: "30天内",
|
|
203
|
-
sessions:
|
|
204
|
-
var
|
|
205
|
-
return
|
|
244
|
+
sessions: y.sort((c, i) => {
|
|
245
|
+
var A, v;
|
|
246
|
+
return p((A = i.data) == null ? void 0 : A.createdAt).valueOf() - p((v = c.data) == null ? void 0 : v.createdAt).valueOf();
|
|
206
247
|
}),
|
|
207
248
|
key: "thirty-days"
|
|
208
|
-
}), Object.keys(
|
|
209
|
-
const i =
|
|
210
|
-
var
|
|
211
|
-
return
|
|
249
|
+
}), Object.keys(w).sort((c, i) => i.localeCompare(c)).forEach((c) => {
|
|
250
|
+
const i = w[c].sort((A, v) => {
|
|
251
|
+
var me, he;
|
|
252
|
+
return p((me = v.data) == null ? void 0 : me.createdAt).valueOf() - p((he = A.data) == null ? void 0 : he.createdAt).valueOf();
|
|
212
253
|
});
|
|
213
|
-
|
|
214
|
-
title:
|
|
254
|
+
l.push({
|
|
255
|
+
title: p(c).format("YYYY年MM月"),
|
|
215
256
|
sessions: i,
|
|
216
|
-
key: `month-${
|
|
257
|
+
key: `month-${c}`
|
|
217
258
|
});
|
|
218
|
-
}),
|
|
219
|
-
}),
|
|
220
|
-
return /* @__PURE__ */
|
|
259
|
+
}), l;
|
|
260
|
+
}), Z = He(() => fe(_), [_, fe]);
|
|
261
|
+
return /* @__PURE__ */ f("div", {
|
|
221
262
|
className: "bot-session-container",
|
|
222
|
-
children: /* @__PURE__ */
|
|
263
|
+
children: /* @__PURE__ */ T("div", {
|
|
223
264
|
className: "agent-sessions",
|
|
224
|
-
children: [
|
|
265
|
+
children: [M && (o == null ? void 0 : o.siderTitle) && /* @__PURE__ */ f("div", {
|
|
225
266
|
className: "sessions-header",
|
|
226
|
-
children: /* @__PURE__ */
|
|
267
|
+
children: /* @__PURE__ */ f("div", {
|
|
227
268
|
className: "session-header-title",
|
|
228
|
-
children: (
|
|
269
|
+
children: (b == null ? void 0 : b.name) || "-"
|
|
229
270
|
})
|
|
230
|
-
}), /* @__PURE__ */
|
|
271
|
+
}), /* @__PURE__ */ T("div", {
|
|
231
272
|
className: "sessions-main",
|
|
232
|
-
|
|
273
|
+
ref: X,
|
|
274
|
+
children: [M && /* @__PURE__ */ f("div", {
|
|
233
275
|
className: "session-header-btn-wrapper",
|
|
234
|
-
children: /* @__PURE__ */
|
|
276
|
+
children: /* @__PURE__ */ f(Ve, {
|
|
235
277
|
className: "session-header-btn",
|
|
236
|
-
onClick:
|
|
278
|
+
onClick: Me,
|
|
237
279
|
type: "primary",
|
|
238
280
|
children: "+ 新会话"
|
|
239
281
|
})
|
|
240
|
-
}),
|
|
241
|
-
var
|
|
242
|
-
return /* @__PURE__ */
|
|
282
|
+
}), Z == null ? void 0 : Z.map((e) => {
|
|
283
|
+
var t;
|
|
284
|
+
return /* @__PURE__ */ T("div", {
|
|
243
285
|
className: "session-group",
|
|
244
|
-
children: [/* @__PURE__ */
|
|
286
|
+
children: [/* @__PURE__ */ f("div", {
|
|
245
287
|
className: "group-header",
|
|
246
288
|
style: {
|
|
247
|
-
top:
|
|
289
|
+
top: M ? 48 : 0
|
|
248
290
|
},
|
|
249
|
-
children:
|
|
250
|
-
}), (
|
|
251
|
-
var
|
|
252
|
-
return /* @__PURE__ */
|
|
253
|
-
className:
|
|
291
|
+
children: e.title
|
|
292
|
+
}), (t = e.sessions) == null ? void 0 : t.map((n) => {
|
|
293
|
+
var s, d, l, m, h, y, w, q, c;
|
|
294
|
+
return /* @__PURE__ */ f("div", {
|
|
295
|
+
className: Be({
|
|
254
296
|
"session-item": !0,
|
|
255
|
-
"session-item__active": ((
|
|
297
|
+
"session-item__active": ((s = n.data) == null ? void 0 : s.id) === ((d = a == null ? void 0 : a.data) == null ? void 0 : d.id)
|
|
256
298
|
}),
|
|
257
|
-
onClick: () =>
|
|
258
|
-
children: /* @__PURE__ */
|
|
299
|
+
onClick: () => je(n),
|
|
300
|
+
children: /* @__PURE__ */ f("div", {
|
|
259
301
|
className: "session-item-wrapper",
|
|
260
|
-
children: /* @__PURE__ */
|
|
302
|
+
children: /* @__PURE__ */ T("div", {
|
|
261
303
|
className: "session-item-top",
|
|
262
|
-
children: [/* @__PURE__ */
|
|
304
|
+
children: [/* @__PURE__ */ f(Fe.Paragraph, {
|
|
263
305
|
className: "item-top-title",
|
|
264
306
|
style: {
|
|
265
307
|
margin: 0,
|
|
@@ -268,79 +310,90 @@ const K = 15, Tt = kt((E, f) => {
|
|
|
268
310
|
ellipsis: {
|
|
269
311
|
rows: 1,
|
|
270
312
|
tooltip: {
|
|
271
|
-
title: ((
|
|
313
|
+
title: ((l = n.data) == null ? void 0 : l.name) || "-",
|
|
272
314
|
placement: "topLeft"
|
|
273
315
|
}
|
|
274
316
|
},
|
|
275
317
|
children: ((m = n.data) == null ? void 0 : m.name) || "-"
|
|
276
|
-
}), /* @__PURE__ */
|
|
277
|
-
children: [/* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ T(ge, {
|
|
319
|
+
children: [/* @__PURE__ */ f("span", {
|
|
278
320
|
className: "item-top-time",
|
|
279
|
-
children:
|
|
280
|
-
}), /* @__PURE__ */
|
|
321
|
+
children: p((h = n.data) == null ? void 0 : h.createdAt).format("MM/DD HH:mm:ss")
|
|
322
|
+
}), /* @__PURE__ */ T("div", {
|
|
281
323
|
className: "item-top-action",
|
|
282
324
|
onClick: (i) => i.stopPropagation(),
|
|
283
|
-
children: [/* @__PURE__ */
|
|
284
|
-
open:
|
|
325
|
+
children: [/* @__PURE__ */ f(ve, {
|
|
326
|
+
open: ke === ((y = n.data) == null ? void 0 : y.id),
|
|
285
327
|
getPopupContainer: (i) => i.parentNode,
|
|
286
328
|
icon: !1,
|
|
287
|
-
title: /* @__PURE__ */
|
|
329
|
+
title: /* @__PURE__ */ f(Ke, {
|
|
288
330
|
placeholder: "请输入内容",
|
|
289
331
|
autoComplete: "off",
|
|
290
332
|
showCount: !0,
|
|
291
|
-
value:
|
|
292
|
-
onChange:
|
|
293
|
-
maxLength:
|
|
294
|
-
status:
|
|
333
|
+
value: K,
|
|
334
|
+
onChange: Ce,
|
|
335
|
+
maxLength: Q,
|
|
336
|
+
status: be ? "error" : ""
|
|
295
337
|
}),
|
|
296
|
-
onConfirm: () =>
|
|
297
|
-
onCancel:
|
|
298
|
-
children: /* @__PURE__ */
|
|
338
|
+
onConfirm: () => _e(n),
|
|
339
|
+
onCancel: Pe,
|
|
340
|
+
children: /* @__PURE__ */ f(Ae, {
|
|
299
341
|
type: "icon-bianji2",
|
|
300
|
-
onClick: () =>
|
|
342
|
+
onClick: () => Te(n),
|
|
301
343
|
className: "icon-action",
|
|
302
344
|
style: {
|
|
303
345
|
marginRight: "8px"
|
|
304
346
|
}
|
|
305
347
|
})
|
|
306
|
-
}, `edit-${(
|
|
348
|
+
}, `edit-${(w = n.data) == null ? void 0 : w.id}-${ne}`), /* @__PURE__ */ f(ve, {
|
|
307
349
|
getPopupContainer: (i) => i.parentNode,
|
|
308
350
|
icon: !1,
|
|
309
|
-
title: /* @__PURE__ */
|
|
351
|
+
title: /* @__PURE__ */ T(ge, {
|
|
310
352
|
direction: "vertical",
|
|
311
|
-
children: [/* @__PURE__ */
|
|
353
|
+
children: [/* @__PURE__ */ f("div", {
|
|
312
354
|
children: "删除确认?"
|
|
313
|
-
}), /* @__PURE__ */
|
|
355
|
+
}), /* @__PURE__ */ f("div", {
|
|
314
356
|
children: "会话删除后不可恢复,请确认是否删除!"
|
|
315
357
|
})]
|
|
316
358
|
}),
|
|
317
359
|
onConfirm: () => {
|
|
318
|
-
|
|
360
|
+
xe(n), G((i) => i + 1);
|
|
319
361
|
},
|
|
320
362
|
onCancel: () => {
|
|
321
|
-
|
|
363
|
+
G((i) => i + 1);
|
|
322
364
|
},
|
|
323
|
-
children: /* @__PURE__ */
|
|
365
|
+
children: /* @__PURE__ */ f(Ae, {
|
|
324
366
|
style: {
|
|
325
367
|
fontSize: "18px"
|
|
326
368
|
},
|
|
327
369
|
className: "icon-action",
|
|
328
370
|
type: "icon-del"
|
|
329
371
|
})
|
|
330
|
-
}, `delete-${(
|
|
372
|
+
}, `delete-${(q = n.data) == null ? void 0 : q.id}-${ne}`)]
|
|
331
373
|
})]
|
|
332
374
|
})]
|
|
333
375
|
})
|
|
334
376
|
})
|
|
335
|
-
}, (
|
|
377
|
+
}, (c = n.data) == null ? void 0 : c.id);
|
|
336
378
|
})]
|
|
337
|
-
},
|
|
379
|
+
}, e.key);
|
|
380
|
+
}), !S && Oe && /* @__PURE__ */ f(ze, {
|
|
381
|
+
style: {
|
|
382
|
+
color: "rgb(199 199 199)"
|
|
383
|
+
},
|
|
384
|
+
plain: !0,
|
|
385
|
+
children: "没有更多数据了"
|
|
386
|
+
}), /* @__PURE__ */ f("div", {
|
|
387
|
+
ref: W,
|
|
388
|
+
style: {
|
|
389
|
+
height: 1
|
|
390
|
+
}
|
|
338
391
|
})]
|
|
339
392
|
})]
|
|
340
393
|
})
|
|
341
394
|
});
|
|
342
395
|
});
|
|
343
|
-
|
|
396
|
+
Xe.displayName = "SessionList";
|
|
344
397
|
export {
|
|
345
|
-
|
|
398
|
+
Xe as default
|
|
346
399
|
};
|