@glodon-aiot/agent-cli-ui 3.4.1-beta.1 → 3.4.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/AgentClientUI.mjs +41 -38
- package/dist/es/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.mjs +17 -23
- package/dist/es/Dialog/AgentChat/index.mjs +120 -122
- package/dist/es/Dialog/SessionList/index.mjs +94 -94
- package/dist/es/Dialog/index.mjs +107 -102
- package/dist/es/context/SessionContext.mjs +26 -0
- package/dist/es/hooks/useSessionState.mjs +6 -0
- 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/style14.css +1 -1
- package/dist/es/src/style15.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/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/style31.css +1 -1
- package/dist/es/src/style32.css +1 -1
- package/dist/es/src/style33.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +36 -36
- package/dist/src/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.d.ts +0 -2
- package/dist/src/Dialog/AgentChat/index.d.ts +0 -2
- package/dist/src/Dialog/SessionList/index.d.ts +0 -2
- package/dist/src/context/SessionContext.d.ts +15 -0
- package/dist/src/hooks/useSessionState.d.ts +7 -0
- package/package.json +3 -3
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
var ot = Object.defineProperty;
|
|
2
2
|
var G = Object.getOwnPropertySymbols;
|
|
3
3
|
var it = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var $ = (
|
|
4
|
+
var $ = (u, r, e) => r in u ? ot(u, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[r] = e, q = (u, r) => {
|
|
5
5
|
for (var e in r || (r = {}))
|
|
6
|
-
it.call(r, e) && $(
|
|
6
|
+
it.call(r, e) && $(u, e, r[e]);
|
|
7
7
|
if (G)
|
|
8
8
|
for (var e of G(r))
|
|
9
|
-
nt.call(r, e) && $(
|
|
10
|
-
return
|
|
9
|
+
nt.call(r, e) && $(u, e, r[e]);
|
|
10
|
+
return u;
|
|
11
11
|
};
|
|
12
|
-
var x = (
|
|
13
|
-
var w = (
|
|
12
|
+
var x = (u, r, e) => new Promise((o, O) => {
|
|
13
|
+
var w = (k) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
15
|
+
E(e.next(k));
|
|
16
|
+
} catch (j) {
|
|
17
|
+
O(j);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, T = (k) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
|
|
21
|
+
E(e.throw(k));
|
|
22
|
+
} catch (j) {
|
|
23
|
+
O(j);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, E = (k) => k.done ? o(k.value) : Promise.resolve(k.value).then(w, T);
|
|
26
|
+
E((e = e.apply(u, r)).next());
|
|
27
27
|
});
|
|
28
|
-
import { jsx as s, jsxs as
|
|
29
|
-
import { forwardRef as lt, useState as C, useContext as ct, useEffect as
|
|
28
|
+
import { jsx as s, jsxs as A } from "react/jsx-runtime";
|
|
29
|
+
import { forwardRef as lt, useState as C, useContext as ct, useEffect as L, useImperativeHandle as st, useMemo as rt } from "react";
|
|
30
30
|
import { Button as mt, Popconfirm as J, Input as pt, Space as ht } from "antd";
|
|
31
31
|
import f from "dayjs";
|
|
32
32
|
import ft from "classnames";
|
|
33
33
|
import Q from "../../components/Iconfont/index.mjs";
|
|
34
34
|
import yt from "../../context.mjs";
|
|
35
|
-
/* empty css */import { useMemoizedFn as
|
|
36
|
-
import { NET_OPEN_STATUS as
|
|
37
|
-
|
|
35
|
+
/* empty css */import { useMemoizedFn as S } from "ahooks";
|
|
36
|
+
import { NET_OPEN_STATUS as W } from "../../constant.mjs";
|
|
37
|
+
import { useSessionState as vt } from "../../hooks/useSessionState.mjs";
|
|
38
|
+
const Nt = lt((u, r) => {
|
|
38
39
|
const {
|
|
39
40
|
currentSession: e,
|
|
40
41
|
setCurrentSession: o,
|
|
41
|
-
checkKnowledges:
|
|
42
|
+
checkKnowledges: O,
|
|
42
43
|
application: w,
|
|
43
|
-
networkStatus:
|
|
44
|
-
isShowHeader:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
sessionId: T
|
|
51
|
-
} = k, [L, B] = C(), {
|
|
52
|
-
agentClient: u,
|
|
53
|
-
mode: Z,
|
|
44
|
+
networkStatus: T,
|
|
45
|
+
isShowHeader: E = !0,
|
|
46
|
+
afterSessionClick: k,
|
|
47
|
+
sessionId: j
|
|
48
|
+
} = u, [V, B] = C(), {
|
|
49
|
+
agentClient: N,
|
|
50
|
+
mode: X,
|
|
54
51
|
features: a
|
|
55
|
-
} = ct(yt), [H, _] = C(
|
|
56
|
-
|
|
52
|
+
} = ct(yt), [H, _] = C(O), {
|
|
53
|
+
sessions: P,
|
|
54
|
+
setSessions: Y
|
|
55
|
+
} = vt(), K = S((t) => {
|
|
56
|
+
t.id && Y((d) => [...d.map((n) => {
|
|
57
57
|
var l;
|
|
58
58
|
return ((l = n.data) == null ? void 0 : l.id) === t.id && (n.data = q({}, t)), n;
|
|
59
59
|
})].sort((n, l) => {
|
|
@@ -62,89 +62,89 @@ const vt = lt((k, r) => {
|
|
|
62
62
|
return f((m = l.data) == null ? void 0 : m.createdAt).valueOf() - b;
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
L(() => {
|
|
66
|
+
N == null || N.getSessions().then((t) => x(void 0, null, function* () {
|
|
67
67
|
var d;
|
|
68
|
-
if (
|
|
68
|
+
if (Y([...t]), !((d = e == null ? void 0 : e.data) != null && d.id) && (t != null && t.length) && X === "inlay") {
|
|
69
69
|
const i = t[0];
|
|
70
|
-
|
|
70
|
+
j || o == null || o(i);
|
|
71
71
|
} else
|
|
72
|
-
e === void 0 && (
|
|
72
|
+
e === void 0 && (j || o == null || o(null));
|
|
73
73
|
}));
|
|
74
|
-
}, []),
|
|
74
|
+
}, []), L(() => {
|
|
75
75
|
var t;
|
|
76
|
-
if (!((t = e == null ? void 0 : e.data) != null && t.id) &&
|
|
76
|
+
if (!((t = e == null ? void 0 : e.data) != null && t.id) && O === void 0) {
|
|
77
77
|
const d = typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0;
|
|
78
78
|
_(d);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
_(
|
|
82
|
-
}, [
|
|
81
|
+
_(O);
|
|
82
|
+
}, [O]), L(() => {
|
|
83
83
|
e == null || e.addEventListener("data:updated", K);
|
|
84
84
|
}, [e]), st(r, () => ({
|
|
85
85
|
create(t) {
|
|
86
86
|
return z(t).then((d) => (o == null || o(d), d));
|
|
87
87
|
},
|
|
88
|
-
list: () => Promise.resolve(
|
|
88
|
+
list: () => Promise.resolve(P)
|
|
89
89
|
}));
|
|
90
90
|
const z = (t) => {
|
|
91
91
|
const d = typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1;
|
|
92
92
|
return new Promise((i) => x(void 0, null, function* () {
|
|
93
93
|
var l;
|
|
94
|
-
const
|
|
94
|
+
const y = typeof (a == null ? void 0 : a.promptVariables) == "object" ? (a == null ? void 0 : a.promptVariables.default) || [] : void 0, n = yield N == null ? void 0 : N.loadSession("", {
|
|
95
95
|
name: t == null ? void 0 : t.name,
|
|
96
96
|
// @ts-ignore netOpen入参是number 响应是boolen
|
|
97
97
|
// 只有对话有联网 其它没有
|
|
98
98
|
// 不传netOpen会默认取defaultNetOpen
|
|
99
|
-
netOpen: (w == null ? void 0 : w.type) === 0 ? t != null && t.netOpen ? t.netOpen : d ?
|
|
99
|
+
netOpen: (w == null ? void 0 : w.type) === 0 ? t != null && t.netOpen ? t.netOpen : d ? W.OPEN : W.CLOSE : void 0,
|
|
100
100
|
knowledges: (l = e == null ? void 0 : e.data) != null && l.id ? t == null ? void 0 : t.knowledges : H,
|
|
101
|
-
promptVariables:
|
|
101
|
+
promptVariables: y
|
|
102
102
|
});
|
|
103
103
|
n == null || n.addEventListener("data:created", () => x(void 0, null, function* () {
|
|
104
|
-
|
|
104
|
+
Y([n, ...P]), i(n);
|
|
105
105
|
}));
|
|
106
106
|
}));
|
|
107
|
-
},
|
|
107
|
+
}, Z = () => {
|
|
108
108
|
z({
|
|
109
109
|
knowledges: H
|
|
110
110
|
}).then((t) => {
|
|
111
111
|
o == null || o(t);
|
|
112
112
|
});
|
|
113
113
|
}, I = (t) => {
|
|
114
|
-
|
|
115
|
-
var i,
|
|
116
|
-
const d =
|
|
114
|
+
N == null || N.removeSession(t, !0).then(() => x(void 0, null, function* () {
|
|
115
|
+
var i, y;
|
|
116
|
+
const d = P.filter((n) => {
|
|
117
117
|
var l, b;
|
|
118
118
|
return ((l = n.data) == null ? void 0 : l.id) !== ((b = t.data) == null ? void 0 : b.id);
|
|
119
119
|
});
|
|
120
|
-
((i = t.data) == null ? void 0 : i.id) === ((
|
|
120
|
+
((i = t.data) == null ? void 0 : i.id) === ((y = e == null ? void 0 : e.data) == null ? void 0 : y.id) && (d != null && d.length ? o == null || o(d[0]) : o == null || o(null)), Y([...d]);
|
|
121
121
|
}));
|
|
122
122
|
}, tt = (t) => {
|
|
123
123
|
var d;
|
|
124
124
|
B((d = t.data) == null ? void 0 : d.name);
|
|
125
125
|
}, et = (t) => {
|
|
126
|
-
|
|
126
|
+
V && (t.rename(V), t == null || t.addEventListener("data:updated", K));
|
|
127
127
|
}, at = (t) => x(void 0, null, function* () {
|
|
128
|
-
o == null || o(t),
|
|
128
|
+
o == null || o(t), k == null || k(t);
|
|
129
129
|
}), dt = (t) => {
|
|
130
130
|
B(t.target.value);
|
|
131
131
|
};
|
|
132
|
-
|
|
133
|
-
var d, i,
|
|
132
|
+
L(() => {
|
|
133
|
+
var d, i, y, n;
|
|
134
134
|
if (!(e != null && e.id))
|
|
135
135
|
return;
|
|
136
136
|
const t = {};
|
|
137
|
-
typeof (a == null ? void 0 : a.knowledges) == "object" && ((d = a == null ? void 0 : a.knowledges) != null && d.default) && (t.knowledges = (i = a == null ? void 0 : a.knowledges) == null ? void 0 : i.default), typeof (a == null ? void 0 : a.promptVariables) == "object" && ((
|
|
137
|
+
typeof (a == null ? void 0 : a.knowledges) == "object" && ((d = a == null ? void 0 : a.knowledges) != null && d.default) && (t.knowledges = (i = a == null ? void 0 : a.knowledges) == null ? void 0 : i.default), typeof (a == null ? void 0 : a.promptVariables) == "object" && ((y = a == null ? void 0 : a.promptVariables) != null && y.default) && (t.promptVariables = (n = a == null ? void 0 : a.promptVariables) == null ? void 0 : n.default), N == null || N.loadSession(e.id, t);
|
|
138
138
|
}, [e]);
|
|
139
|
-
const F =
|
|
140
|
-
const d = f().endOf("day"), i = d.subtract(1, "day"),
|
|
139
|
+
const F = S((t) => {
|
|
140
|
+
const d = f().endOf("day"), i = d.subtract(1, "day"), y = d.subtract(7, "day"), n = d.subtract(30, "day"), l = [], b = [], M = [], g = [], m = {};
|
|
141
141
|
return t.forEach((c) => {
|
|
142
|
-
var
|
|
143
|
-
const p = f((
|
|
142
|
+
var v;
|
|
143
|
+
const p = f((v = c.data) == null ? void 0 : v.createdAt);
|
|
144
144
|
if (p.isAfter(i))
|
|
145
145
|
b.push(c);
|
|
146
|
-
else if (p.isAfter(
|
|
147
|
-
|
|
146
|
+
else if (p.isAfter(y))
|
|
147
|
+
M.push(c);
|
|
148
148
|
else if (p.isAfter(n))
|
|
149
149
|
g.push(c);
|
|
150
150
|
else {
|
|
@@ -154,28 +154,28 @@ const vt = lt((k, r) => {
|
|
|
154
154
|
}), b.length > 0 && l.push({
|
|
155
155
|
title: "今天",
|
|
156
156
|
sessions: b.sort((c, p) => {
|
|
157
|
-
var
|
|
158
|
-
return f((
|
|
157
|
+
var v, h;
|
|
158
|
+
return f((v = p.data) == null ? void 0 : v.createdAt).valueOf() - f((h = c.data) == null ? void 0 : h.createdAt).valueOf();
|
|
159
159
|
}),
|
|
160
160
|
key: "today"
|
|
161
|
-
}),
|
|
161
|
+
}), M.length > 0 && l.push({
|
|
162
162
|
title: "7天内",
|
|
163
|
-
sessions:
|
|
164
|
-
var
|
|
165
|
-
return f((
|
|
163
|
+
sessions: M.sort((c, p) => {
|
|
164
|
+
var v, h;
|
|
165
|
+
return f((v = p.data) == null ? void 0 : v.createdAt).valueOf() - f((h = c.data) == null ? void 0 : h.createdAt).valueOf();
|
|
166
166
|
}),
|
|
167
167
|
key: "seven-days"
|
|
168
168
|
}), g.length > 0 && l.push({
|
|
169
169
|
title: "30天内",
|
|
170
170
|
sessions: g.sort((c, p) => {
|
|
171
|
-
var
|
|
172
|
-
return f((
|
|
171
|
+
var v, h;
|
|
172
|
+
return f((v = p.data) == null ? void 0 : v.createdAt).valueOf() - f((h = c.data) == null ? void 0 : h.createdAt).valueOf();
|
|
173
173
|
}),
|
|
174
174
|
key: "thirty-days"
|
|
175
175
|
}), Object.keys(m).sort((c, p) => p.localeCompare(c)).forEach((c) => {
|
|
176
|
-
const p = m[c].sort((
|
|
176
|
+
const p = m[c].sort((v, h) => {
|
|
177
177
|
var R, U;
|
|
178
|
-
return f((R = h.data) == null ? void 0 : R.createdAt).valueOf() - f((U =
|
|
178
|
+
return f((R = h.data) == null ? void 0 : R.createdAt).valueOf() - f((U = v.data) == null ? void 0 : U.createdAt).valueOf();
|
|
179
179
|
});
|
|
180
180
|
l.push({
|
|
181
181
|
title: f(c).format("YYYY年MM月"),
|
|
@@ -183,53 +183,53 @@ const vt = lt((k, r) => {
|
|
|
183
183
|
key: `month-${c}`
|
|
184
184
|
});
|
|
185
185
|
}), l;
|
|
186
|
-
}),
|
|
186
|
+
}), D = rt(() => F(P), [P, F]);
|
|
187
187
|
return /* @__PURE__ */ s("div", {
|
|
188
188
|
className: "bot-session-container",
|
|
189
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ A("div", {
|
|
190
190
|
className: "agent-sessions",
|
|
191
|
-
children: [
|
|
191
|
+
children: [E && (a == null ? void 0 : a.siderTitle) && /* @__PURE__ */ s("div", {
|
|
192
192
|
className: "sessions-header",
|
|
193
193
|
children: /* @__PURE__ */ s("div", {
|
|
194
194
|
className: "session-header-title",
|
|
195
195
|
children: (w == null ? void 0 : w.name) || "-"
|
|
196
196
|
})
|
|
197
|
-
}), /* @__PURE__ */
|
|
197
|
+
}), /* @__PURE__ */ A("div", {
|
|
198
198
|
className: "sessions-main",
|
|
199
|
-
children: [
|
|
199
|
+
children: [E && /* @__PURE__ */ s("div", {
|
|
200
200
|
className: "session-header-btn-wrapper",
|
|
201
201
|
children: /* @__PURE__ */ s(mt, {
|
|
202
202
|
className: "session-header-btn",
|
|
203
|
-
onClick:
|
|
203
|
+
onClick: Z,
|
|
204
204
|
type: "primary",
|
|
205
205
|
children: "+ 新会话"
|
|
206
206
|
})
|
|
207
|
-
}),
|
|
207
|
+
}), D == null ? void 0 : D.map((t) => {
|
|
208
208
|
var d;
|
|
209
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ A("div", {
|
|
210
210
|
className: "session-group",
|
|
211
211
|
children: [/* @__PURE__ */ s("div", {
|
|
212
212
|
className: "group-header",
|
|
213
213
|
style: {
|
|
214
|
-
top:
|
|
214
|
+
top: E ? 48 : 0
|
|
215
215
|
},
|
|
216
216
|
children: t.title
|
|
217
217
|
}), (d = t.sessions) == null ? void 0 : d.map((i) => {
|
|
218
|
-
var
|
|
218
|
+
var y, n, l, b, M, g;
|
|
219
219
|
return /* @__PURE__ */ s("div", {
|
|
220
220
|
className: ft({
|
|
221
221
|
"session-item": !0,
|
|
222
|
-
"session-item__active": ((
|
|
222
|
+
"session-item__active": ((y = i.data) == null ? void 0 : y.id) === ((n = e == null ? void 0 : e.data) == null ? void 0 : n.id)
|
|
223
223
|
}),
|
|
224
224
|
onClick: () => at(i),
|
|
225
|
-
children: /* @__PURE__ */
|
|
225
|
+
children: /* @__PURE__ */ A("div", {
|
|
226
226
|
className: "session-item-wrapper",
|
|
227
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: [/* @__PURE__ */ A("div", {
|
|
228
228
|
className: "session-item-top",
|
|
229
229
|
children: [/* @__PURE__ */ s("span", {
|
|
230
230
|
className: "item-top-title",
|
|
231
231
|
children: ((l = i.data) == null ? void 0 : l.name) || "-"
|
|
232
|
-
}), /* @__PURE__ */
|
|
232
|
+
}), /* @__PURE__ */ A("div", {
|
|
233
233
|
className: "item-top-action",
|
|
234
234
|
onClick: (m) => m.stopPropagation(),
|
|
235
235
|
children: [/* @__PURE__ */ s(J, {
|
|
@@ -239,7 +239,7 @@ const vt = lt((k, r) => {
|
|
|
239
239
|
placeholder: "请输入内容",
|
|
240
240
|
autoComplete: "off",
|
|
241
241
|
showCount: !0,
|
|
242
|
-
value:
|
|
242
|
+
value: V,
|
|
243
243
|
onChange: dt,
|
|
244
244
|
maxLength: 15
|
|
245
245
|
}),
|
|
@@ -255,7 +255,7 @@ const vt = lt((k, r) => {
|
|
|
255
255
|
}), /* @__PURE__ */ s(J, {
|
|
256
256
|
getPopupContainer: (m) => m.parentNode,
|
|
257
257
|
icon: !1,
|
|
258
|
-
title: /* @__PURE__ */
|
|
258
|
+
title: /* @__PURE__ */ A(ht, {
|
|
259
259
|
direction: "vertical",
|
|
260
260
|
children: [/* @__PURE__ */ s("div", {
|
|
261
261
|
children: "删除确认?"
|
|
@@ -273,14 +273,14 @@ const vt = lt((k, r) => {
|
|
|
273
273
|
})
|
|
274
274
|
})]
|
|
275
275
|
})]
|
|
276
|
-
}), /* @__PURE__ */
|
|
276
|
+
}), /* @__PURE__ */ A("div", {
|
|
277
277
|
className: "session-item-bottom",
|
|
278
278
|
children: [/* @__PURE__ */ s("span", {
|
|
279
279
|
className: "item-bottom-desc",
|
|
280
280
|
children: ((b = i.data) == null ? void 0 : b.finialMessage) || "-"
|
|
281
281
|
}), /* @__PURE__ */ s("span", {
|
|
282
282
|
className: "item-bottom-time",
|
|
283
|
-
children: f((
|
|
283
|
+
children: f((M = i.data) == null ? void 0 : M.createdAt).format("MM/DD HH:mm:ss")
|
|
284
284
|
})]
|
|
285
285
|
})]
|
|
286
286
|
})
|
|
@@ -292,7 +292,7 @@ const vt = lt((k, r) => {
|
|
|
292
292
|
})
|
|
293
293
|
});
|
|
294
294
|
});
|
|
295
|
-
|
|
295
|
+
Nt.displayName = "SessionList";
|
|
296
296
|
export {
|
|
297
|
-
|
|
297
|
+
Nt as default
|
|
298
298
|
};
|
package/dist/es/Dialog/index.mjs
CHANGED
|
@@ -1,63 +1,68 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var q = Object.defineProperty, z = Object.defineProperties;
|
|
2
|
+
var B = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var L = Object.getOwnPropertySymbols;
|
|
4
|
+
var F = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var R = (r, d, t) => d in r ? q(r, d, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[d] = t, j = (r, d) => {
|
|
6
|
+
for (var t in d || (d = {}))
|
|
7
|
+
F.call(d, t) && R(r, t, d[t]);
|
|
8
|
+
if (L)
|
|
9
|
+
for (var t of L(d))
|
|
10
|
+
G.call(d, t) && R(r, t, d[t]);
|
|
11
11
|
return r;
|
|
12
|
-
},
|
|
13
|
-
var v = (r, d,
|
|
14
|
-
var
|
|
12
|
+
}, A = (r, d) => z(r, B(d));
|
|
13
|
+
var v = (r, d, t) => new Promise((f, y) => {
|
|
14
|
+
var s = (e) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
g
|
|
16
|
+
m(t.next(e));
|
|
17
|
+
} catch (g) {
|
|
18
|
+
y(g);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, i = (e) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
g
|
|
22
|
+
m(t.throw(e));
|
|
23
|
+
} catch (g) {
|
|
24
|
+
y(g);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, m = (e) => e.done ? f(e.value) : Promise.resolve(e.value).then(s, i);
|
|
27
|
+
m((t = t.apply(r, d)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsx as
|
|
30
|
-
import { forwardRef as
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
/* empty css */
|
|
29
|
+
import { jsx as a, jsxs as H } from "react/jsx-runtime";
|
|
30
|
+
import { forwardRef as J, useState as p, useContext as M, useRef as K, useEffect as I, useImperativeHandle as Q } from "react";
|
|
31
|
+
import W from "../context.mjs";
|
|
32
|
+
import X from "./AgentChat/index.mjs";
|
|
33
|
+
import Y from "../components/KnowledgeList/index.mjs";
|
|
34
|
+
import Z from "../components/Sider/index.mjs";
|
|
35
|
+
/* empty css */import { useSessionState as _ } from "../hooks/useSessionState.mjs";
|
|
36
|
+
const ae = J((r, d) => {
|
|
36
37
|
const {
|
|
37
|
-
sessionId:
|
|
38
|
-
appId:
|
|
39
|
-
docViewerUrl:
|
|
40
|
-
} = r, [
|
|
41
|
-
showHeader:
|
|
38
|
+
sessionId: t,
|
|
39
|
+
appId: f,
|
|
40
|
+
docViewerUrl: y
|
|
41
|
+
} = r, [s, i] = p(), {
|
|
42
|
+
showHeader: m,
|
|
42
43
|
agentClient: e,
|
|
43
|
-
sider:
|
|
44
|
-
onSessionLoad:
|
|
44
|
+
sider: g,
|
|
45
|
+
onSessionLoad: u,
|
|
45
46
|
features: c,
|
|
46
|
-
mode:
|
|
47
|
-
} =
|
|
47
|
+
mode: T
|
|
48
|
+
} = M(W), [h, D] = p(), S = K(null), [O, P] = p(""), [k, N] = p(), b = K(null), [x, w] = p(!1);
|
|
49
|
+
p([]);
|
|
50
|
+
const {
|
|
51
|
+
setIsSwitchingToExistingSession: U
|
|
52
|
+
} = _();
|
|
48
53
|
I(() => {
|
|
49
54
|
var n;
|
|
50
|
-
|
|
51
|
-
}, [
|
|
55
|
+
w(s ? !!((n = s.data) != null && n.netOpen) : typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.default) == "boolean" ? c.connectNetwork.default : !1);
|
|
56
|
+
}, [s]), I(() => {
|
|
52
57
|
const n = () => v(void 0, null, function* () {
|
|
53
58
|
const o = e == null ? void 0 : e.application;
|
|
54
59
|
if (!(o != null && o.id))
|
|
55
60
|
return;
|
|
56
|
-
const
|
|
57
|
-
if (!(
|
|
61
|
+
const l = o == null ? void 0 : o.arrange;
|
|
62
|
+
if (!(l != null && l.length))
|
|
58
63
|
return;
|
|
59
|
-
const
|
|
60
|
-
V
|
|
64
|
+
const V = l[0].embeddingService;
|
|
65
|
+
P(V), D(o);
|
|
61
66
|
});
|
|
62
67
|
if (e != null && e.ready) {
|
|
63
68
|
n();
|
|
@@ -67,48 +72,48 @@ import _ from "../components/Sider/index.mjs";
|
|
|
67
72
|
e == null || e.removeEventListener("ready", n);
|
|
68
73
|
};
|
|
69
74
|
}, [e]), I(() => {
|
|
70
|
-
e &&
|
|
71
|
-
|
|
75
|
+
e && t && (e.ready ? e == null || e.getSessions().then((n) => v(void 0, null, function* () {
|
|
76
|
+
i == null || i(n.find((o) => o.id === t));
|
|
72
77
|
})) : e.addEventListener("ready", () => v(void 0, null, function* () {
|
|
73
78
|
e == null || e.getSessions().then((n) => v(void 0, null, function* () {
|
|
74
|
-
|
|
79
|
+
i == null || i(n.find((o) => o.id === t));
|
|
75
80
|
}));
|
|
76
81
|
}), !0));
|
|
77
|
-
}, [e,
|
|
78
|
-
if (!
|
|
79
|
-
|
|
80
|
-
applicationId:
|
|
82
|
+
}, [e, t]), I(() => {
|
|
83
|
+
if (!s) {
|
|
84
|
+
u && u({
|
|
85
|
+
applicationId: f,
|
|
81
86
|
sessionId: "",
|
|
82
87
|
session: null,
|
|
83
88
|
sessionInstance: null
|
|
84
89
|
});
|
|
85
90
|
return;
|
|
86
91
|
}
|
|
87
|
-
|
|
88
|
-
applicationId:
|
|
89
|
-
sessionId:
|
|
90
|
-
session:
|
|
91
|
-
sessionInstance:
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
applicationId:
|
|
95
|
-
sessionId:
|
|
96
|
-
session:
|
|
97
|
-
sessionInstance:
|
|
92
|
+
s.data && u && u({
|
|
93
|
+
applicationId: f,
|
|
94
|
+
sessionId: s.data.id,
|
|
95
|
+
session: s.data,
|
|
96
|
+
sessionInstance: s
|
|
97
|
+
}), s.addEventListener("data:loaded", () => {
|
|
98
|
+
s != null && s.data && u && u({
|
|
99
|
+
applicationId: f,
|
|
100
|
+
sessionId: s.data.id,
|
|
101
|
+
session: s.data,
|
|
102
|
+
sessionInstance: s
|
|
98
103
|
});
|
|
99
104
|
}, !0);
|
|
100
|
-
}, [
|
|
101
|
-
const
|
|
105
|
+
}, [s]);
|
|
106
|
+
const E = (n) => {
|
|
102
107
|
var o;
|
|
103
|
-
return (o =
|
|
104
|
-
knowledges:
|
|
108
|
+
return (o = S.current) == null ? void 0 : o.create(A(j({}, n), {
|
|
109
|
+
knowledges: k
|
|
105
110
|
}));
|
|
106
111
|
};
|
|
107
|
-
return
|
|
108
|
-
createSession: (n) =>
|
|
112
|
+
return Q(d, () => ({
|
|
113
|
+
createSession: (n) => E(n),
|
|
109
114
|
getSessionList: () => {
|
|
110
115
|
var o;
|
|
111
|
-
const n = ((o =
|
|
116
|
+
const n = ((o = S.current) == null ? void 0 : o.list()) || [];
|
|
112
117
|
return Promise.resolve(n);
|
|
113
118
|
},
|
|
114
119
|
// 新增:获取当前输入框内容
|
|
@@ -116,52 +121,52 @@ import _ from "../components/Sider/index.mjs";
|
|
|
116
121
|
var n;
|
|
117
122
|
return (n = b.current) == null ? void 0 : n.getCurrentInputText();
|
|
118
123
|
}
|
|
119
|
-
})), /* @__PURE__ */
|
|
124
|
+
})), /* @__PURE__ */ a("div", {
|
|
120
125
|
className: "dialog",
|
|
121
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ H("div", {
|
|
122
127
|
className: "dialog-pannel",
|
|
123
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ a("div", {
|
|
124
129
|
className: "dialog-sider",
|
|
125
130
|
style: {
|
|
126
|
-
display:
|
|
131
|
+
display: g && T === "inlay" ? "block" : "none"
|
|
127
132
|
},
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
ref:
|
|
130
|
-
appId:
|
|
133
|
+
children: /* @__PURE__ */ a(Z, {
|
|
134
|
+
ref: S,
|
|
135
|
+
appId: f,
|
|
131
136
|
networkStatus: x,
|
|
132
|
-
currentSession:
|
|
133
|
-
application:
|
|
134
|
-
setCurrentSession:
|
|
135
|
-
checkKnowledges:
|
|
136
|
-
setCheckKnowledges:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
currentSession: s,
|
|
138
|
+
application: h,
|
|
139
|
+
setCurrentSession: i,
|
|
140
|
+
checkKnowledges: k,
|
|
141
|
+
setCheckKnowledges: m ? N : void 0,
|
|
142
|
+
sessionId: t,
|
|
143
|
+
afterSessionClick: (n) => {
|
|
144
|
+
var o, l;
|
|
145
|
+
((o = n.data) == null ? void 0 : o.id) !== ((l = s == null ? void 0 : s.data) == null ? void 0 : l.id) && U(!0);
|
|
146
|
+
}
|
|
140
147
|
})
|
|
141
|
-
}), /* @__PURE__ */
|
|
148
|
+
}), /* @__PURE__ */ a("div", {
|
|
142
149
|
className: "dialog-content",
|
|
143
|
-
children: /* @__PURE__ */
|
|
150
|
+
children: /* @__PURE__ */ H("div", {
|
|
144
151
|
className: "dialog-chat",
|
|
145
|
-
children: [
|
|
152
|
+
children: [m && /* @__PURE__ */ a("div", {
|
|
146
153
|
className: "dialog-chat-header",
|
|
147
|
-
children: /* @__PURE__ */
|
|
148
|
-
setCheckKnowledges:
|
|
149
|
-
application:
|
|
150
|
-
currentSession:
|
|
154
|
+
children: /* @__PURE__ */ a(Y, {
|
|
155
|
+
setCheckKnowledges: N,
|
|
156
|
+
application: h,
|
|
157
|
+
currentSession: s
|
|
151
158
|
})
|
|
152
|
-
}), /* @__PURE__ */
|
|
159
|
+
}), /* @__PURE__ */ a("div", {
|
|
153
160
|
className: "dialog-chat-content",
|
|
154
|
-
children: (
|
|
155
|
-
setNetworkStatus:
|
|
161
|
+
children: (h == null ? void 0 : h.id) && /* @__PURE__ */ a(X, {
|
|
162
|
+
setNetworkStatus: w,
|
|
156
163
|
networkStatus: x,
|
|
157
|
-
application:
|
|
158
|
-
currentSession:
|
|
159
|
-
onCreateSession:
|
|
160
|
-
docViewerUrl:
|
|
161
|
-
embeddingService:
|
|
162
|
-
setCurrentSession:
|
|
163
|
-
sessions: E,
|
|
164
|
-
setSessions: L,
|
|
164
|
+
application: h,
|
|
165
|
+
currentSession: s,
|
|
166
|
+
onCreateSession: E,
|
|
167
|
+
docViewerUrl: y,
|
|
168
|
+
embeddingService: O,
|
|
169
|
+
setCurrentSession: i,
|
|
165
170
|
ref: b
|
|
166
171
|
})
|
|
167
172
|
})]
|