@glodon-aiot/agent-cli-ui 3.5.0-alpha.2 → 3.5.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/HistoryItem/FileItem/index.mjs +52 -48
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionAction/index.mjs +112 -94
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +26 -24
- package/dist/es/Dialog/AgentChat/Tools/SessionListDrawer/HistorySessionList/index.mjs +65 -59
- package/dist/es/Dialog/AgentChat/Tools/UploadKnowledgeFiles/index.mjs +179 -161
- package/dist/es/Dialog/AgentChat/index.mjs +520 -465
- package/dist/es/Dialog/SessionList/index.mjs +105 -114
- package/dist/es/QuillEditor/index.mjs +72 -65
- package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +182 -170
- package/dist/es/components/Recommend/RecommendItem.mjs +20 -18
- package/dist/es/index.mjs +223 -214
- 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/style.css +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/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/style24.css +1 -1
- package/dist/es/src/style25.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/style29.css +1 -1
- package/dist/es/src/style3.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/style33.css +1 -1
- package/dist/es/src/style4.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/es/utils/antdConfig.mjs +15 -0
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +57 -57
- package/dist/src/utils/antdConfig.d.ts +7 -0
- package/dist/src/utils/testAntdPrefix.d.ts +3 -0
- package/package.json +3 -3
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var l in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var l of
|
|
10
|
-
|
|
1
|
+
var he = Object.defineProperty, ye = Object.defineProperties;
|
|
2
|
+
var Ie = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Q = Object.getOwnPropertySymbols;
|
|
4
|
+
var be = Object.prototype.hasOwnProperty, xe = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var X = (n, i, l) => i in n ? he(n, i, { enumerable: !0, configurable: !0, writable: !0, value: l }) : n[i] = l, V = (n, i) => {
|
|
6
|
+
for (var l in i || (i = {}))
|
|
7
|
+
be.call(i, l) && X(n, l, i[l]);
|
|
8
|
+
if (Q)
|
|
9
|
+
for (var l of Q(i))
|
|
10
|
+
xe.call(i, l) && X(n, l, i[l]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var q = (
|
|
12
|
+
}, Z = (n, i) => ye(n, Ie(i));
|
|
13
|
+
var P = (n, i, l) => new Promise((f, v) => {
|
|
14
|
+
var q = (g) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
v(
|
|
16
|
+
S(l.next(g));
|
|
17
|
+
} catch (C) {
|
|
18
|
+
v(C);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, k = (g) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
v(
|
|
22
|
+
S(l.throw(g));
|
|
23
|
+
} catch (C) {
|
|
24
|
+
v(C);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, S = (g) => g.done ? f(g.value) : Promise.resolve(g.value).then(q, k);
|
|
27
|
+
S((l = l.apply(n, i)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsxs as
|
|
30
|
-
import { useState as h, useRef as
|
|
31
|
-
import { Form as M, Collapse as
|
|
29
|
+
import { jsxs as p, jsx as a, Fragment as ve } from "react/jsx-runtime";
|
|
30
|
+
import { useState as h, useRef as ke, useContext as Se, useEffect as N } from "react";
|
|
31
|
+
import { Form as M, Collapse as ee, Input as K, Button as Ce, message as w, notification as D } from "antd";
|
|
32
32
|
import { PromptVariableType as y } from "@glodon-aiot/apis";
|
|
33
|
-
import { v4 as
|
|
34
|
-
import
|
|
35
|
-
import
|
|
33
|
+
import { v4 as Pe } from "uuid";
|
|
34
|
+
import pe from "../../../context.mjs";
|
|
35
|
+
import we from "../../../components/KnowledgeList/KnowledgeSelect/index.mjs";
|
|
36
36
|
import "../../../packages/react-components/dist/es/index.mjs";
|
|
37
37
|
import Ne from "../../../Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs";
|
|
38
38
|
import Te from "../../../node_modules/moment/dist/moment.mjs";
|
|
39
39
|
/* empty css */import { fetchEventSource as Ae } from "../fetchEventSource/fetch.mjs";
|
|
40
40
|
import { Markdown as Ve } from "../../../packages/react-components/dist/es/components/Markdown/index.mjs";
|
|
41
41
|
const {
|
|
42
|
-
Panel:
|
|
43
|
-
} =
|
|
42
|
+
Panel: _
|
|
43
|
+
} = ee, Ee = ({
|
|
44
44
|
application: n,
|
|
45
|
-
sessionId:
|
|
45
|
+
sessionId: i,
|
|
46
46
|
docViewerUrl: l
|
|
47
47
|
}) => {
|
|
48
|
-
const
|
|
49
|
-
service:
|
|
48
|
+
const f = n.id, [v, q] = h(""), [k, S] = h(""), [g, C] = h(), [L, T] = h(!1), H = ke(null), [O, te] = h([]), [A, Y] = h([]), [se, $] = h(0), [j, E] = h(), [c, R] = h(), [z] = M.useForm(), [U, re] = h({}), [B, ne] = h({}), [oe, ae] = h(0), {
|
|
49
|
+
service: u,
|
|
50
50
|
agentClient: I,
|
|
51
|
-
popupContainer:
|
|
52
|
-
token:
|
|
53
|
-
apiUrl:
|
|
54
|
-
} =
|
|
55
|
-
const
|
|
56
|
-
messageId:
|
|
51
|
+
popupContainer: x,
|
|
52
|
+
token: ce,
|
|
53
|
+
apiUrl: le
|
|
54
|
+
} = Se(pe), ie = (e, o, d, t) => {
|
|
55
|
+
const s = {
|
|
56
|
+
messageId: Pe(),
|
|
57
57
|
content: "",
|
|
58
58
|
role: 1,
|
|
59
59
|
sessionId: "",
|
|
@@ -61,16 +61,16 @@ const {
|
|
|
61
61
|
messageTime: "",
|
|
62
62
|
llmModel: "",
|
|
63
63
|
searchReference: []
|
|
64
|
-
},
|
|
64
|
+
}, r = Z(V({}, d), {
|
|
65
65
|
stream: !0
|
|
66
66
|
});
|
|
67
|
-
Ae(`${
|
|
67
|
+
Ae(`${le}/chat/v2/chat?applicationId=${e}&sessionId=${o}`, {
|
|
68
68
|
method: "POST",
|
|
69
69
|
headers: {
|
|
70
|
-
Authorization: `Bearer ${
|
|
70
|
+
Authorization: `Bearer ${ce}`,
|
|
71
71
|
"Content-Type": "application/json"
|
|
72
72
|
},
|
|
73
|
-
body: JSON.stringify(
|
|
73
|
+
body: JSON.stringify(r),
|
|
74
74
|
openWhenHidden: !0,
|
|
75
75
|
onopen(m) {
|
|
76
76
|
return console.log("onopen"), m.ok && t != null && t.onopen && t.onopen(), Promise.resolve();
|
|
@@ -79,35 +79,43 @@ const {
|
|
|
79
79
|
if (!m.id && !m.data && !m.event && !m.retry)
|
|
80
80
|
return;
|
|
81
81
|
if (!m.data.includes('{"code": ')) {
|
|
82
|
-
|
|
82
|
+
s.content = s.content + m.data;
|
|
83
83
|
const F = {
|
|
84
|
-
content:
|
|
84
|
+
content: s.content,
|
|
85
85
|
role: 1,
|
|
86
|
-
reference:
|
|
87
|
-
messageId:
|
|
88
|
-
sessionId:
|
|
86
|
+
reference: s.reference,
|
|
87
|
+
messageId: s.messageId,
|
|
88
|
+
sessionId: o,
|
|
89
89
|
messageTime: Te(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
90
90
|
searchReference: []
|
|
91
91
|
};
|
|
92
92
|
return (t == null ? void 0 : t.onmessage) && t.onmessage(F);
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
94
|
+
const b = JSON.parse(m.data);
|
|
95
|
+
if (s.reference = b.data.reference, s.messageTime = b.data.messageTime, s.messageId = b.data.messageId, s.llmModel = b.data.llmModel, s.content = b.data.content, s.code = b.code, b.code === 200) {
|
|
96
96
|
const F = {
|
|
97
|
-
code:
|
|
98
|
-
content:
|
|
97
|
+
code: s.code,
|
|
98
|
+
content: s.content,
|
|
99
99
|
role: 1,
|
|
100
|
-
reference:
|
|
101
|
-
messageId:
|
|
102
|
-
sessionId:
|
|
103
|
-
messageTime:
|
|
100
|
+
reference: s.reference,
|
|
101
|
+
messageId: s.messageId,
|
|
102
|
+
sessionId: o,
|
|
103
|
+
messageTime: s.messageTime,
|
|
104
104
|
searchReference: []
|
|
105
105
|
};
|
|
106
106
|
t != null && t.onmessage && t.onmessage(F);
|
|
107
|
-
} else
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
} else {
|
|
108
|
+
D.config({
|
|
109
|
+
getContainer: () => (x == null ? void 0 : x.current) || document.body,
|
|
110
|
+
prefixCls: "gbot-notification"
|
|
111
|
+
}), D.error({
|
|
112
|
+
message: b.message
|
|
113
|
+
}), D.config({
|
|
114
|
+
getContainer: void 0,
|
|
115
|
+
prefixCls: "gbot-notification"
|
|
110
116
|
});
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
111
119
|
},
|
|
112
120
|
onerror() {
|
|
113
121
|
t != null && t.onerror && t.onerror();
|
|
@@ -115,13 +123,13 @@ const {
|
|
|
115
123
|
onclose() {
|
|
116
124
|
console.log("onclose");
|
|
117
125
|
const m = {
|
|
118
|
-
code:
|
|
119
|
-
content:
|
|
126
|
+
code: s.code,
|
|
127
|
+
content: s.content,
|
|
120
128
|
role: 1,
|
|
121
|
-
reference:
|
|
122
|
-
messageId:
|
|
123
|
-
sessionId:
|
|
124
|
-
messageTime:
|
|
129
|
+
reference: s.reference,
|
|
130
|
+
messageId: s.messageId,
|
|
131
|
+
sessionId: o,
|
|
132
|
+
messageTime: s.messageTime,
|
|
125
133
|
comment: {
|
|
126
134
|
isAgree: 0
|
|
127
135
|
},
|
|
@@ -137,112 +145,116 @@ const {
|
|
|
137
145
|
const e = n.arrange;
|
|
138
146
|
if (!(e != null && e.length))
|
|
139
147
|
return;
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const t =
|
|
143
|
-
|
|
148
|
+
const d = e[0].knowledges || [];
|
|
149
|
+
te(d), $(d.length);
|
|
150
|
+
const t = d.map((s) => s.id);
|
|
151
|
+
Y(t);
|
|
144
152
|
}, [n]), N(() => {
|
|
145
153
|
if (!(n != null && n.id) || !I)
|
|
146
154
|
return;
|
|
147
155
|
const e = I.questionContextMaxLength || 4e3;
|
|
148
156
|
ae(e), de();
|
|
149
157
|
}, [n, I]);
|
|
150
|
-
const de = () =>
|
|
151
|
-
if (!
|
|
158
|
+
const de = () => P(void 0, null, function* () {
|
|
159
|
+
if (!u || !f)
|
|
152
160
|
return;
|
|
153
|
-
const e = yield
|
|
161
|
+
const e = yield u.postApplicationIdSession({
|
|
154
162
|
name: "AI 会话",
|
|
155
|
-
applicationId:
|
|
163
|
+
applicationId: f
|
|
156
164
|
});
|
|
157
|
-
|
|
165
|
+
E(e);
|
|
158
166
|
});
|
|
159
167
|
N(() => {
|
|
160
|
-
!
|
|
168
|
+
!f || !u || Promise.all([u.getApplicationIdPromptVariables(f, {
|
|
161
169
|
type: y.User,
|
|
162
170
|
status: 1
|
|
163
|
-
}),
|
|
171
|
+
}), u.getApplicationIdPromptVariables(f, {
|
|
164
172
|
type: y.System,
|
|
165
173
|
status: 1
|
|
166
|
-
})]).then(([e,
|
|
167
|
-
const
|
|
168
|
-
id:
|
|
169
|
-
key:
|
|
170
|
-
name:
|
|
174
|
+
})]).then(([e, o]) => {
|
|
175
|
+
const s = [...e, ...o].filter((r) => !(r.type === y.User && r.key === "query") && !(r.type === y.System && r.key === "datetime")).map((r) => ({
|
|
176
|
+
id: r.id,
|
|
177
|
+
key: r.key,
|
|
178
|
+
name: r.name,
|
|
171
179
|
value: "",
|
|
172
|
-
type:
|
|
180
|
+
type: r.type
|
|
173
181
|
}));
|
|
174
|
-
R(
|
|
182
|
+
R(s);
|
|
175
183
|
});
|
|
176
|
-
}, [
|
|
184
|
+
}, [u, f]), N(() => {
|
|
177
185
|
if (!c)
|
|
178
186
|
return;
|
|
179
|
-
const e = c.filter((
|
|
180
|
-
e == null || e.map((
|
|
181
|
-
|
|
187
|
+
const e = c.filter((s) => s.type === y.User), o = c.filter((s) => s.type === y.System), d = {};
|
|
188
|
+
e == null || e.map((s) => {
|
|
189
|
+
s.key && (d[s.key] = s.value);
|
|
182
190
|
});
|
|
183
191
|
const t = {};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}),
|
|
187
|
-
userPrompts:
|
|
192
|
+
o == null || o.map((s) => {
|
|
193
|
+
s.key && (t[s.key] = s.value);
|
|
194
|
+
}), z.setFieldsValue({
|
|
195
|
+
userPrompts: d,
|
|
188
196
|
systemPrompts: t
|
|
189
|
-
}), re(
|
|
197
|
+
}), re(d), ne(t);
|
|
190
198
|
}, [c]);
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
value:
|
|
199
|
+
const me = (e, o) => P(void 0, null, function* () {
|
|
200
|
+
!j || !f || !u || (yield u.patchApplicationIdSessionpromptVariablesId(f, j.id, e, {
|
|
201
|
+
value: o
|
|
194
202
|
}));
|
|
195
|
-
}),
|
|
203
|
+
}), fe = (e) => {
|
|
196
204
|
q(e.target.value);
|
|
197
|
-
},
|
|
198
|
-
if (!
|
|
205
|
+
}, ge = () => P(void 0, null, function* () {
|
|
206
|
+
if (!f || !u || !I)
|
|
199
207
|
return;
|
|
200
208
|
T(!0);
|
|
201
209
|
for (const t in U)
|
|
202
|
-
U[t] || (
|
|
203
|
-
getContainer: () => (
|
|
204
|
-
|
|
205
|
-
|
|
210
|
+
U[t] || (w.config({
|
|
211
|
+
getContainer: () => (x == null ? void 0 : x.current) || document.body,
|
|
212
|
+
prefixCls: "gbot-message"
|
|
213
|
+
}), w.error("变量值不能为空"), w.config({
|
|
214
|
+
getContainer: void 0,
|
|
215
|
+
prefixCls: "gbot-message"
|
|
206
216
|
}));
|
|
207
217
|
for (const t in B)
|
|
208
|
-
B[t] || (
|
|
209
|
-
getContainer: () => (
|
|
210
|
-
|
|
211
|
-
|
|
218
|
+
B[t] || (w.config({
|
|
219
|
+
getContainer: () => (x == null ? void 0 : x.current) || document.body,
|
|
220
|
+
prefixCls: "gbot-message"
|
|
221
|
+
}), w.error("变量值不能为空"), w.config({
|
|
222
|
+
getContainer: void 0,
|
|
223
|
+
prefixCls: "gbot-message"
|
|
212
224
|
}));
|
|
213
|
-
const e = yield
|
|
225
|
+
const e = yield u.postApplicationIdSession({
|
|
214
226
|
name: "AI 会话",
|
|
215
|
-
applicationId:
|
|
227
|
+
applicationId: f
|
|
216
228
|
});
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
yield
|
|
229
|
+
E(e);
|
|
230
|
+
const o = A == null ? void 0 : A.map((t) => t.toString());
|
|
231
|
+
yield u.getApplicationIdSessionIdPromptVariables(f, e.id).then((t) => P(void 0, null, function* () {
|
|
220
232
|
if (!c)
|
|
221
233
|
return;
|
|
222
|
-
const
|
|
223
|
-
const m = c.filter((
|
|
224
|
-
return
|
|
234
|
+
const s = t.filter((r) => r.key !== "query").map((r) => {
|
|
235
|
+
const m = c.filter((b) => b.key === r.key);
|
|
236
|
+
return r.value = m[0].value, r;
|
|
225
237
|
});
|
|
226
|
-
yield Promise.all(
|
|
238
|
+
yield Promise.all(s.map((r) => me(r.id, r.value))), R(s);
|
|
227
239
|
})).catch((t) => {
|
|
228
240
|
console.log(t), T(!1);
|
|
229
241
|
});
|
|
230
|
-
const
|
|
242
|
+
const d = {
|
|
231
243
|
content: v,
|
|
232
244
|
chatMode: 1,
|
|
233
|
-
knowledges:
|
|
245
|
+
knowledges: o,
|
|
234
246
|
promptVariables: U,
|
|
235
247
|
systemPromptVariables: B
|
|
236
248
|
};
|
|
237
|
-
|
|
249
|
+
ie(f, e.id, d, {
|
|
238
250
|
onmessage: (t) => {
|
|
239
|
-
|
|
251
|
+
C(void 0), S(t.content);
|
|
240
252
|
},
|
|
241
|
-
onclose: (t) =>
|
|
253
|
+
onclose: (t) => P(void 0, null, function* () {
|
|
242
254
|
if (T(!1), t.code == 200) {
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
t.reference = t.reference.map((
|
|
255
|
+
S(t.content);
|
|
256
|
+
const s = yield Promise.all(t.reference.map((r) => u.getKnowledgeIdFileId(r.knowledgeId, r.docId)));
|
|
257
|
+
t.reference = t.reference.map((r, m) => V(V({}, r), s[m])), C(t);
|
|
246
258
|
}
|
|
247
259
|
}),
|
|
248
260
|
onerror: () => {
|
|
@@ -251,25 +263,25 @@ const {
|
|
|
251
263
|
});
|
|
252
264
|
});
|
|
253
265
|
N(() => {
|
|
254
|
-
if (!
|
|
266
|
+
if (!k)
|
|
255
267
|
return;
|
|
256
|
-
const e =
|
|
268
|
+
const e = H.current;
|
|
257
269
|
e && (e.scrollTop = e.scrollHeight);
|
|
258
|
-
}, [
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
c && (c.map((
|
|
263
|
-
|
|
270
|
+
}, [k]);
|
|
271
|
+
const ue = (e) => {
|
|
272
|
+
Y(e), $(e.length);
|
|
273
|
+
}, J = (e, o) => {
|
|
274
|
+
c && (c.map((d) => {
|
|
275
|
+
d.id === e && (d.value = o.target.value);
|
|
264
276
|
}), R([...c]));
|
|
265
|
-
},
|
|
266
|
-
return /* @__PURE__ */
|
|
277
|
+
}, W = (c == null ? void 0 : c.filter((e) => e.type === y.System)) || [], G = (c == null ? void 0 : c.filter((e) => e.type === y.User)) || [];
|
|
278
|
+
return /* @__PURE__ */ p("div", {
|
|
267
279
|
className: "text-main",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
280
|
+
children: [/* @__PURE__ */ p("div", {
|
|
269
281
|
className: "text-left-sider",
|
|
270
|
-
children: [!!(c != null && c.length) && /* @__PURE__ */
|
|
282
|
+
children: [!!(c != null && c.length) && /* @__PURE__ */ a(M, {
|
|
271
283
|
autoComplete: "off",
|
|
272
|
-
form:
|
|
284
|
+
form: z,
|
|
273
285
|
labelWrap: !0,
|
|
274
286
|
labelAlign: "left",
|
|
275
287
|
labelCol: {
|
|
@@ -278,14 +290,14 @@ const {
|
|
|
278
290
|
}
|
|
279
291
|
},
|
|
280
292
|
className: "prompt-form",
|
|
281
|
-
children: /* @__PURE__ */
|
|
293
|
+
children: /* @__PURE__ */ p(ee, {
|
|
282
294
|
bordered: !1,
|
|
283
295
|
ghost: !0,
|
|
284
296
|
className: "prompt-variables-collapse",
|
|
285
297
|
defaultActiveKey: [y.System, y.User],
|
|
286
|
-
children: [
|
|
298
|
+
children: [W.length && /* @__PURE__ */ a(_, {
|
|
287
299
|
header: "角色设定变量",
|
|
288
|
-
children:
|
|
300
|
+
children: W.map((e) => /* @__PURE__ */ a(M.Item, {
|
|
289
301
|
label: e.name,
|
|
290
302
|
name: ["systemPrompts", e.key],
|
|
291
303
|
style: {
|
|
@@ -295,15 +307,15 @@ const {
|
|
|
295
307
|
required: !0,
|
|
296
308
|
message: "请输入"
|
|
297
309
|
}],
|
|
298
|
-
children: /* @__PURE__ */
|
|
310
|
+
children: /* @__PURE__ */ a(K, {
|
|
299
311
|
placeholder: "请输入",
|
|
300
312
|
maxLength: I == null ? void 0 : I.questionContextMaxLength,
|
|
301
|
-
onBlur: (
|
|
313
|
+
onBlur: (o) => J(e.id, o)
|
|
302
314
|
})
|
|
303
315
|
}, e.key))
|
|
304
|
-
}, y.System),
|
|
316
|
+
}, y.System), G.length && /* @__PURE__ */ a(_, {
|
|
305
317
|
header: "用户指令变量",
|
|
306
|
-
children:
|
|
318
|
+
children: G.map((e) => /* @__PURE__ */ a(M.Item, {
|
|
307
319
|
label: e.name,
|
|
308
320
|
name: ["userPrompts", e.key],
|
|
309
321
|
style: {
|
|
@@ -313,74 +325,74 @@ const {
|
|
|
313
325
|
required: !0,
|
|
314
326
|
message: "请输入"
|
|
315
327
|
}],
|
|
316
|
-
children: /* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ a(K, {
|
|
317
329
|
placeholder: "请输入",
|
|
318
330
|
maxLength: I == null ? void 0 : I.questionContextMaxLength,
|
|
319
|
-
onBlur: (
|
|
331
|
+
onBlur: (o) => J(e.id, o)
|
|
320
332
|
})
|
|
321
333
|
}, e.key))
|
|
322
334
|
}, y.User)]
|
|
323
335
|
})
|
|
324
|
-
}), /* @__PURE__ */
|
|
336
|
+
}), /* @__PURE__ */ p("div", {
|
|
325
337
|
className: "sider-header",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ a("span", {
|
|
327
339
|
className: "header-title",
|
|
328
340
|
children: "文本生成输入"
|
|
329
|
-
}),
|
|
341
|
+
}), O.length !== 0 && /* @__PURE__ */ a(we, {
|
|
330
342
|
checkedValues: A,
|
|
331
|
-
currKnowledgeList:
|
|
332
|
-
selectCount:
|
|
333
|
-
onSelectChange:
|
|
343
|
+
currKnowledgeList: O,
|
|
344
|
+
selectCount: se,
|
|
345
|
+
onSelectChange: ue,
|
|
334
346
|
disabled: !1
|
|
335
347
|
})]
|
|
336
|
-
}), /* @__PURE__ */
|
|
348
|
+
}), /* @__PURE__ */ a("div", {
|
|
337
349
|
className: "sider-main",
|
|
338
|
-
children: /* @__PURE__ */
|
|
350
|
+
children: /* @__PURE__ */ p("div", {
|
|
339
351
|
className: "sider-text",
|
|
340
|
-
children: [/* @__PURE__ */
|
|
352
|
+
children: [/* @__PURE__ */ a(K.TextArea, {
|
|
341
353
|
style: {
|
|
342
354
|
height: "100%",
|
|
343
355
|
resize: "none"
|
|
344
356
|
},
|
|
345
357
|
placeholder: "请输入你的问题,通过shift+enter换行",
|
|
346
|
-
maxLength:
|
|
358
|
+
maxLength: oe,
|
|
347
359
|
showCount: !0,
|
|
348
360
|
bordered: !1,
|
|
349
|
-
onChange:
|
|
361
|
+
onChange: fe,
|
|
350
362
|
value: v,
|
|
351
363
|
className: "left-input"
|
|
352
|
-
}), /* @__PURE__ */
|
|
364
|
+
}), /* @__PURE__ */ a(Ce, {
|
|
353
365
|
type: "primary",
|
|
354
366
|
disabled: !v || L,
|
|
355
|
-
onClick:
|
|
367
|
+
onClick: ge,
|
|
356
368
|
className: "sider-btn",
|
|
357
369
|
loading: L,
|
|
358
370
|
children: L ? "生成中" : "确认生成"
|
|
359
371
|
})]
|
|
360
372
|
})
|
|
361
373
|
})]
|
|
362
|
-
}), /* @__PURE__ */
|
|
374
|
+
}), /* @__PURE__ */ a("div", {
|
|
363
375
|
className: "text-right-sider",
|
|
364
|
-
children: /* @__PURE__ */
|
|
376
|
+
children: /* @__PURE__ */ a("div", {
|
|
365
377
|
className: "sider-main",
|
|
366
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ a("div", {
|
|
367
379
|
className: "sider-text",
|
|
368
|
-
ref:
|
|
369
|
-
children:
|
|
370
|
-
children: [/* @__PURE__ */
|
|
371
|
-
children:
|
|
372
|
-
}),
|
|
380
|
+
ref: H,
|
|
381
|
+
children: k ? /* @__PURE__ */ p(ve, {
|
|
382
|
+
children: [/* @__PURE__ */ a(Ve, {
|
|
383
|
+
children: k
|
|
384
|
+
}), g && (g == null ? void 0 : g.reference.length) !== 0 && /* @__PURE__ */ a("div", {
|
|
373
385
|
style: {
|
|
374
386
|
marginTop: 16
|
|
375
387
|
},
|
|
376
|
-
children: /* @__PURE__ */
|
|
377
|
-
history:
|
|
388
|
+
children: /* @__PURE__ */ a(Ne, {
|
|
389
|
+
history: g,
|
|
378
390
|
docViewerUrl: l
|
|
379
391
|
})
|
|
380
392
|
})]
|
|
381
|
-
}) : /* @__PURE__ */
|
|
393
|
+
}) : /* @__PURE__ */ a("div", {
|
|
382
394
|
className: "text-pannel",
|
|
383
|
-
children: /* @__PURE__ */
|
|
395
|
+
children: /* @__PURE__ */ a("span", {
|
|
384
396
|
children: "请在左侧输入需要 AI 生成的内容"
|
|
385
397
|
})
|
|
386
398
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
1
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useState as h, useContext as v, useEffect as y } from "react";
|
|
3
3
|
/* empty css */import { Space as N, message as a, Typography as p } from "antd";
|
|
4
4
|
import r from "classnames";
|
|
@@ -11,47 +11,49 @@ const j = (f) => {
|
|
|
11
11
|
item: e,
|
|
12
12
|
isRecommendClearing: g,
|
|
13
13
|
isOnlyQuestion: i,
|
|
14
|
-
question:
|
|
15
|
-
setQuestion:
|
|
16
|
-
onItemClick:
|
|
17
|
-
} = f, [n,
|
|
14
|
+
question: t,
|
|
15
|
+
setQuestion: m,
|
|
16
|
+
onItemClick: o
|
|
17
|
+
} = f, [n, c] = h(!1), {
|
|
18
18
|
popupContainer: l
|
|
19
19
|
} = v(x);
|
|
20
20
|
return y(() => {
|
|
21
|
-
e && (!e.icon && !e.file.url && !e.name ?
|
|
21
|
+
e && (!e.icon && !e.file.url && !e.name ? c(!0) : c(!1));
|
|
22
22
|
}, [e]), /* @__PURE__ */ d(N, {
|
|
23
23
|
direction: "vertical",
|
|
24
24
|
size: i || !i && n ? 0 : 4,
|
|
25
25
|
className: r({
|
|
26
26
|
"question-pannel": !0,
|
|
27
|
-
"question-pannel__active": (
|
|
27
|
+
"question-pannel__active": (t == null ? void 0 : t.id) === e.id,
|
|
28
28
|
"multiline-question-pannel": !i && n
|
|
29
29
|
}),
|
|
30
30
|
onClick: () => {
|
|
31
31
|
if (g) {
|
|
32
32
|
a.config({
|
|
33
|
-
getContainer: () => (l == null ? void 0 : l.current) || document.body
|
|
33
|
+
getContainer: () => (l == null ? void 0 : l.current) || document.body,
|
|
34
|
+
prefixCls: "gbot-message"
|
|
34
35
|
}), a.error("请稍后"), a.config({
|
|
35
|
-
getContainer: void 0
|
|
36
|
+
getContainer: void 0,
|
|
37
|
+
prefixCls: "gbot-message"
|
|
36
38
|
});
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
|
-
(
|
|
41
|
+
(t == null ? void 0 : t.id) === e.id ? (m(void 0), o == null || o(void 0)) : (m(e), o == null || o(e));
|
|
40
42
|
},
|
|
41
43
|
children: [/* @__PURE__ */ d("div", {
|
|
42
44
|
className: r({
|
|
43
45
|
"question-top": !0,
|
|
44
46
|
"not-have-top": i || !i && n
|
|
45
47
|
}),
|
|
46
|
-
children: [!!(e != null && e.icon) && /* @__PURE__ */
|
|
48
|
+
children: [!!(e != null && e.icon) && /* @__PURE__ */ s("div", {
|
|
47
49
|
className: "question-top-tip",
|
|
48
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ s("img", {
|
|
49
51
|
src: e.icon,
|
|
50
52
|
alt: ""
|
|
51
53
|
})
|
|
52
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ s("div", {
|
|
53
55
|
className: "question-top-title",
|
|
54
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ s(p.Paragraph, {
|
|
55
57
|
style: {
|
|
56
58
|
margin: 0,
|
|
57
59
|
width: "100%"
|
|
@@ -62,22 +64,22 @@ const j = (f) => {
|
|
|
62
64
|
},
|
|
63
65
|
children: e.name
|
|
64
66
|
})
|
|
65
|
-
}), /* @__PURE__ */
|
|
67
|
+
}), /* @__PURE__ */ s("div", {
|
|
66
68
|
className: r({
|
|
67
69
|
"question-top-type": !0,
|
|
68
70
|
"question-only-plus-file": !i && !e.icon && !e.name
|
|
69
71
|
}),
|
|
70
|
-
children: !!((u = e.file) != null && u.url) && /* @__PURE__ */
|
|
72
|
+
children: !!((u = e.file) != null && u.url) && /* @__PURE__ */ s("img", {
|
|
71
73
|
className: "file-icon",
|
|
72
74
|
src: C[q(e.file.url) || ""]
|
|
73
75
|
})
|
|
74
76
|
})]
|
|
75
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ s("div", {
|
|
76
78
|
className: r({
|
|
77
79
|
"question-bottom": !0,
|
|
78
80
|
"multiline-question": !i && n
|
|
79
81
|
}),
|
|
80
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ s(p.Paragraph, {
|
|
81
83
|
style: {
|
|
82
84
|
margin: 0,
|
|
83
85
|
width: "100%"
|