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