@glodon-aiot/agent-cli-ui 3.3.2-beta.9 → 3.3.5-alpha.16

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.
Files changed (54) hide show
  1. package/dist/es/AgentClientUI.mjs +2 -2
  2. package/dist/es/Dialog/AgentChat/PromptSetting/index.mjs +83 -98
  3. package/dist/es/Dialog/AgentChat/index.mjs +254 -253
  4. package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +383 -0
  5. package/dist/es/ReactTextGenerationUI/components/fetchEventSource/fetch.mjs +112 -0
  6. package/dist/es/ReactTextGenerationUI/components/fetchEventSource/parse.mjs +97 -0
  7. package/dist/es/ReactTextGenerationUI/index.mjs +79 -0
  8. package/dist/es/index.mjs +409 -257
  9. package/dist/es/node_modules/moment/dist/moment.mjs +2301 -0
  10. package/dist/es/packages/agent-cli-ui/package.json.mjs +162 -0
  11. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  12. package/dist/es/src/style10.css +1 -1
  13. package/dist/es/src/style11.css +1 -1
  14. package/dist/es/src/style12.css +1 -1
  15. package/dist/es/src/style13.css +1 -1
  16. package/dist/es/src/style14.css +1 -1
  17. package/dist/es/src/style15.css +1 -1
  18. package/dist/es/src/style16.css +1 -1
  19. package/dist/es/src/style17.css +1 -1
  20. package/dist/es/src/style18.css +1 -1
  21. package/dist/es/src/style19.css +1 -1
  22. package/dist/es/src/style2.css +1 -1
  23. package/dist/es/src/style20.css +1 -1
  24. package/dist/es/src/style21.css +1 -1
  25. package/dist/es/src/style22.css +1 -1
  26. package/dist/es/src/style23.css +1 -1
  27. package/dist/es/src/style24.css +1 -1
  28. package/dist/es/src/style25.css +1 -1
  29. package/dist/es/src/style26.css +1 -1
  30. package/dist/es/src/style27.css +1 -1
  31. package/dist/es/src/style28.css +1 -1
  32. package/dist/es/src/style29.css +1 -1
  33. package/dist/es/src/style3.css +1 -1
  34. package/dist/es/src/style30.css +1 -0
  35. package/dist/es/src/style31.css +1 -0
  36. package/dist/es/src/style4.css +1 -1
  37. package/dist/es/src/style5.css +1 -1
  38. package/dist/es/src/style6.css +1 -1
  39. package/dist/es/src/style7.css +1 -1
  40. package/dist/es/src/style8.css +1 -1
  41. package/dist/es/src/style9.css +1 -1
  42. package/dist/lib/index.css +1 -1
  43. package/dist/lib/index.js +67 -56
  44. package/dist/src/ReactTextGenerationUI/components/TextSiders/index.d.ts +21 -0
  45. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/fetch.d.ts +44 -0
  46. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/index.d.ts +1 -0
  47. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/parse.d.ts +36 -0
  48. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +44 -0
  49. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +1 -0
  50. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +36 -0
  51. package/dist/src/ReactTextGenerationUI/index.d.ts +4 -0
  52. package/dist/src/index.d.ts +4 -1
  53. package/dist/src/types.d.ts +3 -2
  54. package/package.json +3 -3
@@ -95,8 +95,8 @@ const ye = (n) => {
95
95
  features: G
96
96
  }),
97
97
  children: [/* @__PURE__ */ s(ne, {
98
- height: i == null ? void 0 : i.height,
99
- width: i == null ? void 0 : i.width,
98
+ height: (i == null ? void 0 : i.height) || "100%",
99
+ width: (i == null ? void 0 : i.width) || "100%",
100
100
  maxConstraints: [document.body.clientWidth - 45],
101
101
  minConstraints: [Number(t == null ? void 0 : t.minWidth)],
102
102
  onResize: Y,
@@ -1,102 +1,87 @@
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
- for (var e in t || (t = {}))
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
- };
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) => {
1
+ import { jsx as n, jsxs as b } from "react/jsx-runtime";
2
+ import { forwardRef as C, useContext as L, useImperativeHandle as S, useEffect as h } from "react";
3
+ /* empty css */import { Form as i, Collapse as v, Input as g } from "antd";
4
+ import { PromptVariableType as a } from "@glodon-aiot/apis";
5
+ import q from "../../../context.mjs";
6
+ const {
7
+ Panel: p
8
+ } = v, B = C((k, P) => {
18
9
  const {
19
- promptVariables: e,
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, () => ({
10
+ promptVariables: t,
11
+ setPromptVariables: d,
12
+ currentSession: o
13
+ } = k, [u] = i.useForm(), {
14
+ agentClient: m
15
+ } = L(q);
16
+ S(P, () => ({
29
17
  clear() {
30
- c.resetFields();
18
+ u.resetFields();
31
19
  }
32
- })), k(() => {
33
- if (!s)
20
+ })), h(() => {
21
+ if (!o)
34
22
  return;
35
- const o = () => {
36
- const a = s.promptVariables.filter((i) => i.key !== "query");
37
- h(a.sort((i, I) => i.key.localeCompare(I.key)));
23
+ const e = () => {
24
+ const r = o.promptVariables.filter((l) => !(l.type === a.User && l.key === "query") && !(l.type === a.System && l.key === "datetime"));
25
+ d(r.sort((l, x) => l.key.localeCompare(x.key)));
38
26
  };
39
- return s.addEventListener("activated", o), () => {
40
- s == null || s.removeEventListener("activated", o);
27
+ return o.addEventListener("activated", e), () => {
28
+ o == null || o.removeEventListener("activated", e);
41
29
  };
42
- }, [s]), k(() => {
43
- if (!e)
30
+ }, [o]), h(() => {
31
+ if (!t)
44
32
  return;
45
- const o = e == null ? void 0 : e.reduce((l, a) => (l[a.key] = a.value, l), {});
46
- c.setFieldsValue(g({}, o));
47
- }, [e]);
48
- const x = (o, l) => {
49
- e.map((a) => {
50
- a.id === o && (a.value = l.target.value);
51
- }), h([...e].sort((a, i) => a.key.localeCompare(i.key)));
52
- }, F = () => {
53
- N(!m);
54
- };
55
- return e != null && e.length ? /* @__PURE__ */ n("div", {
56
- className: "prompt-setting-panel",
57
- children: /* @__PURE__ */ p("div", {
58
- className: "agent-prompt",
59
- children: [/* @__PURE__ */ n("div", {
60
- className: "prompt-header",
61
- children: /* @__PURE__ */ p(C, {
62
- children: [/* @__PURE__ */ n(E, {
63
- className: "prompt-action",
64
- icon: m ? /* @__PURE__ */ n(f, {
65
- type: "icon-biaoge-shouqi"
66
- }) : /* @__PURE__ */ n(f, {
67
- type: "icon-biaoge-zhankai"
68
- }),
69
- type: "link",
70
- onClick: F
71
- }), /* @__PURE__ */ p(C, {
72
- className: "prompt-title",
73
- children: [/* @__PURE__ */ n("span", {
74
- children: "变量输入"
75
- }), /* @__PURE__ */ n(j, {
76
- placement: "top",
77
- overlayClassName: "title-popover",
78
- content: "填入变量的值,每次启动新会话时该变量将自动替换提示词中的变量",
79
- children: /* @__PURE__ */ n(f, {
80
- className: "icon-prompt-question",
81
- type: "icon-wenti"
82
- })
83
- })]
84
- })]
85
- })
86
- }), m && /* @__PURE__ */ n(u, {
87
- autoComplete: "off",
88
- form: c,
89
- labelWrap: !0,
90
- labelAlign: "left",
91
- labelCol: {
33
+ const e = {}, s = {};
34
+ t.forEach((r) => {
35
+ r.type === a.System ? s[r.key] = r.value : e[r.key] = r.value;
36
+ }), u.setFieldsValue({
37
+ userPrompts: e,
38
+ systemPrompts: s
39
+ });
40
+ }, [t]);
41
+ const c = (e, s) => {
42
+ t.map((r) => {
43
+ r.id === e && (r.value = s.target.value);
44
+ }), d([...t].sort((r, l) => r.key.localeCompare(l.key)));
45
+ }, y = (t == null ? void 0 : t.filter((e) => e.type === a.System)) || [], f = (t == null ? void 0 : t.filter((e) => e.type === a.User)) || [];
46
+ return t != null && t.length ? /* @__PURE__ */ n(i, {
47
+ autoComplete: "off",
48
+ form: u,
49
+ labelWrap: !0,
50
+ labelAlign: "left",
51
+ labelCol: {
52
+ style: {
53
+ width: 120
54
+ }
55
+ },
56
+ className: "prompt-form",
57
+ children: /* @__PURE__ */ b(v, {
58
+ bordered: !1,
59
+ ghost: !0,
60
+ className: "prompt-variables-collapse",
61
+ defaultActiveKey: [a.System, a.User],
62
+ children: [y.length && /* @__PURE__ */ n(p, {
63
+ header: "角色设定变量",
64
+ children: y.map((e) => /* @__PURE__ */ n(i.Item, {
65
+ label: e.name,
66
+ name: ["systemPrompts", e.key],
92
67
  style: {
93
- width: 120
94
- }
95
- },
96
- className: "prompt-form",
97
- children: e == null ? void 0 : e.map((o) => /* @__PURE__ */ n(u.Item, {
98
- label: o.name,
99
- name: o.key,
68
+ marginBottom: 8
69
+ },
70
+ rules: [{
71
+ required: !0,
72
+ message: "请输入"
73
+ }],
74
+ children: /* @__PURE__ */ n(g, {
75
+ placeholder: "请输入",
76
+ maxLength: m == null ? void 0 : m.questionContextMaxLength,
77
+ onBlur: (s) => c(e.id, s)
78
+ })
79
+ }, e.key))
80
+ }, a.System), f.length && /* @__PURE__ */ n(p, {
81
+ header: "用户指令变量",
82
+ children: f.map((e) => /* @__PURE__ */ n(i.Item, {
83
+ label: e.name,
84
+ name: ["userPrompts", e.key],
100
85
  style: {
101
86
  marginBottom: 8
102
87
  },
@@ -104,17 +89,17 @@ const D = L((r, t) => {
104
89
  required: !0,
105
90
  message: "请输入"
106
91
  }],
107
- children: /* @__PURE__ */ n(A, {
92
+ children: /* @__PURE__ */ n(g, {
108
93
  placeholder: "请输入",
109
- maxLength: d == null ? void 0 : d.questionContextMaxLength,
110
- onBlur: (l) => x(o.id, l)
94
+ maxLength: m == null ? void 0 : m.questionContextMaxLength,
95
+ onBlur: (s) => c(e.id, s)
111
96
  })
112
- }, o.key))
113
- })]
97
+ }, e.key))
98
+ }, a.User)]
114
99
  })
115
100
  }) : null;
116
101
  });
117
- D.displayName = "PromptSetting";
102
+ B.displayName = "PromptSetting";
118
103
  export {
119
- D as default
104
+ B as default
120
105
  };