@glodon-aiot/agent-cli-ui 3.3.1-beta.1 → 3.3.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  };