@glodon-aiot/agent-cli-ui 3.3.1 → 3.3.2-beta.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.
@@ -1,72 +1,72 @@
1
1
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { memo as u, useContext as re, useState as ae } from "react";
2
+ import { memo as u, useContext as oe, useState as de } from "react";
3
3
  import d from "./InputProgress/index.mjs";
4
- import oe from "./SessionRefer/index.mjs";
5
- import de from "./SessionAction/index.mjs";
6
- import { IHistoryRole as H, IThinkingStatus as D } from "@glodon-aiot/apis";
7
- import ce from "./FileItem/index.mjs";
8
- import { Popover as pe, Space as V, Button as W, Row as me, Col as ue, Collapse as G, Divider as he, message as y } from "antd";
9
- import ge from "./SearchReference/index.mjs";
4
+ import ce from "./SessionRefer/index.mjs";
5
+ import pe from "./SessionAction/index.mjs";
6
+ import { IHistoryRole as V, IThinkingStatus as W } from "@glodon-aiot/apis";
7
+ import me from "./FileItem/index.mjs";
8
+ import { Popover as ue, Space as G, Button as K, Row as he, Col as ge, Collapse as X, Divider as Ne, message as L } from "antd";
9
+ import fe from "./SearchReference/index.mjs";
10
10
  /* empty css */import "../../../packages/react-components/dist/es/index.mjs";
11
- import Ne from "classnames";
11
+ import Ce from "classnames";
12
12
  import c from "../../../components/Iconfont/index.mjs";
13
- import { CheckOutlined as K, CloseOutlined as X, LoadingOutlined as fe } from "@ant-design/icons";
13
+ import { CheckOutlined as Y, CloseOutlined as Z, LoadingOutlined as Le } from "@ant-design/icons";
14
14
  import p from "../../../components/JsonDisplay/index.mjs";
15
- import Le from "../../../context.mjs";
16
- import ye from "./SessionRelated/index.mjs";
17
- import Ce from "copy-to-clipboard";
18
- import { escapeSlash as ve } from "../../../utils/index.mjs";
19
- import Re from "../../../assets/think.svg.mjs";
20
- import { Markdown as Se } from "../../../packages/react-components/dist/es/components/Markdown/index.mjs";
21
- const be = (o) => {
15
+ import ye from "../../../context.mjs";
16
+ import ve from "./SessionRelated/index.mjs";
17
+ import Re from "copy-to-clipboard";
18
+ import { escapeSlash as Se } from "../../../utils/index.mjs";
19
+ import be from "../../../assets/think.svg.mjs";
20
+ import { Markdown as Ee } from "../../../packages/react-components/dist/es/components/Markdown/index.mjs";
21
+ const ke = (o) => {
22
22
  if (!o)
23
23
  return o;
24
24
  try {
25
25
  return JSON.parse(o);
26
- } catch (l) {
26
+ } catch (i) {
27
27
  return o;
28
28
  }
29
- }, Ee = u(ge), Y = u(oe), C = u(Se), ke = u(ce), m = (o) => {
29
+ }, Te = u(fe), $ = u(ce), y = u(Ee), Ae = u(me), m = (o) => {
30
30
  if (!o)
31
31
  return !1;
32
32
  try {
33
- const l = JSON.parse(o);
34
- return !(l != null && l.code && (l.code < 200 || l.code > 300));
35
- } catch (l) {
33
+ const i = JSON.parse(o);
34
+ return !(i != null && i.code && (i.code < 200 || i.code > 300));
35
+ } catch (i) {
36
36
  return !0;
37
37
  }
38
- }, Z = (o) => {
38
+ }, ee = (o) => {
39
39
  var n;
40
- const l = JSON.parse(JSON.stringify(o)) || [], a = (n = l == null ? void 0 : l.pop()) == null ? void 0 : n.pop();
40
+ const i = JSON.parse(JSON.stringify(o)) || [], a = (n = i == null ? void 0 : i.pop()) == null ? void 0 : n.pop();
41
41
  return a ? (a == null ? void 0 : a.type) === "BEFORE_CALL" || (a == null ? void 0 : a.type) === "FUNCTION_CALL" : !1;
42
- }, Ke = (o) => {
42
+ }, Ye = (o) => {
43
43
  var b, E, k, T, A, O, x, F, _, I;
44
44
  const {
45
- application: l,
45
+ application: i,
46
46
  currentSession: a,
47
47
  history: n,
48
48
  isLastHistory: h,
49
- onRelatedClick: $,
50
- onAgainClick: ee,
51
- isLoading: Te,
49
+ onRelatedClick: ne,
50
+ onAgainClick: te,
51
+ isLoading: Oe,
52
52
  docViewerUrl: g,
53
53
  onEditClick: N,
54
- actions: ne = !0
54
+ actions: le = !0
55
55
  } = o, {
56
56
  debug: v,
57
- transform: i,
57
+ transform: l,
58
58
  popupContainer: f
59
- } = re(Le), R = n.role === H.User, S = n.role === H.Robot, {
60
- Panel: te
61
- } = G, [L, ie] = ae(!0), le = () => {
62
- y.config({
59
+ } = oe(ye), R = n.role === V.User, S = n.role === V.Robot, {
60
+ Panel: ie
61
+ } = X, [C, se] = de(!0), re = () => {
62
+ L.config({
63
63
  getContainer: () => (f == null ? void 0 : f.current) || document.body
64
- }), Ce(n.content), y.success("复制成功"), y.config({
64
+ }), Re(n.content), L.success("复制成功"), L.config({
65
65
  getContainer: void 0
66
66
  });
67
67
  };
68
68
  return /* @__PURE__ */ r("div", {
69
- className: Ne({
69
+ className: Ce({
70
70
  "history-item": !0,
71
71
  "history-item__user": R,
72
72
  "history-item__bot": S
@@ -75,30 +75,30 @@ const be = (o) => {
75
75
  className: "history-item-user",
76
76
  children: [/* @__PURE__ */ e("div", {
77
77
  className: "item-user-panel",
78
- children: /* @__PURE__ */ e(pe, {
78
+ children: /* @__PURE__ */ e(ue, {
79
79
  placement: "topLeft",
80
80
  overlayStyle: {
81
81
  padding: 4
82
82
  },
83
83
  overlayClassName: "session-item-overlay-popover",
84
84
  getPopupContainer: (t) => t.parentNode,
85
- content: i != null && i.userEdit || i != null && i.userCopy ? /* @__PURE__ */ r(V, {
85
+ content: l != null && l.userEdit || l != null && l.userCopy ? /* @__PURE__ */ r(G, {
86
86
  className: "item-user-popover",
87
87
  size: 4,
88
- children: [(i == null ? void 0 : i.userEdit) && /* @__PURE__ */ e("div", {
88
+ children: [(l == null ? void 0 : l.userEdit) && /* @__PURE__ */ e("div", {
89
89
  className: "user-pannel-item",
90
90
  onClick: () => N == null ? void 0 : N(n.content),
91
- children: /* @__PURE__ */ e(W, {
91
+ children: /* @__PURE__ */ e(K, {
92
92
  type: "link",
93
93
  size: "small",
94
94
  icon: /* @__PURE__ */ e(c, {
95
95
  type: "icon-bianji2"
96
96
  })
97
97
  })
98
- }), (i == null ? void 0 : i.userCopy) && /* @__PURE__ */ e("div", {
98
+ }), (l == null ? void 0 : l.userCopy) && /* @__PURE__ */ e("div", {
99
99
  className: "user-pannel-item",
100
- onClick: le,
101
- children: /* @__PURE__ */ e(W, {
100
+ onClick: re,
101
+ children: /* @__PURE__ */ e(K, {
102
102
  type: "link",
103
103
  size: "small",
104
104
  icon: /* @__PURE__ */ e(c, {
@@ -114,22 +114,22 @@ const be = (o) => {
114
114
  className: "user-panel-main",
115
115
  children: /* @__PURE__ */ e("span", {
116
116
  className: "item-user-content",
117
- children: /* @__PURE__ */ e(C, {
117
+ children: /* @__PURE__ */ e(y, {
118
118
  showLatex: !1,
119
- children: ve(n.content)
119
+ children: Se(n.content)
120
120
  })
121
121
  })
122
122
  })
123
123
  })
124
124
  }), /* @__PURE__ */ e("div", {
125
125
  className: "item-user-file",
126
- children: /* @__PURE__ */ e(me, {
126
+ children: /* @__PURE__ */ e(he, {
127
127
  gutter: [12, 12],
128
128
  justify: "end",
129
129
  wrap: !0,
130
- children: (b = n.files) == null ? void 0 : b.map((t) => /* @__PURE__ */ e(ue, {
130
+ children: (b = n.files) == null ? void 0 : b.map((t) => /* @__PURE__ */ e(ge, {
131
131
  className: "user-file-col",
132
- children: /* @__PURE__ */ e(ke, {
132
+ children: /* @__PURE__ */ e(Ae, {
133
133
  docViewerUrl: g,
134
134
  currentSession: a,
135
135
  file: t
@@ -141,17 +141,17 @@ const be = (o) => {
141
141
  className: "history-item-bot",
142
142
  children: /* @__PURE__ */ r("div", {
143
143
  className: "bot-content-wrapper",
144
- children: [l.type === 2 && /* @__PURE__ */ r("div", {
144
+ children: [i.type === 2 && /* @__PURE__ */ r("div", {
145
145
  className: "item-bot-plugin",
146
- children: [/* @__PURE__ */ e(G, {
146
+ children: [/* @__PURE__ */ e(X, {
147
147
  ghost: !0,
148
148
  expandIconPosition: "right",
149
- children: (E = n.actions) == null ? void 0 : E.map((t, se) => {
150
- var U, z, j, B, w, M, J, P, Q, q;
151
- return /* @__PURE__ */ r(te, {
149
+ children: (E = n.actions) == null ? void 0 : E.map((t, ae) => {
150
+ var U, z, j, B, w, M, J, P, Q, q, H, D;
151
+ return /* @__PURE__ */ r(ie, {
152
152
  collapsible: v ? "header" : "icon",
153
153
  showArrow: v,
154
- header: /* @__PURE__ */ r(V, {
154
+ header: /* @__PURE__ */ r(G, {
155
155
  size: 8,
156
156
  style: {
157
157
  width: "100%"
@@ -160,30 +160,30 @@ const be = (o) => {
160
160
  className: "bot-plugin-status",
161
161
  children: [(t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && m((U = t.find((s) => s.type === "RESULT")) == null ? void 0 : U.data.result) && /* @__PURE__ */ e("span", {
162
162
  className: "plugin-status-success",
163
- children: /* @__PURE__ */ e(K, {})
163
+ children: /* @__PURE__ */ e(Y, {})
164
164
  }), t[t.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
165
165
  className: "plugin-status-error",
166
- children: /* @__PURE__ */ e(X, {})
166
+ children: /* @__PURE__ */ e(Z, {})
167
167
  }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !m((z = t.find((s) => s.type === "RESULT")) == null ? void 0 : z.data.result) && /* @__PURE__ */ e("span", {
168
168
  className: "plugin-status-error",
169
- children: /* @__PURE__ */ e(X, {})
169
+ children: /* @__PURE__ */ e(Z, {})
170
170
  }), (t[t.length - 1].type === "BEFORE_CALL" || t[t.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
171
171
  className: "plugin-status-loading",
172
- children: /* @__PURE__ */ e(fe, {})
172
+ children: /* @__PURE__ */ e(Le, {})
173
173
  })]
174
174
  }), /* @__PURE__ */ e("span", {
175
175
  className: "bot-plugin-title",
176
- children: (j = t[t.length - 1].data) == null ? void 0 : j.pluginName
176
+ children: ((j = t[t.length - 1].data) == null ? void 0 : j.pluginName) || ((B = t[t.length - 1].data) == null ? void 0 : B.pluginCode)
177
177
  }), /* @__PURE__ */ e("span", {
178
178
  className: "bot-plugin-action",
179
- children: (B = t[t.length - 1].data) == null ? void 0 : B.funcName
179
+ children: ((w = t[t.length - 1].data) == null ? void 0 : w.funcName) || ((M = t[t.length - 1].data) == null ? void 0 : M.funcCode)
180
180
  }), (t[t.length - 1].type === "BEFORE_CALL" || t[t.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
181
181
  className: "bot-plugin-result",
182
182
  children: "执行中"
183
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && m((w = t.find((s) => s.type === "RESULT")) == null ? void 0 : w.data.result) && /* @__PURE__ */ e("span", {
183
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && m((J = t.find((s) => s.type === "RESULT")) == null ? void 0 : J.data.result) && /* @__PURE__ */ e("span", {
184
184
  className: "bot-plugin-result",
185
185
  children: "执行成功"
186
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !m((M = t.find((s) => s.type === "RESULT")) == null ? void 0 : M.data.result) && /* @__PURE__ */ e("span", {
186
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !m((P = t.find((s) => s.type === "RESULT")) == null ? void 0 : P.data.result) && /* @__PURE__ */ e("span", {
187
187
  className: "bot-plugin-result",
188
188
  children: "执行失败"
189
189
  }), t[t.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
@@ -197,7 +197,7 @@ const be = (o) => {
197
197
  }), /* @__PURE__ */ e("div", {
198
198
  className: "bot-plugin-json",
199
199
  children: /* @__PURE__ */ e(p, {
200
- josn: (J = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : J.data.thought
200
+ josn: (Q = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : Q.data.thought
201
201
  })
202
202
  }), /* @__PURE__ */ e("div", {
203
203
  className: "bot-plugin-content",
@@ -205,7 +205,7 @@ const be = (o) => {
205
205
  }), /* @__PURE__ */ e("div", {
206
206
  className: "bot-plugin-json",
207
207
  children: /* @__PURE__ */ e(p, {
208
- josn: (P = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : P.data.parameters
208
+ josn: (q = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : q.data.parameters
209
209
  })
210
210
  }), /* @__PURE__ */ e("div", {
211
211
  className: "bot-plugin-content",
@@ -213,7 +213,7 @@ const be = (o) => {
213
213
  }), /* @__PURE__ */ e("div", {
214
214
  className: "bot-plugin-json",
215
215
  children: /* @__PURE__ */ e(p, {
216
- josn: (Q = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : Q.data.requestBody
216
+ josn: (H = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : H.data.requestBody
217
217
  })
218
218
  }), /* @__PURE__ */ e("div", {
219
219
  className: "bot-plugin-content",
@@ -221,27 +221,27 @@ const be = (o) => {
221
221
  }), /* @__PURE__ */ e("div", {
222
222
  className: "bot-plugin-json",
223
223
  children: /* @__PURE__ */ e(p, {
224
- josn: be((q = t.find((s) => s.type === "RESULT")) == null ? void 0 : q.data.result)
224
+ josn: ke((D = t.find((s) => s.type === "RESULT")) == null ? void 0 : D.data.result)
225
225
  })
226
226
  })]
227
- }, se);
227
+ }, ae);
228
228
  })
229
229
  }), n.isLoading && /* @__PURE__ */ e("div", {
230
230
  className: "history-input-progress",
231
231
  style: {
232
232
  padding: "4px 0"
233
233
  },
234
- children: Z(n.actions) ? null : /* @__PURE__ */ e(d, {
234
+ children: ee(n.actions) ? null : /* @__PURE__ */ e(d, {
235
235
  size: 4,
236
236
  text: "思考中"
237
237
  })
238
238
  })]
239
239
  }), !!((k = n.searchReference) != null && k.length) && /* @__PURE__ */ e("div", {
240
240
  className: "item-bot-net",
241
- children: /* @__PURE__ */ e(Ee, {
241
+ children: /* @__PURE__ */ e(Te, {
242
242
  history: n
243
243
  })
244
- }), (T = n == null ? void 0 : n.reference) != null && T.length && ((A = i == null ? void 0 : i.reference) != null && A.referenceFirst) ? /* @__PURE__ */ e(Y, {
244
+ }), (T = n == null ? void 0 : n.reference) != null && T.length && ((A = l == null ? void 0 : l.reference) != null && A.referenceFirst) ? /* @__PURE__ */ e($, {
245
245
  history: n,
246
246
  docViewerUrl: g
247
247
  }) : null, /* @__PURE__ */ r("div", {
@@ -251,10 +251,10 @@ const be = (o) => {
251
251
  children: [(n == null ? void 0 : n.reasoningContent) && /* @__PURE__ */ r("div", {
252
252
  className: "think-top",
253
253
  onClick: () => {
254
- ie(!L);
254
+ se(!C);
255
255
  },
256
256
  children: [/* @__PURE__ */ e("img", {
257
- src: Re,
257
+ src: be,
258
258
  alt: ""
259
259
  }), (n == null ? void 0 : n.reasoningContent) && !(n != null && n.content) && /* @__PURE__ */ e("span", {
260
260
  children: "我正在推理思考…"
@@ -262,7 +262,7 @@ const be = (o) => {
262
262
  children: ["已完成推理(用时 ", (n == null ? void 0 : n.thinkingSecs) || 0, " 秒)"]
263
263
  }), /* @__PURE__ */ e("span", {
264
264
  className: "think-action",
265
- children: L ? /* @__PURE__ */ e(c, {
265
+ children: C ? /* @__PURE__ */ e(c, {
266
266
  type: "icon-zhankai",
267
267
  style: {
268
268
  fontSize: 16
@@ -274,27 +274,27 @@ const be = (o) => {
274
274
  }
275
275
  })
276
276
  })]
277
- }), !!((O = n == null ? void 0 : n.reasoningContent) != null && O.trim()) && L && /* @__PURE__ */ r("div", {
277
+ }), !!((O = n == null ? void 0 : n.reasoningContent) != null && O.trim()) && C && /* @__PURE__ */ r("div", {
278
278
  className: "think-bottom",
279
279
  children: [/* @__PURE__ */ r("div", {
280
280
  className: "bottom-left",
281
- children: [(n == null ? void 0 : n.thinkingStatus) === D.Start && /* @__PURE__ */ e("div", {
281
+ children: [(n == null ? void 0 : n.thinkingStatus) === W.Start && /* @__PURE__ */ e("div", {
282
282
  className: "thinking"
283
- }), (n == null ? void 0 : n.thinkingStatus) === D.End && /* @__PURE__ */ e("div", {
283
+ }), (n == null ? void 0 : n.thinkingStatus) === W.End && /* @__PURE__ */ e("div", {
284
284
  className: "thinked",
285
- children: /* @__PURE__ */ e(K, {})
285
+ children: /* @__PURE__ */ e(Y, {})
286
286
  })]
287
287
  }), /* @__PURE__ */ e("div", {
288
288
  className: "bottom-right",
289
- children: /* @__PURE__ */ e(C, {
289
+ children: /* @__PURE__ */ e(y, {
290
290
  children: (n == null ? void 0 : n.reasoningContent) || ""
291
291
  })
292
292
  })]
293
293
  })]
294
- }), /* @__PURE__ */ e(C, {
294
+ }), /* @__PURE__ */ e(y, {
295
295
  children: n.content
296
296
  })]
297
- }), (x = n == null ? void 0 : n.reference) != null && x.length && !((F = i == null ? void 0 : i.reference) != null && F.referenceFirst) ? /* @__PURE__ */ e(Y, {
297
+ }), (x = n == null ? void 0 : n.reference) != null && x.length && !((F = l == null ? void 0 : l.reference) != null && F.referenceFirst) ? /* @__PURE__ */ e($, {
298
298
  history: n,
299
299
  docViewerUrl: g
300
300
  }) : null, n.isRelatedQuestion && h ? /* @__PURE__ */ e("div", {
@@ -309,23 +309,23 @@ const be = (o) => {
309
309
  style: {
310
310
  padding: "4px 0"
311
311
  },
312
- children: Z(n.actions) ? null : /* @__PURE__ */ e(d, {
312
+ children: ee(n.actions) ? null : /* @__PURE__ */ e(d, {
313
313
  size: 4,
314
314
  text: "思考中"
315
315
  })
316
- }), l.arrange[0].recommendQuestionOpen && (i == null ? void 0 : i.relate) && h && !!((_ = n.relatedQuesion) != null && _.length) && /* @__PURE__ */ e(ye, {
316
+ }), i.arrange[0].recommendQuestionOpen && (l == null ? void 0 : l.relate) && h && !!((_ = n.relatedQuesion) != null && _.length) && /* @__PURE__ */ e(ve, {
317
317
  relatedQuesion: n.relatedQuesion,
318
- onRelatedClick: $
319
- }), ne && !n.isSensitive && !!n.messageId && /* @__PURE__ */ e(de, {
320
- appId: l.id,
318
+ onRelatedClick: ne
319
+ }), le && !n.isSensitive && !!n.messageId && /* @__PURE__ */ e(pe, {
320
+ appId: i.id,
321
321
  history: n,
322
322
  sessionId: (I = a == null ? void 0 : a.data) == null ? void 0 : I.id,
323
- onAgainClick: ee,
323
+ onAgainClick: te,
324
324
  isLastHistory: h,
325
325
  currentSession: a
326
326
  })]
327
327
  })
328
- }), n.isContext && /* @__PURE__ */ r(he, {
328
+ }), n.isContext && /* @__PURE__ */ r(Ne, {
329
329
  children: [/* @__PURE__ */ e("div", {
330
330
  style: {
331
331
  color: "#84868C",
@@ -343,6 +343,6 @@ const be = (o) => {
343
343
  });
344
344
  };
345
345
  export {
346
- Ke as default,
346
+ Ye as default,
347
347
  m as isResultExec
348
348
  };
@@ -1,85 +1,89 @@
1
- var I = Object.defineProperty;
2
- var h = Object.getOwnPropertySymbols;
3
- var P = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
4
- var y = (n, t, e) => t in n ? I(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, v = (n, t) => {
1
+ var q = Object.defineProperty;
2
+ var y = Object.getOwnPropertySymbols;
3
+ var P = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
4
+ var v = (r, t, e) => t in r ? q(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, g = (r, t) => {
5
5
  for (var e in t || (t = {}))
6
- P.call(t, e) && y(n, e, t[e]);
7
- if (h)
8
- for (var e of h(t))
9
- q.call(t, e) && y(n, e, t[e]);
10
- return n;
6
+ P.call(t, e) && v(r, e, t[e]);
7
+ if (y)
8
+ for (var e of y(t))
9
+ B.call(t, e) && v(r, e, t[e]);
10
+ return r;
11
11
  };
12
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
13
- import { forwardRef as B, useState as S, useContext as b, useImperativeHandle as w, useEffect as g } from "react";
14
- /* empty css */import { Form as p, Space as k, Button as E, Popover as L, Input as j } from "antd";
15
- import A from "../../../context.mjs";
16
- import u from "../../../components/Iconfont/index.mjs";
17
- const z = B((n, t) => {
12
+ import { jsx as n, jsxs as p } from "react/jsx-runtime";
13
+ import { forwardRef as L, useState as S, useContext as b, useImperativeHandle as w, useEffect as k } from "react";
14
+ /* empty css */import { Form as u, Space as C, Button as E, Popover as j, Input as A } from "antd";
15
+ import z from "../../../context.mjs";
16
+ import f from "../../../components/Iconfont/index.mjs";
17
+ const D = L((r, t) => {
18
18
  const {
19
19
  promptVariables: e,
20
- setPromptVariables: f,
21
- currentSession: l,
22
- setCurrentSession: D
23
- } = n, [c] = p.useForm(), [m, C] = S(!0);
24
- b(A), w(t, () => ({
20
+ setPromptVariables: h,
21
+ currentSession: s,
22
+ setCurrentSession: H
23
+ } = r, [c] = u.useForm(), [m, N] = S(!0), {
24
+ agentClient: d,
25
+ depId: M,
26
+ features: R
27
+ } = b(z);
28
+ w(t, () => ({
25
29
  clear() {
26
30
  c.resetFields();
27
31
  }
28
- })), g(() => {
29
- if (!l)
32
+ })), k(() => {
33
+ if (!s)
30
34
  return;
31
35
  const o = () => {
32
- const a = l.promptVariables.filter((i) => i.key !== "query");
33
- f(a.sort((i, x) => i.key.localeCompare(x.key)));
36
+ const a = s.promptVariables.filter((i) => i.key !== "query");
37
+ h(a.sort((i, I) => i.key.localeCompare(I.key)));
34
38
  };
35
- return l.addEventListener("activated", o), () => {
36
- l == null || l.removeEventListener("activated", o);
39
+ return s.addEventListener("activated", o), () => {
40
+ s == null || s.removeEventListener("activated", o);
37
41
  };
38
- }, [l]), g(() => {
42
+ }, [s]), k(() => {
39
43
  if (!e)
40
44
  return;
41
- const o = e == null ? void 0 : e.reduce((s, a) => (s[a.key] = a.value, s), {});
42
- c.setFieldsValue(v({}, o));
45
+ const o = e == null ? void 0 : e.reduce((l, a) => (l[a.key] = a.value, l), {});
46
+ c.setFieldsValue(g({}, o));
43
47
  }, [e]);
44
- const N = (o, s) => {
48
+ const x = (o, l) => {
45
49
  e.map((a) => {
46
- a.id === o && (a.value = s.target.value);
47
- }), f([...e].sort((a, i) => a.key.localeCompare(i.key)));
50
+ a.id === o && (a.value = l.target.value);
51
+ }), h([...e].sort((a, i) => a.key.localeCompare(i.key)));
48
52
  }, F = () => {
49
- C(!m);
53
+ N(!m);
50
54
  };
51
- return e != null && e.length ? /* @__PURE__ */ r("div", {
55
+ return e != null && e.length ? /* @__PURE__ */ n("div", {
52
56
  className: "prompt-setting-panel",
53
- children: /* @__PURE__ */ d("div", {
57
+ children: /* @__PURE__ */ p("div", {
54
58
  className: "agent-prompt",
55
- children: [/* @__PURE__ */ r("div", {
59
+ children: [/* @__PURE__ */ n("div", {
56
60
  className: "prompt-header",
57
- children: /* @__PURE__ */ d(k, {
58
- children: [/* @__PURE__ */ r(E, {
61
+ children: /* @__PURE__ */ p(C, {
62
+ children: [/* @__PURE__ */ n(E, {
59
63
  className: "prompt-action",
60
- icon: m ? /* @__PURE__ */ r(u, {
64
+ icon: m ? /* @__PURE__ */ n(f, {
61
65
  type: "icon-biaoge-shouqi"
62
- }) : /* @__PURE__ */ r(u, {
66
+ }) : /* @__PURE__ */ n(f, {
63
67
  type: "icon-biaoge-zhankai"
64
68
  }),
65
69
  type: "link",
66
70
  onClick: F
67
- }), /* @__PURE__ */ d(k, {
71
+ }), /* @__PURE__ */ p(C, {
68
72
  className: "prompt-title",
69
- children: [/* @__PURE__ */ r("span", {
73
+ children: [/* @__PURE__ */ n("span", {
70
74
  children: "变量输入"
71
- }), /* @__PURE__ */ r(L, {
75
+ }), /* @__PURE__ */ n(j, {
72
76
  placement: "top",
73
77
  overlayClassName: "title-popover",
74
78
  content: "填入变量的值,每次启动新会话时该变量将自动替换提示词中的变量",
75
- children: /* @__PURE__ */ r(u, {
79
+ children: /* @__PURE__ */ n(f, {
76
80
  className: "icon-prompt-question",
77
81
  type: "icon-wenti"
78
82
  })
79
83
  })]
80
84
  })]
81
85
  })
82
- }), m && /* @__PURE__ */ r(p, {
86
+ }), m && /* @__PURE__ */ n(u, {
83
87
  autoComplete: "off",
84
88
  form: c,
85
89
  labelWrap: !0,
@@ -90,7 +94,7 @@ const z = B((n, t) => {
90
94
  }
91
95
  },
92
96
  className: "prompt-form",
93
- children: e == null ? void 0 : e.map((o) => /* @__PURE__ */ r(p.Item, {
97
+ children: e == null ? void 0 : e.map((o) => /* @__PURE__ */ n(u.Item, {
94
98
  label: o.name,
95
99
  name: o.key,
96
100
  style: {
@@ -100,17 +104,17 @@ const z = B((n, t) => {
100
104
  required: !0,
101
105
  message: "请输入"
102
106
  }],
103
- children: /* @__PURE__ */ r(j, {
107
+ children: /* @__PURE__ */ n(A, {
104
108
  placeholder: "请输入",
105
- maxLength: 1e3,
106
- onBlur: (s) => N(o.id, s)
109
+ maxLength: d == null ? void 0 : d.questionContextMaxLength,
110
+ onBlur: (l) => x(o.id, l)
107
111
  })
108
112
  }, o.key))
109
113
  })]
110
114
  })
111
115
  }) : null;
112
116
  });
113
- z.displayName = "PromptSetting";
117
+ D.displayName = "PromptSetting";
114
118
  export {
115
- z as default
119
+ D as default
116
120
  };