@glodon-aiot/agent-cli-ui 3.7.0-alpha.2 → 3.8.0-alpha.4
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/Tools/UploadKnowledgeFiles/index.mjs +50 -50
- package/dist/es/Dialog/AgentChat/index.mjs +274 -265
- package/dist/es/Dialog/SessionList/index.mjs +157 -146
- package/dist/es/components/KnowledgeList/index.mjs +54 -48
- package/dist/es/constant.mjs +4 -3
- package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/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/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/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/utils/index.mjs +34 -30
- package/dist/lib/index.js +53 -53
- package/dist/src/constant.d.ts +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1,165 +1,176 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ut = Object.defineProperty;
|
|
2
2
|
var Z = Object.getOwnPropertySymbols;
|
|
3
|
-
var Nt = Object.prototype.hasOwnProperty,
|
|
4
|
-
var
|
|
3
|
+
var Nt = Object.prototype.hasOwnProperty, wt = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var tt = (u, m, e) => m in u ? ut(u, m, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[m] = e, et = (u, m) => {
|
|
5
5
|
for (var e in m || (m = {}))
|
|
6
|
-
Nt.call(m, e) &&
|
|
6
|
+
Nt.call(m, e) && tt(u, e, m[e]);
|
|
7
7
|
if (Z)
|
|
8
8
|
for (var e of Z(m))
|
|
9
|
-
|
|
10
|
-
return
|
|
9
|
+
wt.call(m, e) && tt(u, e, m[e]);
|
|
10
|
+
return u;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _ = (u, m, e) => new Promise((l, b) => {
|
|
13
|
+
var k = (N) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
b(
|
|
15
|
+
O(e.next(N));
|
|
16
|
+
} catch (L) {
|
|
17
|
+
b(L);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, H = (N) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
b(
|
|
21
|
+
O(e.throw(N));
|
|
22
|
+
} catch (L) {
|
|
23
|
+
b(L);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, O = (N) => N.done ? l(N.value) : Promise.resolve(N.value).then(k, H);
|
|
26
|
+
O((e = e.apply(u, m)).next());
|
|
27
27
|
});
|
|
28
28
|
import { jsx as r, jsxs as M } from "react/jsx-runtime";
|
|
29
|
-
import { forwardRef as
|
|
30
|
-
import { Button as
|
|
29
|
+
import { forwardRef as At, useState as x, useContext as Et, useEffect as C, useImperativeHandle as kt, useMemo as bt } from "react";
|
|
30
|
+
import { Button as Ot, Typography as Mt, Space as at, Popconfirm as ot, Input as Lt } from "antd";
|
|
31
31
|
import h from "dayjs";
|
|
32
|
-
import
|
|
32
|
+
import _t from "classnames";
|
|
33
33
|
import dt from "../../components/Iconfont/index.mjs";
|
|
34
34
|
import jt from "../../context.mjs";
|
|
35
|
-
/* empty css */import { useMemoizedFn as
|
|
36
|
-
import { NET_OPEN_STATUS as it } from "../../constant.mjs";
|
|
37
|
-
import { useSessionState as
|
|
38
|
-
|
|
35
|
+
/* empty css */import { useMemoizedFn as nt } from "ahooks";
|
|
36
|
+
import { MAX_KNOWLEDGES_AND_FILES_COUNT as T, NET_OPEN_STATUS as it } from "../../constant.mjs";
|
|
37
|
+
import { useSessionState as xt } from "../../hooks/useSessionState.mjs";
|
|
38
|
+
import { calcKnowledgesLeafCount as lt } from "../../utils/index.mjs";
|
|
39
|
+
const F = 15, Pt = At((u, m) => {
|
|
39
40
|
const {
|
|
40
41
|
currentSession: e,
|
|
41
|
-
setCurrentSession:
|
|
42
|
+
setCurrentSession: l,
|
|
42
43
|
checkKnowledges: b,
|
|
43
|
-
application:
|
|
44
|
-
networkStatus:
|
|
45
|
-
isShowHeader:
|
|
46
|
-
afterSessionClick:
|
|
47
|
-
sessionId:
|
|
48
|
-
} =
|
|
44
|
+
application: k,
|
|
45
|
+
networkStatus: H,
|
|
46
|
+
isShowHeader: O = !0,
|
|
47
|
+
afterSessionClick: N,
|
|
48
|
+
sessionId: L
|
|
49
|
+
} = u, [D, Y] = x(), {
|
|
49
50
|
agentClient: v,
|
|
50
|
-
mode:
|
|
51
|
-
features:
|
|
52
|
-
} =
|
|
53
|
-
sessions:
|
|
54
|
-
setSessions:
|
|
55
|
-
} =
|
|
56
|
-
t.id &&
|
|
51
|
+
mode: st,
|
|
52
|
+
features: o
|
|
53
|
+
} = Et(jt), [K, B] = x(b), {
|
|
54
|
+
sessions: j,
|
|
55
|
+
setSessions: P
|
|
56
|
+
} = xt(), [R, $] = x(0), [ct, S] = x(""), [rt, G] = x(null), U = nt((t) => {
|
|
57
|
+
t.id && P((a) => [...a.map((n) => {
|
|
57
58
|
var s;
|
|
58
|
-
return ((s =
|
|
59
|
-
})].sort((
|
|
60
|
-
var
|
|
61
|
-
const g = h((
|
|
62
|
-
return h((
|
|
59
|
+
return ((s = n.data) == null ? void 0 : s.id) === t.id && (n.data = et({}, t)), n;
|
|
60
|
+
})].sort((n, s) => {
|
|
61
|
+
var E, w;
|
|
62
|
+
const g = h((E = n.data) == null ? void 0 : E.createdAt).valueOf();
|
|
63
|
+
return h((w = s.data) == null ? void 0 : w.createdAt).valueOf() - g;
|
|
63
64
|
}));
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
-
v == null || v.getSessions().then((t) =>
|
|
67
|
-
var
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
|
|
66
|
+
C(() => {
|
|
67
|
+
v == null || v.getSessions().then((t) => _(void 0, null, function* () {
|
|
68
|
+
var a;
|
|
69
|
+
if (P([...t]), !((a = e == null ? void 0 : e.data) != null && a.id) && (t != null && t.length) && st === "inlay") {
|
|
70
|
+
const d = t[0];
|
|
71
|
+
L || l == null || l(d);
|
|
71
72
|
} else
|
|
72
|
-
e === void 0 && (
|
|
73
|
+
e === void 0 && (L || l == null || l(null));
|
|
73
74
|
}));
|
|
74
|
-
}, []),
|
|
75
|
+
}, []), C(() => {
|
|
75
76
|
var t;
|
|
76
77
|
if (!((t = e == null ? void 0 : e.data) != null && t.id) && b === void 0) {
|
|
77
|
-
const
|
|
78
|
-
|
|
78
|
+
const a = typeof (o == null ? void 0 : o.knowledges) == "object" && o.knowledges.default || void 0;
|
|
79
|
+
if (Array.isArray(a) && a.some((n) => Array.isArray(n.fileIds) && n.fileIds.length === 0))
|
|
80
|
+
throw Error("fileIds cannot be an empty array");
|
|
81
|
+
if (lt(a || []) > T)
|
|
82
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${T}`);
|
|
83
|
+
B(a);
|
|
79
84
|
return;
|
|
80
85
|
}
|
|
81
|
-
|
|
82
|
-
}, [b]),
|
|
83
|
-
e == null || e.addEventListener("data:updated",
|
|
84
|
-
}, [e]),
|
|
86
|
+
B(b);
|
|
87
|
+
}, [b]), C(() => {
|
|
88
|
+
e == null || e.addEventListener("data:updated", U);
|
|
89
|
+
}, [e]), kt(m, () => ({
|
|
85
90
|
create(t) {
|
|
86
|
-
return
|
|
91
|
+
return z(t).then((a) => (l == null || l(a), a));
|
|
87
92
|
},
|
|
88
|
-
list: () => Promise.resolve(
|
|
93
|
+
list: () => Promise.resolve(j)
|
|
89
94
|
}));
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
return new Promise((
|
|
95
|
+
const z = (t) => {
|
|
96
|
+
const a = typeof (o == null ? void 0 : o.connectNetwork) == "object" && typeof (o == null ? void 0 : o.connectNetwork.default) == "boolean" ? o.connectNetwork.default : !1;
|
|
97
|
+
return new Promise((d) => _(void 0, null, function* () {
|
|
93
98
|
var s;
|
|
94
|
-
const f = typeof (
|
|
99
|
+
const f = typeof (o == null ? void 0 : o.promptVariables) == "object" ? (o == null ? void 0 : o.promptVariables.default) || [] : void 0, n = yield v == null ? void 0 : v.loadSession("", {
|
|
95
100
|
name: t == null ? void 0 : t.name,
|
|
96
101
|
// @ts-ignore netOpen入参是number 响应是boolen
|
|
97
102
|
// 只有对话有联网 其它没有
|
|
98
103
|
// 不传netOpen会默认取defaultNetOpen
|
|
99
|
-
netOpen: (
|
|
100
|
-
knowledges: (s = e == null ? void 0 : e.data) != null && s.id ? t == null ? void 0 : t.knowledges :
|
|
104
|
+
netOpen: (k == null ? void 0 : k.type) === 0 ? t != null && t.netOpen ? t.netOpen : a ? it.OPEN : it.CLOSE : void 0,
|
|
105
|
+
knowledges: (s = e == null ? void 0 : e.data) != null && s.id ? t == null ? void 0 : t.knowledges : K,
|
|
101
106
|
promptVariables: f
|
|
102
107
|
});
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
n == null || n.addEventListener("data:created", () => _(void 0, null, function* () {
|
|
109
|
+
P([n, ...j]), d(n);
|
|
105
110
|
}));
|
|
106
111
|
}));
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
knowledges:
|
|
112
|
+
}, mt = () => {
|
|
113
|
+
z({
|
|
114
|
+
knowledges: K
|
|
110
115
|
}).then((t) => {
|
|
111
|
-
|
|
116
|
+
l == null || l(t);
|
|
112
117
|
});
|
|
113
|
-
},
|
|
114
|
-
v == null || v.removeSession(t, !0).then(() =>
|
|
115
|
-
var
|
|
116
|
-
const
|
|
118
|
+
}, ft = (t) => {
|
|
119
|
+
v == null || v.removeSession(t, !0).then(() => _(void 0, null, function* () {
|
|
120
|
+
var d, f;
|
|
121
|
+
const a = j.filter((n) => {
|
|
117
122
|
var s, g;
|
|
118
|
-
return ((s =
|
|
123
|
+
return ((s = n.data) == null ? void 0 : s.id) !== ((g = t.data) == null ? void 0 : g.id);
|
|
119
124
|
});
|
|
120
|
-
((
|
|
125
|
+
((d = t.data) == null ? void 0 : d.id) === ((f = e == null ? void 0 : e.data) == null ? void 0 : f.id) && (a != null && a.length ? l == null || l(a[0]) : l == null || l(null)), P([...a]);
|
|
121
126
|
}));
|
|
122
|
-
}, mt = (t) => {
|
|
123
|
-
var d, o;
|
|
124
|
-
_((d = t.data) == null ? void 0 : d.name), T(""), z(((o = t.data) == null ? void 0 : o.id) || null);
|
|
125
127
|
}, pt = (t) => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
var a, d;
|
|
129
|
+
Y((a = t.data) == null ? void 0 : a.name), S(""), G(((d = t.data) == null ? void 0 : d.id) || null);
|
|
130
|
+
}, ht = (t) => {
|
|
131
|
+
const a = W(D || "");
|
|
132
|
+
if (a) {
|
|
133
|
+
S(a);
|
|
129
134
|
return;
|
|
130
135
|
}
|
|
131
|
-
t.rename(
|
|
132
|
-
},
|
|
136
|
+
t.rename(D.trim()), t == null || t.addEventListener("data:updated", U), X();
|
|
137
|
+
}, yt = () => {
|
|
133
138
|
X();
|
|
134
139
|
}, X = () => {
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
}),
|
|
139
|
-
const
|
|
140
|
-
|
|
140
|
+
G(null), Y(""), S(""), $((t) => t + 1);
|
|
141
|
+
}, W = (t) => !t || t.trim().length === 0 ? "会话名称不能为空" : t.length > F ? `不能超过${F}个字符` : "", vt = (t) => _(void 0, null, function* () {
|
|
142
|
+
l == null || l(t), N == null || N(t);
|
|
143
|
+
}), gt = (t) => {
|
|
144
|
+
const a = t.target.value;
|
|
145
|
+
Y(a), S(W(a));
|
|
141
146
|
};
|
|
142
|
-
|
|
143
|
-
var
|
|
147
|
+
C(() => {
|
|
148
|
+
var a, d, f, n;
|
|
144
149
|
if (!(e != null && e.id))
|
|
145
150
|
return;
|
|
146
151
|
const t = {};
|
|
147
|
-
typeof (
|
|
152
|
+
if (typeof (o == null ? void 0 : o.knowledges) == "object" && ((a = o == null ? void 0 : o.knowledges) != null && a.default)) {
|
|
153
|
+
if (t.knowledges = (d = o == null ? void 0 : o.knowledges) == null ? void 0 : d.default, Array.isArray(t.knowledges) && t.knowledges.some((A) => Array.isArray(A.fileIds) && A.fileIds.length === 0))
|
|
154
|
+
throw Error("fileIds cannot be an empty array");
|
|
155
|
+
if (lt(t.knowledges) > T)
|
|
156
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${T}`);
|
|
157
|
+
}
|
|
158
|
+
typeof (o == null ? void 0 : o.promptVariables) == "object" && ((f = o == null ? void 0 : o.promptVariables) != null && f.default) && (t.promptVariables = (n = o == null ? void 0 : o.promptVariables) == null ? void 0 : n.default), v == null || v.loadSession(e.id, t);
|
|
148
159
|
}, [e]);
|
|
149
|
-
const
|
|
150
|
-
const
|
|
160
|
+
const q = nt((t) => {
|
|
161
|
+
const a = h().endOf("day"), d = a.subtract(1, "day"), f = a.subtract(7, "day"), n = a.subtract(30, "day"), s = [], g = [], A = [], E = [], w = {};
|
|
151
162
|
return t.forEach((c) => {
|
|
152
163
|
var y;
|
|
153
164
|
const i = h((y = c.data) == null ? void 0 : y.createdAt);
|
|
154
|
-
if (i.isAfter(
|
|
165
|
+
if (i.isAfter(d))
|
|
155
166
|
g.push(c);
|
|
156
167
|
else if (i.isAfter(f))
|
|
157
|
-
|
|
158
|
-
else if (i.isAfter(
|
|
159
|
-
|
|
168
|
+
A.push(c);
|
|
169
|
+
else if (i.isAfter(n))
|
|
170
|
+
E.push(c);
|
|
160
171
|
else {
|
|
161
172
|
const p = i.format("YYYY-MM");
|
|
162
|
-
|
|
173
|
+
w[p] || (w[p] = []), w[p].push(c);
|
|
163
174
|
}
|
|
164
175
|
}), g.length > 0 && s.push({
|
|
165
176
|
title: "今天",
|
|
@@ -168,24 +179,24 @@ const B = 15, Lt = gt((N, m) => {
|
|
|
168
179
|
return h((y = i.data) == null ? void 0 : y.createdAt).valueOf() - h((p = c.data) == null ? void 0 : p.createdAt).valueOf();
|
|
169
180
|
}),
|
|
170
181
|
key: "today"
|
|
171
|
-
}),
|
|
182
|
+
}), A.length > 0 && s.push({
|
|
172
183
|
title: "7天内",
|
|
173
|
-
sessions:
|
|
184
|
+
sessions: A.sort((c, i) => {
|
|
174
185
|
var y, p;
|
|
175
186
|
return h((y = i.data) == null ? void 0 : y.createdAt).valueOf() - h((p = c.data) == null ? void 0 : p.createdAt).valueOf();
|
|
176
187
|
}),
|
|
177
188
|
key: "seven-days"
|
|
178
|
-
}),
|
|
189
|
+
}), E.length > 0 && s.push({
|
|
179
190
|
title: "30天内",
|
|
180
|
-
sessions:
|
|
191
|
+
sessions: E.sort((c, i) => {
|
|
181
192
|
var y, p;
|
|
182
193
|
return h((y = i.data) == null ? void 0 : y.createdAt).valueOf() - h((p = c.data) == null ? void 0 : p.createdAt).valueOf();
|
|
183
194
|
}),
|
|
184
195
|
key: "thirty-days"
|
|
185
|
-
}), Object.keys(
|
|
186
|
-
const i =
|
|
187
|
-
var
|
|
188
|
-
return h((
|
|
196
|
+
}), Object.keys(w).sort((c, i) => i.localeCompare(c)).forEach((c) => {
|
|
197
|
+
const i = w[c].sort((y, p) => {
|
|
198
|
+
var J, Q;
|
|
199
|
+
return h((J = p.data) == null ? void 0 : J.createdAt).valueOf() - h((Q = y.data) == null ? void 0 : Q.createdAt).valueOf();
|
|
189
200
|
});
|
|
190
201
|
s.push({
|
|
191
202
|
title: h(c).format("YYYY年MM月"),
|
|
@@ -193,50 +204,50 @@ const B = 15, Lt = gt((N, m) => {
|
|
|
193
204
|
key: `month-${c}`
|
|
194
205
|
});
|
|
195
206
|
}), s;
|
|
196
|
-
}),
|
|
207
|
+
}), V = bt(() => q(j), [j, q]);
|
|
197
208
|
return /* @__PURE__ */ r("div", {
|
|
198
209
|
className: "bot-session-container",
|
|
199
210
|
children: /* @__PURE__ */ M("div", {
|
|
200
211
|
className: "agent-sessions",
|
|
201
|
-
children: [
|
|
212
|
+
children: [O && (o == null ? void 0 : o.siderTitle) && /* @__PURE__ */ r("div", {
|
|
202
213
|
className: "sessions-header",
|
|
203
214
|
children: /* @__PURE__ */ r("div", {
|
|
204
215
|
className: "session-header-title",
|
|
205
|
-
children: (
|
|
216
|
+
children: (k == null ? void 0 : k.name) || "-"
|
|
206
217
|
})
|
|
207
218
|
}), /* @__PURE__ */ M("div", {
|
|
208
219
|
className: "sessions-main",
|
|
209
|
-
children: [
|
|
220
|
+
children: [O && /* @__PURE__ */ r("div", {
|
|
210
221
|
className: "session-header-btn-wrapper",
|
|
211
|
-
children: /* @__PURE__ */ r(
|
|
222
|
+
children: /* @__PURE__ */ r(Ot, {
|
|
212
223
|
className: "session-header-btn",
|
|
213
|
-
onClick:
|
|
224
|
+
onClick: mt,
|
|
214
225
|
type: "primary",
|
|
215
226
|
children: "+ 新会话"
|
|
216
227
|
})
|
|
217
|
-
}),
|
|
218
|
-
var
|
|
228
|
+
}), V == null ? void 0 : V.map((t) => {
|
|
229
|
+
var a;
|
|
219
230
|
return /* @__PURE__ */ M("div", {
|
|
220
231
|
className: "session-group",
|
|
221
232
|
children: [/* @__PURE__ */ r("div", {
|
|
222
233
|
className: "group-header",
|
|
223
234
|
style: {
|
|
224
|
-
top:
|
|
235
|
+
top: O ? 48 : 0
|
|
225
236
|
},
|
|
226
237
|
children: t.title
|
|
227
|
-
}), (
|
|
228
|
-
var f,
|
|
238
|
+
}), (a = t.sessions) == null ? void 0 : a.map((d) => {
|
|
239
|
+
var f, n, s, g, A, E, w, I, c;
|
|
229
240
|
return /* @__PURE__ */ r("div", {
|
|
230
|
-
className:
|
|
241
|
+
className: _t({
|
|
231
242
|
"session-item": !0,
|
|
232
|
-
"session-item__active": ((f =
|
|
243
|
+
"session-item__active": ((f = d.data) == null ? void 0 : f.id) === ((n = e == null ? void 0 : e.data) == null ? void 0 : n.id)
|
|
233
244
|
}),
|
|
234
|
-
onClick: () =>
|
|
245
|
+
onClick: () => vt(d),
|
|
235
246
|
children: /* @__PURE__ */ r("div", {
|
|
236
247
|
className: "session-item-wrapper",
|
|
237
248
|
children: /* @__PURE__ */ M("div", {
|
|
238
249
|
className: "session-item-top",
|
|
239
|
-
children: [/* @__PURE__ */ r(
|
|
250
|
+
children: [/* @__PURE__ */ r(Mt.Paragraph, {
|
|
240
251
|
className: "item-top-title",
|
|
241
252
|
style: {
|
|
242
253
|
margin: 0,
|
|
@@ -245,45 +256,45 @@ const B = 15, Lt = gt((N, m) => {
|
|
|
245
256
|
ellipsis: {
|
|
246
257
|
rows: 1,
|
|
247
258
|
tooltip: {
|
|
248
|
-
title: ((s =
|
|
259
|
+
title: ((s = d.data) == null ? void 0 : s.name) || "-",
|
|
249
260
|
placement: "topLeft"
|
|
250
261
|
}
|
|
251
262
|
},
|
|
252
|
-
children: ((g =
|
|
253
|
-
}), /* @__PURE__ */ M(
|
|
263
|
+
children: ((g = d.data) == null ? void 0 : g.name) || "-"
|
|
264
|
+
}), /* @__PURE__ */ M(at, {
|
|
254
265
|
children: [/* @__PURE__ */ r("span", {
|
|
255
266
|
className: "item-top-time",
|
|
256
|
-
children: h((
|
|
267
|
+
children: h((A = d.data) == null ? void 0 : A.createdAt).format("MM/DD HH:mm:ss")
|
|
257
268
|
}), /* @__PURE__ */ M("div", {
|
|
258
269
|
className: "item-top-action",
|
|
259
270
|
onClick: (i) => i.stopPropagation(),
|
|
260
|
-
children: [/* @__PURE__ */ r(
|
|
261
|
-
open:
|
|
271
|
+
children: [/* @__PURE__ */ r(ot, {
|
|
272
|
+
open: rt === ((E = d.data) == null ? void 0 : E.id),
|
|
262
273
|
getPopupContainer: (i) => i.parentNode,
|
|
263
274
|
icon: !1,
|
|
264
|
-
title: /* @__PURE__ */ r(
|
|
275
|
+
title: /* @__PURE__ */ r(Lt, {
|
|
265
276
|
placeholder: "请输入内容",
|
|
266
277
|
autoComplete: "off",
|
|
267
278
|
showCount: !0,
|
|
268
|
-
value:
|
|
269
|
-
onChange:
|
|
270
|
-
maxLength:
|
|
271
|
-
status:
|
|
279
|
+
value: D,
|
|
280
|
+
onChange: gt,
|
|
281
|
+
maxLength: F,
|
|
282
|
+
status: ct ? "error" : ""
|
|
272
283
|
}),
|
|
273
|
-
onConfirm: () =>
|
|
274
|
-
onCancel:
|
|
284
|
+
onConfirm: () => ht(d),
|
|
285
|
+
onCancel: yt,
|
|
275
286
|
children: /* @__PURE__ */ r(dt, {
|
|
276
287
|
type: "icon-bianji2",
|
|
277
|
-
onClick: () =>
|
|
288
|
+
onClick: () => pt(d),
|
|
278
289
|
className: "icon-action",
|
|
279
290
|
style: {
|
|
280
291
|
marginRight: "8px"
|
|
281
292
|
}
|
|
282
293
|
})
|
|
283
|
-
}, `edit-${(
|
|
294
|
+
}, `edit-${(w = d.data) == null ? void 0 : w.id}-${R}`), /* @__PURE__ */ r(ot, {
|
|
284
295
|
getPopupContainer: (i) => i.parentNode,
|
|
285
296
|
icon: !1,
|
|
286
|
-
title: /* @__PURE__ */ M(
|
|
297
|
+
title: /* @__PURE__ */ M(at, {
|
|
287
298
|
direction: "vertical",
|
|
288
299
|
children: [/* @__PURE__ */ r("div", {
|
|
289
300
|
children: "删除确认?"
|
|
@@ -292,10 +303,10 @@ const B = 15, Lt = gt((N, m) => {
|
|
|
292
303
|
})]
|
|
293
304
|
}),
|
|
294
305
|
onConfirm: () => {
|
|
295
|
-
|
|
306
|
+
ft(d), $((i) => i + 1);
|
|
296
307
|
},
|
|
297
308
|
onCancel: () => {
|
|
298
|
-
|
|
309
|
+
$((i) => i + 1);
|
|
299
310
|
},
|
|
300
311
|
children: /* @__PURE__ */ r(dt, {
|
|
301
312
|
style: {
|
|
@@ -304,12 +315,12 @@ const B = 15, Lt = gt((N, m) => {
|
|
|
304
315
|
className: "icon-action",
|
|
305
316
|
type: "icon-del"
|
|
306
317
|
})
|
|
307
|
-
}, `delete-${(
|
|
318
|
+
}, `delete-${(I = d.data) == null ? void 0 : I.id}-${R}`)]
|
|
308
319
|
})]
|
|
309
320
|
})]
|
|
310
321
|
})
|
|
311
322
|
})
|
|
312
|
-
}, (c =
|
|
323
|
+
}, (c = d.data) == null ? void 0 : c.id);
|
|
313
324
|
})]
|
|
314
325
|
}, t.key);
|
|
315
326
|
})]
|
|
@@ -317,7 +328,7 @@ const B = 15, Lt = gt((N, m) => {
|
|
|
317
328
|
})
|
|
318
329
|
});
|
|
319
330
|
});
|
|
320
|
-
|
|
331
|
+
Pt.displayName = "SessionList";
|
|
321
332
|
export {
|
|
322
|
-
|
|
333
|
+
Pt as default
|
|
323
334
|
};
|
|
@@ -1,73 +1,79 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useContext as
|
|
3
|
-
/* empty css */import
|
|
4
|
-
import { Space as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as x, jsx as F } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as K, useState as c, useEffect as j } from "react";
|
|
3
|
+
/* empty css */import L from "../../context.mjs";
|
|
4
|
+
import { Space as D } from "antd";
|
|
5
|
+
import O from "./KnowledgeSelect/index.mjs";
|
|
6
|
+
import { MAX_KNOWLEDGES_AND_FILES_COUNT as I } from "../../constant.mjs";
|
|
7
|
+
import { calcKnowledgesLeafCount as G } from "../../utils/index.mjs";
|
|
8
|
+
const z = (N) => {
|
|
9
|
+
var A, b;
|
|
8
10
|
const {
|
|
9
11
|
currentSession: t,
|
|
10
12
|
application: o,
|
|
11
|
-
setCheckKnowledges:
|
|
12
|
-
} =
|
|
13
|
-
mode:
|
|
14
|
-
transform:
|
|
13
|
+
setCheckKnowledges: s
|
|
14
|
+
} = N, {
|
|
15
|
+
mode: C,
|
|
16
|
+
transform: p,
|
|
15
17
|
features: n
|
|
16
|
-
} =
|
|
17
|
-
|
|
18
|
+
} = K(L), [a, v] = c([]), [m, w] = c(typeof (n == null ? void 0 : n.knowledges) == "object" ? ((A = n.knowledges.default) == null ? void 0 : A.map((e) => e.id)) || [] : []), [S, h] = c(0), [E, u] = c(!1);
|
|
19
|
+
j(() => {
|
|
18
20
|
if (!(o != null && o.id))
|
|
19
21
|
return;
|
|
20
22
|
const e = o.arrange;
|
|
21
23
|
if (!(e != null && e.length))
|
|
22
24
|
return;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
25
|
+
const l = e[0].knowledges || [];
|
|
26
|
+
v(l);
|
|
27
|
+
const d = typeof (n == null ? void 0 : n.knowledges) == "object" && n.knowledges.default || l;
|
|
28
|
+
if (Array.isArray(d) && d.some((i) => Array.isArray(i.fileIds) && i.fileIds.length === 0))
|
|
29
|
+
throw Error("fileIds cannot be an empty array");
|
|
30
|
+
if (G(d || []) > I)
|
|
31
|
+
throw Error(`knowledges and fileIds total count cannot exceed ${I}`);
|
|
26
32
|
if (!t) {
|
|
27
|
-
|
|
33
|
+
w(d.map((f) => f.id)), h(d.length), s == null || s(d);
|
|
28
34
|
return;
|
|
29
35
|
}
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
36
|
+
const y = () => {
|
|
37
|
+
const f = t.knowledges || d;
|
|
38
|
+
h(f.length);
|
|
39
|
+
const i = f.map((k) => k.id);
|
|
40
|
+
w(i);
|
|
35
41
|
};
|
|
36
|
-
return
|
|
37
|
-
t == null || t.removeEventListener("data:updated",
|
|
42
|
+
return y(), t.addEventListener("data:updated", y), () => {
|
|
43
|
+
t == null || t.removeEventListener("data:updated", y);
|
|
38
44
|
};
|
|
39
|
-
}, [o, t]),
|
|
40
|
-
var
|
|
41
|
-
if (!
|
|
45
|
+
}, [o, t]), j(() => {
|
|
46
|
+
var r;
|
|
47
|
+
if (!E || (u(!1), !(o != null && o.id)))
|
|
42
48
|
return;
|
|
43
49
|
const e = [];
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
e.push(
|
|
47
|
-
}), (
|
|
48
|
-
}, [
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
e == null || e.map((
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
}),
|
|
50
|
+
m == null || m.map((l) => {
|
|
51
|
+
const d = a == null ? void 0 : a.find((g) => g.id === l);
|
|
52
|
+
e.push(d);
|
|
53
|
+
}), (r = t == null ? void 0 : t.data) != null && r.id && t.setKnowledges(e);
|
|
54
|
+
}, [E]);
|
|
55
|
+
const _ = (e) => {
|
|
56
|
+
u(!0), w(e);
|
|
57
|
+
const r = [];
|
|
58
|
+
e == null || e.map((l) => {
|
|
59
|
+
const d = a == null ? void 0 : a.find((g) => g.id === l);
|
|
60
|
+
r.push(d);
|
|
61
|
+
}), s == null || s(r), h(e.length);
|
|
56
62
|
};
|
|
57
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ x("div", {
|
|
58
64
|
className: "chat-header",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ x(D, {
|
|
60
66
|
className: "header-title",
|
|
61
|
-
children: [
|
|
62
|
-
}), (
|
|
67
|
+
children: [C === "inlay" && ((b = t == null ? void 0 : t.data) == null ? void 0 : b.name), C === "float" && (o == null ? void 0 : o.name)]
|
|
68
|
+
}), (p == null ? void 0 : p.knowledges) && a.length !== 0 && /* @__PURE__ */ F(O, {
|
|
63
69
|
disabled: typeof (n == null ? void 0 : n.knowledges) == "object" && (n == null ? void 0 : n.knowledges.diabled) || !1,
|
|
64
|
-
checkedValues:
|
|
65
|
-
currKnowledgeList:
|
|
66
|
-
selectCount:
|
|
67
|
-
onSelectChange:
|
|
70
|
+
checkedValues: m,
|
|
71
|
+
currKnowledgeList: a,
|
|
72
|
+
selectCount: S,
|
|
73
|
+
onSelectChange: _
|
|
68
74
|
})]
|
|
69
75
|
});
|
|
70
76
|
};
|
|
71
77
|
export {
|
|
72
|
-
|
|
78
|
+
z as default
|
|
73
79
|
};
|
package/dist/es/constant.mjs
CHANGED
|
@@ -105,16 +105,17 @@ const u = {
|
|
|
105
105
|
doc: r,
|
|
106
106
|
docx: s,
|
|
107
107
|
pdf: o
|
|
108
|
-
},
|
|
108
|
+
}, N = {
|
|
109
109
|
OPEN: 1,
|
|
110
110
|
CLOSE: 2
|
|
111
|
-
};
|
|
111
|
+
}, b = 100;
|
|
112
112
|
export {
|
|
113
113
|
h as FILE_ICONS,
|
|
114
114
|
g as GB,
|
|
115
115
|
m as KB,
|
|
116
|
+
b as MAX_KNOWLEDGES_AND_FILES_COUNT,
|
|
116
117
|
d as MB,
|
|
117
|
-
|
|
118
|
+
N as NET_OPEN_STATUS,
|
|
118
119
|
t as brand,
|
|
119
120
|
c as defaultApiUrl,
|
|
120
121
|
f as defaultDovViewerUrl,
|