@lemoncat7/dsh-partner 1.0.0 → 1.1.6
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/README.md +14 -6
- package/lib/agent-runtime.d.ts +11 -1
- package/lib/agent-runtime.d.ts.map +1 -1
- package/lib/agent-runtime.js +178 -39
- package/lib/agent-runtime.js.map +1 -1
- package/lib/autonomy.d.ts +8 -0
- package/lib/autonomy.d.ts.map +1 -0
- package/lib/autonomy.js +32 -0
- package/lib/autonomy.js.map +1 -0
- package/lib/channel-message.d.ts +23 -0
- package/lib/channel-message.d.ts.map +1 -0
- package/lib/channel-message.js +8 -0
- package/lib/channel-message.js.map +1 -0
- package/lib/channels/manager.d.ts +27 -1
- package/lib/channels/manager.d.ts.map +1 -1
- package/lib/channels/manager.js +222 -15
- package/lib/channels/manager.js.map +1 -1
- package/lib/channels/weixin/api.d.ts +2 -0
- package/lib/channels/weixin/api.d.ts.map +1 -1
- package/lib/channels/weixin/api.js +80 -1
- package/lib/channels/weixin/api.js.map +1 -1
- package/lib/channels/weixin/media.d.ts +4 -0
- package/lib/channels/weixin/media.d.ts.map +1 -0
- package/lib/channels/weixin/media.js +78 -0
- package/lib/channels/weixin/media.js.map +1 -0
- package/lib/channels/weixin/types.d.ts +19 -2
- package/lib/channels/weixin/types.d.ts.map +1 -1
- package/lib/client.js +480 -463
- package/lib/client.js.map +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/workspace-ownership.d.ts +5 -0
- package/lib/workspace-ownership.d.ts.map +1 -0
- package/lib/workspace-ownership.js +18 -0
- package/lib/workspace-ownership.js.map +1 -0
- package/package.json +11 -2
package/lib/client.js
CHANGED
|
@@ -35,32 +35,29 @@ __export(client_exports, {
|
|
|
35
35
|
inject: () => inject
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(client_exports);
|
|
38
|
-
var
|
|
38
|
+
var import_react3 = require("react");
|
|
39
39
|
|
|
40
|
-
//
|
|
41
|
-
var
|
|
42
|
-
var import_react = require("react");
|
|
43
|
-
var PLUGIN_WORKSPACE_ACTIVATE_EVENT = "@lemoncat7/dsh-plugin-ui/workspace-activate";
|
|
40
|
+
// src/workspace-ownership.ts
|
|
41
|
+
var WORKSPACE_ACTIVATE_EVENT = "@lemoncat7/dsh-plugin-ui/workspace-activate";
|
|
44
42
|
function activatePluginWorkspace(pluginId) {
|
|
45
|
-
window.dispatchEvent(new CustomEvent(
|
|
43
|
+
window.dispatchEvent(new CustomEvent(WORKSPACE_ACTIVATE_EVENT, {
|
|
46
44
|
detail: { pluginId }
|
|
47
45
|
}));
|
|
48
46
|
}
|
|
49
47
|
function observePluginWorkspace(pluginId, close) {
|
|
50
48
|
const onActivate = (event) => {
|
|
51
49
|
const detail = event.detail;
|
|
52
|
-
if (detail?.pluginId !== pluginId)
|
|
53
|
-
close();
|
|
50
|
+
if (detail?.pluginId !== pluginId) close();
|
|
54
51
|
};
|
|
55
|
-
window.addEventListener(
|
|
56
|
-
return () => window.removeEventListener(
|
|
52
|
+
window.addEventListener(WORKSPACE_ACTIVATE_EVENT, onActivate);
|
|
53
|
+
return () => window.removeEventListener(WORKSPACE_ACTIVATE_EVENT, onActivate);
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
// src/client.tsx
|
|
60
57
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
61
58
|
|
|
62
59
|
// node_modules/qrcode.react/lib/esm/index.js
|
|
63
|
-
var
|
|
60
|
+
var import_react = __toESM(require("react"), 1);
|
|
64
61
|
var __defProp2 = Object.defineProperty;
|
|
65
62
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
66
63
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
@@ -893,7 +890,7 @@ function useQRCode({
|
|
|
893
890
|
size,
|
|
894
891
|
boostLevel
|
|
895
892
|
}) {
|
|
896
|
-
let qrcode =
|
|
893
|
+
let qrcode = import_react.default.useMemo(() => {
|
|
897
894
|
const values = Array.isArray(value) ? value : [value];
|
|
898
895
|
const segments = values.reduce((accum, v) => {
|
|
899
896
|
accum.push(...qrcodegen_default.QrSegment.makeSegments(v));
|
|
@@ -908,7 +905,7 @@ function useQRCode({
|
|
|
908
905
|
boostLevel
|
|
909
906
|
);
|
|
910
907
|
}, [value, level, minVersion, boostLevel]);
|
|
911
|
-
const { cells, margin, numCells, calculatedImageSettings } =
|
|
908
|
+
const { cells, margin, numCells, calculatedImageSettings } = import_react.default.useMemo(() => {
|
|
912
909
|
let cells2 = qrcode.getModules();
|
|
913
910
|
const margin2 = getMarginSize(includeMargin, marginSize);
|
|
914
911
|
const numCells2 = cells2.length + margin2 * 2;
|
|
@@ -941,7 +938,7 @@ var SUPPORTS_PATH2D = (function() {
|
|
|
941
938
|
}
|
|
942
939
|
return true;
|
|
943
940
|
})();
|
|
944
|
-
var QRCodeCanvas =
|
|
941
|
+
var QRCodeCanvas = import_react.default.forwardRef(
|
|
945
942
|
function QRCodeCanvas2(props, forwardedRef) {
|
|
946
943
|
const _a = props, {
|
|
947
944
|
value,
|
|
@@ -968,9 +965,9 @@ var QRCodeCanvas = import_react2.default.forwardRef(
|
|
|
968
965
|
]);
|
|
969
966
|
const _b = extraProps, { style } = _b, otherProps = __objRest(_b, ["style"]);
|
|
970
967
|
const imgSrc = imageSettings == null ? void 0 : imageSettings.src;
|
|
971
|
-
const _canvas =
|
|
972
|
-
const _image =
|
|
973
|
-
const setCanvasRef =
|
|
968
|
+
const _canvas = import_react.default.useRef(null);
|
|
969
|
+
const _image = import_react.default.useRef(null);
|
|
970
|
+
const setCanvasRef = import_react.default.useCallback(
|
|
974
971
|
(node) => {
|
|
975
972
|
_canvas.current = node;
|
|
976
973
|
if (typeof forwardedRef === "function") {
|
|
@@ -981,7 +978,7 @@ var QRCodeCanvas = import_react2.default.forwardRef(
|
|
|
981
978
|
},
|
|
982
979
|
[forwardedRef]
|
|
983
980
|
);
|
|
984
|
-
const [isImgLoaded, setIsImageLoaded] =
|
|
981
|
+
const [isImgLoaded, setIsImageLoaded] = import_react.default.useState(false);
|
|
985
982
|
const { margin, cells, numCells, calculatedImageSettings } = useQRCode({
|
|
986
983
|
value,
|
|
987
984
|
level,
|
|
@@ -992,7 +989,7 @@ var QRCodeCanvas = import_react2.default.forwardRef(
|
|
|
992
989
|
imageSettings,
|
|
993
990
|
size
|
|
994
991
|
});
|
|
995
|
-
|
|
992
|
+
import_react.default.useEffect(() => {
|
|
996
993
|
if (_canvas.current != null) {
|
|
997
994
|
const canvas = _canvas.current;
|
|
998
995
|
const ctx = canvas.getContext("2d");
|
|
@@ -1042,13 +1039,13 @@ var QRCodeCanvas = import_react2.default.forwardRef(
|
|
|
1042
1039
|
}
|
|
1043
1040
|
}
|
|
1044
1041
|
});
|
|
1045
|
-
|
|
1042
|
+
import_react.default.useEffect(() => {
|
|
1046
1043
|
setIsImageLoaded(false);
|
|
1047
1044
|
}, [imgSrc]);
|
|
1048
1045
|
const canvasStyle = __spreadValues({ height: size, width: size }, style);
|
|
1049
1046
|
let img = null;
|
|
1050
1047
|
if (imgSrc != null) {
|
|
1051
|
-
img = /* @__PURE__ */
|
|
1048
|
+
img = /* @__PURE__ */ import_react.default.createElement(
|
|
1052
1049
|
"img",
|
|
1053
1050
|
{
|
|
1054
1051
|
src: imgSrc,
|
|
@@ -1062,7 +1059,7 @@ var QRCodeCanvas = import_react2.default.forwardRef(
|
|
|
1062
1059
|
}
|
|
1063
1060
|
);
|
|
1064
1061
|
}
|
|
1065
|
-
return /* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
1066
1063
|
"canvas",
|
|
1067
1064
|
__spreadValues({
|
|
1068
1065
|
style: canvasStyle,
|
|
@@ -1075,7 +1072,7 @@ var QRCodeCanvas = import_react2.default.forwardRef(
|
|
|
1075
1072
|
}
|
|
1076
1073
|
);
|
|
1077
1074
|
QRCodeCanvas.displayName = "QRCodeCanvas";
|
|
1078
|
-
var QRCodeSVG =
|
|
1075
|
+
var QRCodeSVG = import_react.default.forwardRef(
|
|
1079
1076
|
function QRCodeSVG2(props, forwardedRef) {
|
|
1080
1077
|
const _a = props, {
|
|
1081
1078
|
value,
|
|
@@ -1121,7 +1118,7 @@ var QRCodeSVG = import_react2.default.forwardRef(
|
|
|
1121
1118
|
calculatedImageSettings.excavation
|
|
1122
1119
|
);
|
|
1123
1120
|
}
|
|
1124
|
-
image = /* @__PURE__ */
|
|
1121
|
+
image = /* @__PURE__ */ import_react.default.createElement(
|
|
1125
1122
|
"image",
|
|
1126
1123
|
{
|
|
1127
1124
|
href: imageSettings.src,
|
|
@@ -1136,7 +1133,7 @@ var QRCodeSVG = import_react2.default.forwardRef(
|
|
|
1136
1133
|
);
|
|
1137
1134
|
}
|
|
1138
1135
|
const fgPath = generatePath(cellsToDraw, margin);
|
|
1139
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
1140
1137
|
"svg",
|
|
1141
1138
|
__spreadValues({
|
|
1142
1139
|
height: size,
|
|
@@ -1145,8 +1142,8 @@ var QRCodeSVG = import_react2.default.forwardRef(
|
|
|
1145
1142
|
ref: forwardedRef,
|
|
1146
1143
|
role: "img"
|
|
1147
1144
|
}, otherProps),
|
|
1148
|
-
!!title && /* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1145
|
+
!!title && /* @__PURE__ */ import_react.default.createElement("title", null, title),
|
|
1146
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
1150
1147
|
"path",
|
|
1151
1148
|
{
|
|
1152
1149
|
fill: bgColor,
|
|
@@ -1154,7 +1151,7 @@ var QRCodeSVG = import_react2.default.forwardRef(
|
|
|
1154
1151
|
shapeRendering: "crispEdges"
|
|
1155
1152
|
}
|
|
1156
1153
|
),
|
|
1157
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ import_react.default.createElement("path", { fill: fgColor, d: fgPath, shapeRendering: "crispEdges" }),
|
|
1158
1155
|
image
|
|
1159
1156
|
);
|
|
1160
1157
|
}
|
|
@@ -1279,8 +1276,28 @@ var client_default = `.dsh-partner-sidebar,
|
|
|
1279
1276
|
.dsh-partner-topbar > div > span:last-child { display: grid; gap: 2px; }
|
|
1280
1277
|
.dsh-partner-topbar strong { font-size: var(--partner-font-label); font-weight: 620; }
|
|
1281
1278
|
.dsh-partner-topbar small { color: var(--dsw-alias-label-tertiary); font-size: var(--partner-font-caption); }
|
|
1282
|
-
.dsh-partner-topbar
|
|
1283
|
-
|
|
1279
|
+
.dsh-partner-topbar [data-xiaohei-workspace-close] {
|
|
1280
|
+
display: grid;
|
|
1281
|
+
place-items: center;
|
|
1282
|
+
flex: none;
|
|
1283
|
+
width: 30px;
|
|
1284
|
+
height: 30px;
|
|
1285
|
+
padding: 0;
|
|
1286
|
+
border: 1px solid transparent;
|
|
1287
|
+
border-radius: 9px;
|
|
1288
|
+
color: var(--dsw-alias-label-secondary);
|
|
1289
|
+
background: transparent;
|
|
1290
|
+
line-height: 1;
|
|
1291
|
+
cursor: pointer;
|
|
1292
|
+
transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;
|
|
1293
|
+
}
|
|
1294
|
+
.dsh-partner-topbar [data-xiaohei-workspace-close]:hover {
|
|
1295
|
+
border-color: var(--partner-border);
|
|
1296
|
+
color: var(--dsw-alias-label-primary);
|
|
1297
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
1298
|
+
}
|
|
1299
|
+
.dsh-partner-topbar [data-xiaohei-workspace-close]:active { transform: scale(.96); }
|
|
1300
|
+
.dsh-partner-topbar [data-xiaohei-workspace-close] > svg { display: block; pointer-events: none; }
|
|
1284
1301
|
.dsh-partner-grid { display: grid; grid-template-columns: 206px minmax(520px, 1fr); min-width: 0; min-height: 0; }
|
|
1285
1302
|
|
|
1286
1303
|
.dsh-partner-roster { display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 20px 10px 14px; border-right: 1px solid var(--partner-border); background: color-mix(in srgb, var(--partner-raised) 94%, var(--partner-surface)); }
|
|
@@ -1670,9 +1687,9 @@ function loadPartner() {
|
|
|
1670
1687
|
}
|
|
1671
1688
|
|
|
1672
1689
|
// src/sidebar-anchor.ts
|
|
1673
|
-
var
|
|
1690
|
+
var import_react2 = require("react");
|
|
1674
1691
|
function useWorkspaceTopAnchor(ref) {
|
|
1675
|
-
(0,
|
|
1692
|
+
(0, import_react2.useEffect)(() => {
|
|
1676
1693
|
const element = ref.current;
|
|
1677
1694
|
const originalParent = element?.parentElement;
|
|
1678
1695
|
if (!element || !originalParent) return;
|
|
@@ -1708,7 +1725,7 @@ function useWorkspaceTopAnchor(ref) {
|
|
|
1708
1725
|
}
|
|
1709
1726
|
|
|
1710
1727
|
// src/client.tsx
|
|
1711
|
-
var
|
|
1728
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1712
1729
|
var PLUGIN_ID = "@lemoncat7/dsh-partner";
|
|
1713
1730
|
var STYLE_ID = `${PLUGIN_ID}/client`;
|
|
1714
1731
|
var inject = ["slots", "layout", "sessions"];
|
|
@@ -1721,7 +1738,7 @@ function apply(ctx) {
|
|
|
1721
1738
|
name: "sidebar.footer.action",
|
|
1722
1739
|
id: "partner",
|
|
1723
1740
|
order: -120
|
|
1724
|
-
}, (props) => /* @__PURE__ */ (0,
|
|
1741
|
+
}, (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PartnerSidebar, { ...props, controller, collapse: () => ctx.layout.toggleSidebar() })));
|
|
1725
1742
|
}
|
|
1726
1743
|
function createController(ctx) {
|
|
1727
1744
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -1735,7 +1752,7 @@ function createController(ctx) {
|
|
|
1735
1752
|
if (companionId !== void 0) selected = companionId;
|
|
1736
1753
|
if (dispose === void 0) {
|
|
1737
1754
|
activatePluginWorkspace(PLUGIN_ID);
|
|
1738
|
-
dispose = ctx.slots.register({ name: "conversation", priority: -3 }, (props) => /* @__PURE__ */ (0,
|
|
1755
|
+
dispose = ctx.slots.register({ name: "conversation", priority: -3 }, (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PartnerWorkspace, { ...props, controller }));
|
|
1739
1756
|
}
|
|
1740
1757
|
notify();
|
|
1741
1758
|
},
|
|
@@ -1772,13 +1789,13 @@ function createController(ctx) {
|
|
|
1772
1789
|
return controller;
|
|
1773
1790
|
}
|
|
1774
1791
|
function PartnerSidebar(props) {
|
|
1775
|
-
const ref = (0,
|
|
1792
|
+
const ref = (0, import_react3.useRef)(null);
|
|
1776
1793
|
useWorkspaceTopAnchor(ref);
|
|
1777
|
-
const [open, setOpen] = (0,
|
|
1778
|
-
const [snapshot, setSnapshot] = (0,
|
|
1779
|
-
const [, update] = (0,
|
|
1780
|
-
(0,
|
|
1781
|
-
(0,
|
|
1794
|
+
const [open, setOpen] = (0, import_react3.useState)(true);
|
|
1795
|
+
const [snapshot, setSnapshot] = (0, import_react3.useState)();
|
|
1796
|
+
const [, update] = (0, import_react3.useState)(0);
|
|
1797
|
+
(0, import_react3.useEffect)(() => props.controller.subscribe(() => update((value) => value + 1)), [props.controller]);
|
|
1798
|
+
(0, import_react3.useEffect)(() => {
|
|
1782
1799
|
void loadPartner().then(setSnapshot).catch(() => {
|
|
1783
1800
|
});
|
|
1784
1801
|
}, [props.controller.isOpen()]);
|
|
@@ -1786,32 +1803,32 @@ function PartnerSidebar(props) {
|
|
|
1786
1803
|
props.controller.open(id);
|
|
1787
1804
|
if (props.wide && window.matchMedia("(max-width: 820px)").matches) props.collapse();
|
|
1788
1805
|
};
|
|
1789
|
-
if (!props.wide) return /* @__PURE__ */ (0,
|
|
1790
|
-
return /* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
if (!props.wide) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { ref, className: "dsh-partner-sidebar is-rail", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: `dsh-partner-rail${props.controller.isOpen() ? " is-active" : ""}`, title: "\u4F19\u4F34", onClick: () => props.controller.toggle(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 18 }) }) });
|
|
1807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { ref, className: "dsh-partner-sidebar", children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-sidebar-heading", children: [
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: "dsh-partner-sidebar-title", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { size: 14 }) }),
|
|
1794
1811
|
"\u4F19\u4F34"
|
|
1795
1812
|
] }),
|
|
1796
|
-
/* @__PURE__ */ (0,
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-partner-sidebar-open", onClick: () => launch(), "aria-label": "\u6253\u5F00\u4F19\u4F34\u9762\u677F", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconPlusOutline16, { size: 16 }) })
|
|
1797
1814
|
] }),
|
|
1798
|
-
open && /* @__PURE__ */ (0,
|
|
1799
|
-
/* @__PURE__ */ (0,
|
|
1800
|
-
/* @__PURE__ */ (0,
|
|
1801
|
-
/* @__PURE__ */ (0,
|
|
1802
|
-
/* @__PURE__ */ (0,
|
|
1815
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-sidebar-list", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: `dsh-partner-sidebar-row${props.controller.isOpen() ? " is-active" : ""}`, onClick: () => launch(), children: [
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-partner-sidebar-symbol", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 16 }) }),
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u4F19\u4F34\u9762\u677F" }),
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: snapshot ? `${snapshot.companions.length} \u4F4D\u4F19\u4F34 \xB7 ${snapshot.channels.filter((item) => item.runtimeStatus === "running").length} \u4E2A\u5FAE\u4FE1\u5728\u7EBF` : "\u8EAB\u4EFD\u3001\u80FD\u529B\u4E0E\u6E20\u9053" })
|
|
1803
1820
|
] }),
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: snapshot?.channels.some((item) => item.runtimeStatus === "running") ? "is-online" : "" })
|
|
1805
1822
|
] }) })
|
|
1806
1823
|
] });
|
|
1807
1824
|
}
|
|
1808
1825
|
function PartnerWorkspace({ controller }) {
|
|
1809
|
-
const [snapshot, setSnapshot] = (0,
|
|
1810
|
-
const [selectedId, setSelectedId] = (0,
|
|
1811
|
-
const [tab, setTab] = (0,
|
|
1812
|
-
const [error, setError] = (0,
|
|
1813
|
-
const [loading, setLoading] = (0,
|
|
1814
|
-
const refresh = (0,
|
|
1826
|
+
const [snapshot, setSnapshot] = (0, import_react3.useState)();
|
|
1827
|
+
const [selectedId, setSelectedId] = (0, import_react3.useState)(controller.selected());
|
|
1828
|
+
const [tab, setTab] = (0, import_react3.useState)("home");
|
|
1829
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
1830
|
+
const [loading, setLoading] = (0, import_react3.useState)(true);
|
|
1831
|
+
const refresh = (0, import_react3.useCallback)(async () => {
|
|
1815
1832
|
try {
|
|
1816
1833
|
const next = await loadPartner();
|
|
1817
1834
|
setSnapshot(next);
|
|
@@ -1823,10 +1840,10 @@ function PartnerWorkspace({ controller }) {
|
|
|
1823
1840
|
setLoading(false);
|
|
1824
1841
|
}
|
|
1825
1842
|
}, []);
|
|
1826
|
-
(0,
|
|
1843
|
+
(0, import_react3.useEffect)(() => {
|
|
1827
1844
|
void refresh();
|
|
1828
1845
|
}, [refresh]);
|
|
1829
|
-
(0,
|
|
1846
|
+
(0, import_react3.useEffect)(() => controller.subscribe(() => {
|
|
1830
1847
|
const next = controller.selected();
|
|
1831
1848
|
if (next) setSelectedId(next);
|
|
1832
1849
|
}), [controller]);
|
|
@@ -1863,77 +1880,77 @@ function PartnerWorkspace({ controller }) {
|
|
|
1863
1880
|
setError(message(reason));
|
|
1864
1881
|
}
|
|
1865
1882
|
};
|
|
1866
|
-
return /* @__PURE__ */ (0,
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
1868
|
-
/* @__PURE__ */ (0,
|
|
1869
|
-
/* @__PURE__ */ (0,
|
|
1870
|
-
/* @__PURE__ */ (0,
|
|
1871
|
-
/* @__PURE__ */ (0,
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
1883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { className: "dsh-partner-workspace", "data-xiaohei-surface": "plugin-workspace", children: [
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: "dsh-partner-topbar", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "data-xiaohei-workspace-close": true, onClick: controller.close, "aria-label": "\u8FD4\u56DE\u4F1A\u8BDD", title: "\u8FD4\u56DE\u4F1A\u8BDD", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronLeftOutline14, { size: 15 }) }),
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 18 }),
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u4F19\u4F34" }),
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u957F\u671F\u8EAB\u4EFD\u4E0E\u5FAE\u4FE1\u6E20\u9053" })
|
|
1873
1890
|
] })
|
|
1874
1891
|
] }) }),
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1877
|
-
/* @__PURE__ */ (0,
|
|
1878
|
-
/* @__PURE__ */ (0,
|
|
1879
|
-
/* @__PURE__ */ (0,
|
|
1880
|
-
/* @__PURE__ */ (0,
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-grid", children: [
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { className: "dsh-partner-roster", children: [
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-roster-title", children: [
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "COMPANIONS" }),
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u4F19\u4F34\u540D\u518C" })
|
|
1881
1898
|
] }),
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => {
|
|
1883
1900
|
void create();
|
|
1884
|
-
}, "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0,
|
|
1901
|
+
}, "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconPlusOutline16, { size: 16 }) })
|
|
1885
1902
|
] }),
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-roster-list", children: snapshot?.companions.map((companion) => {
|
|
1887
1904
|
const channel = snapshot.channels.find((item) => item.companionId === companion.id);
|
|
1888
|
-
return /* @__PURE__ */ (0,
|
|
1905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: selectedId === companion.id ? "is-active" : "", onClick: () => {
|
|
1889
1906
|
setSelectedId(companion.id);
|
|
1890
1907
|
setTab("home");
|
|
1891
1908
|
}, children: [
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1893
|
-
/* @__PURE__ */ (0,
|
|
1894
|
-
/* @__PURE__ */ (0,
|
|
1895
|
-
/* @__PURE__ */ (0,
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, { name: companion.name }),
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: companion.name }),
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: companion.role })
|
|
1896
1913
|
] }),
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: channel?.runtimeStatus === "running" ? "is-online" : "", title: channel ? channel.runtimeStatus : "\u672A\u8FDE\u63A5\u6E20\u9053" })
|
|
1898
1915
|
] }, companion.id);
|
|
1899
1916
|
}) }),
|
|
1900
|
-
/* @__PURE__ */ (0,
|
|
1901
|
-
/* @__PURE__ */ (0,
|
|
1902
|
-
/* @__PURE__ */ (0,
|
|
1903
|
-
/* @__PURE__ */ (0,
|
|
1904
|
-
/* @__PURE__ */ (0,
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-roster-note", children: [
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconLinkOutline16, { size: 16 }),
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u8EAB\u4EFD\u4E0E\u6E20\u9053\u5206\u79BB" }),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u5FAE\u4FE1\u53EA\u8D1F\u8D23\u6536\u53D1\uFF0C\u6743\u9650\u4ECD\u7531 DSH \u5DE5\u5177\u51B3\u5B9A\u3002" })
|
|
1905
1922
|
] })
|
|
1906
1923
|
] })
|
|
1907
1924
|
] }),
|
|
1908
|
-
/* @__PURE__ */ (0,
|
|
1909
|
-
loading ? /* @__PURE__ */ (0,
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-stage", children: [
|
|
1926
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u6B63\u5728\u8BFB\u53D6\u4F19\u4F34\u2026" }) : selected === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u521B\u5EFA\u7B2C\u4E00\u4E2A\u4F19\u4F34", detail: "\u4F19\u4F34\u4F1A\u4FDD\u5B58\u72EC\u7ACB\u8EAB\u4EFD\u3001\u80FD\u529B\u548C\u5FAE\u4FE1\u4F1A\u8BDD\u3002", action: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => {
|
|
1910
1927
|
void create();
|
|
1911
|
-
}, children: "\u65B0\u5EFA\u4F19\u4F34" }) }) : /* @__PURE__ */ (0,
|
|
1912
|
-
/* @__PURE__ */ (0,
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
1915
|
-
/* @__PURE__ */ (0,
|
|
1916
|
-
/* @__PURE__ */ (0,
|
|
1917
|
-
/* @__PURE__ */ (0,
|
|
1928
|
+
}, children: "\u65B0\u5EFA\u4F19\u4F34" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-identity", children: [
|
|
1930
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, { name: selected.name }),
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "ACTIVE COMPANION" }),
|
|
1933
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: selected.name }),
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: selected.description || selected.role })
|
|
1918
1935
|
] }),
|
|
1919
|
-
/* @__PURE__ */ (0,
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Status, { channel: snapshot?.channels.find((item) => item.companionId === selected.id) })
|
|
1920
1937
|
] }),
|
|
1921
|
-
/* @__PURE__ */ (0,
|
|
1922
|
-
/* @__PURE__ */ (0,
|
|
1923
|
-
/* @__PURE__ */ (0,
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
1926
|
-
/* @__PURE__ */ (0,
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", { className: "dsh-partner-tabs", "aria-label": "\u4F19\u4F34\u914D\u7F6E", children: [
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabButton, { active: tab === "home", onClick: () => setTab("home"), icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 16 }), children: "\u603B\u89C8" }),
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabButton, { active: tab === "identity", onClick: () => setTab("identity"), icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconEditOutline16, { size: 16 }), children: "\u8EAB\u4EFD" }),
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabButton, { active: tab === "capabilities", onClick: () => setTab("capabilities"), icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 16 }), children: "\u80FD\u529B" }),
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabButton, { active: tab === "weixin", onClick: () => setTab("weixin"), icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WeixinGlyph, {}), children: "\u5FAE\u4FE1" }),
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabButton, { active: tab === "memory", onClick: () => setTab("memory"), icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconDataOutline16, { size: 16 }), children: "\u8BB0\u5FC6" })
|
|
1927
1944
|
] }),
|
|
1928
|
-
/* @__PURE__ */ (0,
|
|
1929
|
-
tab === "home" && /* @__PURE__ */ (0,
|
|
1930
|
-
tab === "identity" && /* @__PURE__ */ (0,
|
|
1931
|
-
tab === "capabilities" && /* @__PURE__ */ (0,
|
|
1932
|
-
tab === "weixin" && /* @__PURE__ */ (0,
|
|
1933
|
-
tab === "memory" && /* @__PURE__ */ (0,
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-stage-scroll", children: [
|
|
1946
|
+
tab === "home" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HomePanel, { companion: selected, snapshot, navigate: setTab, openSession, renewSession }),
|
|
1947
|
+
tab === "identity" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdentityEditor, { companion: selected, count: snapshot?.companions.length ?? 1, onChanged: refresh }),
|
|
1948
|
+
tab === "capabilities" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CapabilityEditor, { companion: selected, presets: snapshot?.presets ?? [], onChanged: refresh }),
|
|
1949
|
+
tab === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WeixinPanel, { companion: selected, snapshot, onChanged: refresh }),
|
|
1950
|
+
tab === "memory" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemoryPanel, { companion: selected, snapshot, openSession, renewSession, onChanged: refresh })
|
|
1934
1951
|
] })
|
|
1935
1952
|
] }),
|
|
1936
|
-
error && /* @__PURE__ */ (0,
|
|
1953
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-error", role: "alert", children: error })
|
|
1937
1954
|
] })
|
|
1938
1955
|
] })
|
|
1939
1956
|
] });
|
|
@@ -1946,76 +1963,76 @@ function HomePanel({ companion, snapshot, navigate, openSession, renewSession })
|
|
|
1946
1963
|
const capabilities = companion.capabilities.map((item) => ({ knowledge: "\u77E5\u8BC6\u5E93", skills: "\u6280\u80FD", ssh: "SSH", git: "Git" })[item]);
|
|
1947
1964
|
const online = channel?.runtimeStatus === "running";
|
|
1948
1965
|
const latestSession = sessions.reduce((latest, item) => latest === void 0 || item.lastMessageAt > latest.lastMessageAt ? item : latest, void 0);
|
|
1949
|
-
return /* @__PURE__ */ (0,
|
|
1950
|
-
/* @__PURE__ */ (0,
|
|
1951
|
-
/* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
1953
|
-
/* @__PURE__ */ (0,
|
|
1966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-home", children: [
|
|
1967
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-partner-home-heading", children: [
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u5DE5\u4F5C\u53F0" }),
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: online ? `${companion.name} \u6B63\u5728\u5FAE\u4FE1\u5F85\u547D` : `\u8FDE\u63A5 ${companion.name} \u7684\u7B2C\u4E00\u6761\u6E20\u9053` })
|
|
1954
1971
|
] }),
|
|
1955
|
-
/* @__PURE__ */ (0,
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: online ? "\u6D88\u606F\u3001\u6388\u6743\u4E0E\u4E0A\u4E0B\u6587\u8FB9\u754C\u90FD\u5728\u8FD9\u91CC\u6C47\u603B\u3002" : "\u4F19\u4F34\u8EAB\u4EFD\u5DF2\u7ECF\u5C31\u7EEA\uFF0C\u8FDE\u63A5\u5FAE\u4FE1\u540E\u5373\u53EF\u5F00\u59CB\u6301\u7EED\u5DE5\u4F5C\u3002" })
|
|
1956
1973
|
] }),
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
1958
|
-
/* @__PURE__ */ (0,
|
|
1959
|
-
/* @__PURE__ */ (0,
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: `dsh-partner-home-channel${online ? " is-online" : ""}`, children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-home-route", "aria-hidden": "true", children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, { name: companion.name }),
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-partner-route-line", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}) }),
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-partner-route-weixin", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WeixinGlyph, { large: true }) })
|
|
1962
1979
|
] }),
|
|
1963
|
-
/* @__PURE__ */ (0,
|
|
1964
|
-
/* @__PURE__ */ (0,
|
|
1965
|
-
/* @__PURE__ */ (0,
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-home-channel-copy", children: [
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dsh-partner-home-kicker", children: [
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}),
|
|
1966
1983
|
"\u4E3B\u8981\u6E20\u9053 \xB7 \u5FAE\u4FE1"
|
|
1967
1984
|
] }),
|
|
1968
|
-
/* @__PURE__ */ (0,
|
|
1969
|
-
/* @__PURE__ */ (0,
|
|
1970
|
-
/* @__PURE__ */ (0,
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
1972
|
-
/* @__PURE__ */ (0,
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: !channel ? "\u7B49\u5F85\u626B\u7801\u8FDE\u63A5" : online ? "\u8FDE\u63A5\u6B63\u5E38\uFF0C\u6B63\u5728\u63A5\u6536\u6D88\u606F" : channel.runtimeStatus === "error" ? "\u6E20\u9053\u8FDE\u63A5\u9700\u8981\u5904\u7406" : "\u6E20\u9053\u5F53\u524D\u5DF2\u505C\u7528" }),
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: !channel ? "\u901A\u8FC7\u5FAE\u4FE1 iLink Bot \u63A5\u5165\u3002\u51ED\u636E\u53EA\u8FDB\u5165 DSH \u51ED\u636E\u5E93\uFF0C\u8054\u7CFB\u4EBA\u9996\u6B21\u53D1\u6D88\u606F\u4ECD\u9700\u4F60\u7684\u6279\u51C6\u3002" : online ? "\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u62E5\u6709\u72EC\u7ACB DSH \u4F1A\u8BDD\uFF0C\u4F19\u4F34\u8EAB\u4EFD\u4E00\u81F4\uFF0C\u4F46\u4E0A\u4E0B\u6587\u4E0D\u4F1A\u4E92\u76F8\u6DF7\u5408\u3002" : channel.lastError || "\u6E20\u9053\u914D\u7F6E\u4ECD\u7136\u4FDD\u7559\uFF0C\u53EF\u4EE5\u968F\u65F6\u91CD\u65B0\u542F\u7528\u3002" }),
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-home-channel-actions", children: [
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "is-primary", onClick: () => navigate("weixin"), children: !channel ? "\u8FDE\u63A5\u5FAE\u4FE1" : pending > 0 ? `\u5904\u7406 ${pending} \u4E2A\u8BF7\u6C42` : "\u7BA1\u7406\u6E20\u9053" }),
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: !channel ? "\u626B\u7801\u5B8C\u6210\uFF0C\u65E0\u9700\u7C98\u8D34 Token" : `${approved} \u4F4D\u8054\u7CFB\u4EBA \xB7 ${sessions.length} \u4E2A\u72EC\u7ACB\u4F1A\u8BDD` })
|
|
1973
1990
|
] })
|
|
1974
1991
|
] })
|
|
1975
1992
|
] }),
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
1978
|
-
/* @__PURE__ */ (0,
|
|
1979
|
-
/* @__PURE__ */ (0,
|
|
1980
|
-
/* @__PURE__ */ (0,
|
|
1981
|
-
/* @__PURE__ */ (0,
|
|
1982
|
-
/* @__PURE__ */ (0,
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-home-details", children: [
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-home-profile", children: [
|
|
1995
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUserOutline16, { size: 16 }) }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u4F19\u4F34\u5E95\u7A3F" }),
|
|
1999
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: companion.role })
|
|
1983
2000
|
] }),
|
|
1984
|
-
/* @__PURE__ */ (0,
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => navigate("identity"), children: "\u7F16\u8F91" })
|
|
1985
2002
|
] }),
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("blockquote", { children: companion.instructions || companion.description || "\u5C1A\u672A\u8BBE\u7F6E\u957F\u671F\u884C\u4E3A\u51C6\u5219\u3002" })
|
|
1987
2004
|
] }),
|
|
1988
|
-
/* @__PURE__ */ (0,
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
1991
|
-
/* @__PURE__ */ (0,
|
|
1992
|
-
/* @__PURE__ */ (0,
|
|
1993
|
-
/* @__PURE__ */ (0,
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-home-runtime", children: [
|
|
2006
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 16 }) }),
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u8FD0\u884C\u80FD\u529B" }),
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: companion.presetId || "DSH \u9ED8\u8BA4 Preset" })
|
|
1994
2011
|
] }),
|
|
1995
|
-
/* @__PURE__ */ (0,
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => navigate("capabilities"), children: "\u8C03\u6574" })
|
|
1996
2013
|
] }),
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-home-capability-list", children: capabilities.length ? capabilities.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: item }, item)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u5C1A\u672A\u58F0\u660E\u80FD\u529B\u8303\u56F4" }) })
|
|
1998
2015
|
] }),
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
2000
|
-
/* @__PURE__ */ (0,
|
|
2001
|
-
/* @__PURE__ */ (0,
|
|
2002
|
-
/* @__PURE__ */ (0,
|
|
2003
|
-
/* @__PURE__ */ (0,
|
|
2004
|
-
/* @__PURE__ */ (0,
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-home-continuity", children: [
|
|
2017
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconDataOutline16, { size: 16 }) }),
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2020
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u4F1A\u8BDD\u8FDE\u7EED\u6027" }),
|
|
2021
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: sessions.length ? `${sessions.length} \u4E2A\u5171\u4EAB\u4F1A\u8BDD` : "\u7B49\u5F85\u7B2C\u4E00\u6761\u6D88\u606F" })
|
|
2005
2022
|
] }),
|
|
2006
|
-
/* @__PURE__ */ (0,
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => latestSession === void 0 ? navigate("memory") : latestSession.archived ? void renewSession(latestSession.id) : void openSession(latestSession.id, latestSession.sessionId), children: latestSession === void 0 ? "\u67E5\u770B" : latestSession.archived ? "\u5F00\u59CB\u65B0\u4F1A\u8BDD" : "\u6253\u5F00\u4F1A\u8BDD" })
|
|
2007
2024
|
] }),
|
|
2008
|
-
/* @__PURE__ */ (0,
|
|
2025
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: sessions.length ? `\u6700\u8FD1\u6D3B\u52A8\u4E8E ${relativeTime(Math.max(...sessions.map((item) => item.lastMessageAt)))}` : "\u5FAE\u4FE1\u8054\u7CFB\u4EBA\u901A\u8FC7\u914D\u5BF9\u540E\uFF0C\u5C06\u5728\u8FD9\u91CC\u5EFA\u7ACB\u72EC\u7ACB\u4E0A\u4E0B\u6587\u3002" })
|
|
2009
2026
|
] })
|
|
2010
2027
|
] })
|
|
2011
2028
|
] });
|
|
2012
2029
|
}
|
|
2013
2030
|
function IdentityEditor({ companion, count, onChanged }) {
|
|
2014
|
-
const [form, setForm] = (0,
|
|
2015
|
-
const [saving, setSaving] = (0,
|
|
2016
|
-
const [saved, setSaved] = (0,
|
|
2017
|
-
const [error, setError] = (0,
|
|
2018
|
-
(0,
|
|
2031
|
+
const [form, setForm] = (0, import_react3.useState)(() => companionDraft(companion));
|
|
2032
|
+
const [saving, setSaving] = (0, import_react3.useState)(false);
|
|
2033
|
+
const [saved, setSaved] = (0, import_react3.useState)(false);
|
|
2034
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
2035
|
+
(0, import_react3.useEffect)(() => {
|
|
2019
2036
|
setForm(companionDraft(companion));
|
|
2020
2037
|
setSaved(false);
|
|
2021
2038
|
}, [companion.id, companion.updatedAt]);
|
|
@@ -2042,45 +2059,45 @@ function IdentityEditor({ companion, count, onChanged }) {
|
|
|
2042
2059
|
setError(message(reason));
|
|
2043
2060
|
}
|
|
2044
2061
|
};
|
|
2045
|
-
return /* @__PURE__ */ (0,
|
|
2062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "dsh-partner-form is-identity", onSubmit: (event) => {
|
|
2046
2063
|
void submit(event);
|
|
2047
2064
|
}, children: [
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2050
|
-
/* @__PURE__ */ (0,
|
|
2051
|
-
/* @__PURE__ */ (0,
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, { eyebrow: "IDENTITY", title: "\u5DE5\u4F5C\u8EAB\u4EFD", detail: "\u5B83\u4E0D\u662F\u4E00\u6B21\u5BF9\u8BDD\u7684\u63D0\u793A\u8BCD\uFF0C\u800C\u662F\u8FD9\u4E2A\u4F19\u4F34\u5728\u684C\u9762\u548C\u5FAE\u4FE1\u4E2D\u7684\u957F\u671F\u884C\u4E3A\u57FA\u7EBF\u3002" }),
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-fields two", children: [
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u540D\u5B57", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { required: true, maxLength: 60, value: form.name, onChange: (event) => setForm({ ...form, name: event.target.value }) }) }),
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u89D2\u8272", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { required: true, maxLength: 120, value: form.role, onChange: (event) => setForm({ ...form, role: event.target.value }) }) })
|
|
2052
2069
|
] }),
|
|
2053
|
-
/* @__PURE__ */ (0,
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
2055
|
-
error && /* @__PURE__ */ (0,
|
|
2056
|
-
/* @__PURE__ */ (0,
|
|
2057
|
-
/* @__PURE__ */ (0,
|
|
2058
|
-
/* @__PURE__ */ (0,
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D", hint: "\u7528\u4E8E\u540D\u518C\u8BC6\u522B\uFF0C\u4E0D\u4F1A\u66FF\u4EE3\u5B8C\u6574\u884C\u4E3A\u51C6\u5219\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { rows: 2, maxLength: 500, value: form.description, onChange: (event) => setForm({ ...form, description: event.target.value }) }) }),
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u957F\u671F\u884C\u4E3A\u51C6\u5219", hint: "\u5EFA\u8BAE\u5199\u804C\u8D23\u3001\u8868\u8FBE\u65B9\u5F0F\u4E0E\u8FB9\u754C\uFF1B\u6E20\u9053\u3001\u5DE5\u5177\u548C\u6388\u6743\u7531\u7CFB\u7EDF\u5355\u72EC\u63A7\u5236\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { rows: 9, maxLength: 12e3, value: form.instructions, onChange: (event) => setForm({ ...form, instructions: event.target.value }) }) }),
|
|
2072
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-inline-error", children: error }),
|
|
2073
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-form-actions", children: [
|
|
2074
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: saved && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2075
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCheckOutline14, { size: 14 }),
|
|
2059
2076
|
"\u5DF2\u4FDD\u5B58\uFF0C\u540E\u7EED\u5FAE\u4FE1\u6D88\u606F\u5C06\u4F7F\u7528\u65B0\u8EAB\u4EFD"
|
|
2060
2077
|
] }) }),
|
|
2061
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: saving, children: saving ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u8EAB\u4EFD" })
|
|
2062
2079
|
] }),
|
|
2063
|
-
/* @__PURE__ */ (0,
|
|
2064
|
-
/* @__PURE__ */ (0,
|
|
2065
|
-
/* @__PURE__ */ (0,
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-identity-danger", children: [
|
|
2081
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2082
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u5220\u9664\u4F19\u4F34" }),
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u5FC5\u987B\u5148\u79FB\u9664\u5DF2\u7ED1\u5B9A\u5FAE\u4FE1\u6E20\u9053\uFF1B\u4E0D\u4F1A\u81EA\u52A8\u628A\u8054\u7CFB\u4EBA\u8F6C\u4EA4\u7ED9\u5176\u4ED6\u4F19\u4F34\u3002" })
|
|
2067
2084
|
] }),
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", disabled: count <= 1, onClick: () => {
|
|
2069
2086
|
void remove();
|
|
2070
2087
|
}, children: [
|
|
2071
|
-
/* @__PURE__ */ (0,
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconTrashOutline16, { size: 16 }),
|
|
2072
2089
|
"\u5220\u9664"
|
|
2073
2090
|
] })
|
|
2074
2091
|
] })
|
|
2075
2092
|
] });
|
|
2076
2093
|
}
|
|
2077
2094
|
function CapabilityEditor({ companion, presets, onChanged }) {
|
|
2078
|
-
const [form, setForm] = (0,
|
|
2079
|
-
const [modelCatalog, setModelCatalog] = (0,
|
|
2080
|
-
const [saving, setSaving] = (0,
|
|
2081
|
-
const [error, setError] = (0,
|
|
2082
|
-
(0,
|
|
2083
|
-
(0,
|
|
2095
|
+
const [form, setForm] = (0, import_react3.useState)(() => companionDraft(companion));
|
|
2096
|
+
const [modelCatalog, setModelCatalog] = (0, import_react3.useState)();
|
|
2097
|
+
const [saving, setSaving] = (0, import_react3.useState)(false);
|
|
2098
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
2099
|
+
(0, import_react3.useEffect)(() => setForm(companionDraft(companion)), [companion.id, companion.updatedAt]);
|
|
2100
|
+
(0, import_react3.useEffect)(() => {
|
|
2084
2101
|
void api("/models").then(setModelCatalog).catch((reason) => setError(message(reason)));
|
|
2085
2102
|
}, []);
|
|
2086
2103
|
const toggle = (capability) => setForm((current) => ({ ...current, capabilities: current.capabilities.includes(capability) ? current.capabilities.filter((item) => item !== capability) : [...current.capabilities, capability] }));
|
|
@@ -2105,41 +2122,41 @@ function CapabilityEditor({ companion, presets, onChanged }) {
|
|
|
2105
2122
|
const selectedProvider = form.provider || modelCatalog?.defaultSelection.provider || "";
|
|
2106
2123
|
const modelOptions = modelCatalog?.providers.find((item) => item.id === selectedProvider)?.models ?? [];
|
|
2107
2124
|
const currentModelMissing = Boolean(form.model) && !modelOptions.some((item) => item.id === form.model);
|
|
2108
|
-
return /* @__PURE__ */ (0,
|
|
2109
|
-
/* @__PURE__ */ (0,
|
|
2110
|
-
/* @__PURE__ */ (0,
|
|
2111
|
-
/* @__PURE__ */ (0,
|
|
2112
|
-
presets.filter((item) => !item.broken).map((item) => /* @__PURE__ */ (0,
|
|
2125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-form is-capabilities", children: [
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, { eyebrow: "COMPOSITION", title: "\u80FD\u529B\u7EC4\u5408", detail: "\u4F19\u4F34\u58F0\u660E\u610F\u56FE\u8303\u56F4\uFF1B\u771F\u6B63\u53EF\u8C03\u7528\u7684\u5DE5\u5177\u4ECD\u6765\u81EA\u6240\u9009 Agent Preset\uFF0C\u5E76\u7EE7\u7EED\u6267\u884C\u5404\u63D2\u4EF6\u6743\u9650\u3002" }),
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "Agent Preset", hint: "\u51B3\u5B9A\u8FD9\u4E2A\u4F19\u4F34\u5B9E\u9645\u52A0\u8F7D\u54EA\u4E9B\u5DE5\u5177\u3001\u6280\u80FD\u548C\u7CFB\u7EDF\u63D0\u793A\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: form.presetId, onChange: (event) => setForm({ ...form, presetId: event.target.value }), children: [
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\u8DDF\u968F DSH \u9ED8\u8BA4 Preset" }),
|
|
2129
|
+
presets.filter((item) => !item.broken).map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: item.id, children: item.name }, item.id))
|
|
2113
2130
|
] }) }),
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2116
|
-
/* @__PURE__ */ (0,
|
|
2117
|
-
/* @__PURE__ */ (0,
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-capabilities", children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: form.capabilities.includes(choice.id) ? "is-active" : "", onClick: () => toggle(choice.id), children: [
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: form.capabilities.includes(choice.id) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCheckOutline14, { size: 14 }) }),
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: choice.title }),
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: choice.detail })
|
|
2118
2135
|
] }, choice.id)) }),
|
|
2119
|
-
/* @__PURE__ */ (0,
|
|
2120
|
-
/* @__PURE__ */ (0,
|
|
2121
|
-
/* @__PURE__ */ (0,
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-fields two", children: [
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u6A21\u578B\u63D0\u4F9B\u65B9", hint: "\u6A21\u578B\u76EE\u5F55\u6765\u81EA\u5F53\u524D\u5BA2\u6237\u7AEF", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: form.provider, onChange: (event) => setForm({ ...form, provider: event.target.value, model: "" }), children: [
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: "", children: [
|
|
2122
2139
|
"\u8DDF\u968F DSH \u9ED8\u8BA4 \xB7 ",
|
|
2123
2140
|
modelCatalog?.defaultSelection.provider || "\u6B63\u5728\u8BFB\u53D6"
|
|
2124
2141
|
] }),
|
|
2125
|
-
modelCatalog?.providers.map((provider) => /* @__PURE__ */ (0,
|
|
2142
|
+
modelCatalog?.providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: provider.id, children: provider.name || provider.id }, provider.id))
|
|
2126
2143
|
] }) }),
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2128
|
-
/* @__PURE__ */ (0,
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u6A21\u578B", hint: "\u968F\u63D0\u4F9B\u65B9\u8054\u52A8", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: form.model, onChange: (event) => setForm({ ...form, model: event.target.value }), children: [
|
|
2145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: "", children: [
|
|
2129
2146
|
"\u8DDF\u968F DSH \u9ED8\u8BA4 \xB7 ",
|
|
2130
2147
|
modelCatalog?.defaultSelection.model || "\u6B63\u5728\u8BFB\u53D6"
|
|
2131
2148
|
] }),
|
|
2132
|
-
currentModelMissing && /* @__PURE__ */ (0,
|
|
2149
|
+
currentModelMissing && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: form.model, children: [
|
|
2133
2150
|
"\u5F53\u524D\u914D\u7F6E \xB7 ",
|
|
2134
2151
|
form.model
|
|
2135
2152
|
] }),
|
|
2136
|
-
modelOptions.map((model) => /* @__PURE__ */ (0,
|
|
2153
|
+
modelOptions.map((model) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: model.id, children: model.name || model.id }, model.id))
|
|
2137
2154
|
] }) })
|
|
2138
2155
|
] }),
|
|
2139
|
-
error && /* @__PURE__ */ (0,
|
|
2140
|
-
/* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
/* @__PURE__ */ (0,
|
|
2156
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-inline-error", children: error }),
|
|
2157
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-form-actions", children: [
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {}),
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: saving, onClick: () => {
|
|
2143
2160
|
void save();
|
|
2144
2161
|
}, children: saving ? "\u6B63\u5728\u5E94\u7528\u2026" : "\u5E94\u7528\u80FD\u529B\u7EC4\u5408" })
|
|
2145
2162
|
] })
|
|
@@ -2147,10 +2164,10 @@ function CapabilityEditor({ companion, presets, onChanged }) {
|
|
|
2147
2164
|
}
|
|
2148
2165
|
function WeixinPanel({ companion, snapshot, onChanged }) {
|
|
2149
2166
|
const channel = snapshot.channels.find((item) => item.companionId === companion.id);
|
|
2150
|
-
const [login, setLogin] = (0,
|
|
2151
|
-
const [busy, setBusy] = (0,
|
|
2152
|
-
const [error, setError] = (0,
|
|
2153
|
-
(0,
|
|
2167
|
+
const [login, setLogin] = (0, import_react3.useState)();
|
|
2168
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
2169
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
2170
|
+
(0, import_react3.useEffect)(() => {
|
|
2154
2171
|
if (!login || login.phase === "confirmed" || login.phase === "expired" || login.phase === "error") return;
|
|
2155
2172
|
const timer = window.setInterval(() => {
|
|
2156
2173
|
void api(`/weixin/login/${login.id}`).then(async (result) => {
|
|
@@ -2196,118 +2213,118 @@ function WeixinPanel({ companion, snapshot, onChanged }) {
|
|
|
2196
2213
|
setError(message(reason));
|
|
2197
2214
|
}
|
|
2198
2215
|
};
|
|
2199
|
-
return /* @__PURE__ */ (0,
|
|
2200
|
-
/* @__PURE__ */ (0,
|
|
2201
|
-
!channel && !login && /* @__PURE__ */ (0,
|
|
2202
|
-
/* @__PURE__ */ (0,
|
|
2203
|
-
/* @__PURE__ */ (0,
|
|
2204
|
-
/* @__PURE__ */ (0,
|
|
2216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-form is-channel", children: [
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, { eyebrow: "PRIMARY CHANNEL", title: "\u5FAE\u4FE1\u6E20\u9053", detail: "\u4F7F\u7528\u5FAE\u4FE1 iLink Bot \u626B\u7801\u63A5\u5165\u3002\u6BCF\u4E2A\u673A\u5668\u4EBA\u53EA\u7ED1\u5B9A\u4E00\u4E2A\u4F19\u4F34\uFF0C\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u4FDD\u6301\u72EC\u7ACB DSH \u4F1A\u8BDD\u3002" }),
|
|
2218
|
+
!channel && !login && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-weixin-connect", children: [
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WeixinGlyph, { large: true }) }),
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
|
|
2205
2222
|
"\u628A ",
|
|
2206
2223
|
companion.name,
|
|
2207
2224
|
" \u5E26\u5230\u5FAE\u4FE1"
|
|
2208
2225
|
] }),
|
|
2209
|
-
/* @__PURE__ */ (0,
|
|
2210
|
-
/* @__PURE__ */ (0,
|
|
2211
|
-
/* @__PURE__ */ (0,
|
|
2212
|
-
/* @__PURE__ */ (0,
|
|
2213
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u626B\u7801\u540E\uFF0C\u673A\u5668\u4EBA\u51ED\u636E\u76F4\u63A5\u4FDD\u5B58\u8FDB DSH \u51ED\u636E\u5E93\uFF0C\u4E0D\u4F1A\u663E\u793A\u5728\u6D4F\u89C8\u5668\u6216\u666E\u901A\u914D\u7F6E\u6587\u4EF6\u4E2D\u3002" }),
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { children: [
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "\u79C1\u804A\u9996\u6B21\u8054\u7CFB\u5FC5\u987B\u5BA1\u6279" }),
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "\u8054\u7CFB\u4EBA\u4E4B\u95F4\u4E0A\u4E0B\u6587\u5B8C\u5168\u9694\u79BB" }),
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "\u5DE5\u5177\u6743\u9650\u4E0D\u4F1A\u56E0\u5FAE\u4FE1\u8EAB\u4EFD\u81EA\u52A8\u6269\u5927" })
|
|
2214
2231
|
] })
|
|
2215
2232
|
] }),
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy, onClick: () => {
|
|
2217
2234
|
void begin();
|
|
2218
2235
|
}, children: busy ? "\u6B63\u5728\u7533\u8BF7\u4E8C\u7EF4\u7801\u2026" : "\u626B\u7801\u8FDE\u63A5\u5FAE\u4FE1" })
|
|
2219
2236
|
] }),
|
|
2220
|
-
login && /* @__PURE__ */ (0,
|
|
2221
|
-
/* @__PURE__ */ (0,
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2223
|
-
/* @__PURE__ */ (0,
|
|
2224
|
-
/* @__PURE__ */ (0,
|
|
2225
|
-
/* @__PURE__ */ (0,
|
|
2226
|
-
(login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0,
|
|
2237
|
+
login && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-qr", children: [
|
|
2238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-qr-code", children: login.qrContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QRCodeSVG, { value: login.qrContent, size: 176, level: "M" }) }),
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "WECHAT ILINK BOT" }),
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: login.phase === "scanned" ? "\u5DF2\u626B\u7801\uFF0C\u8BF7\u5728\u5FAE\u4FE1\u786E\u8BA4" : login.phase === "expired" ? "\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F" : login.phase === "error" ? "\u8FDE\u63A5\u5931\u8D25" : "\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801" }),
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: login.error || (login.phase === "scanned" ? "\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u52A8\u6E20\u9053\uFF0C\u4E0D\u9700\u8981\u590D\u5236 Token\u3002" : "\u4E8C\u7EF4\u7801\u7EA6 5 \u5206\u949F\u6709\u6548\u3002\u6B64\u9875\u9762\u53EF\u4EE5\u5B89\u5168\u5730\u4FDD\u6301\u6253\u5F00\u3002") }),
|
|
2243
|
+
(login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", onClick: () => {
|
|
2227
2244
|
setLogin(void 0);
|
|
2228
2245
|
void begin();
|
|
2229
2246
|
}, children: [
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconRefreshOutline16, { size: 16 }),
|
|
2231
2248
|
"\u91CD\u65B0\u751F\u6210"
|
|
2232
2249
|
] })
|
|
2233
2250
|
] })
|
|
2234
2251
|
] }),
|
|
2235
|
-
channel && /* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2237
|
-
/* @__PURE__ */ (0,
|
|
2238
|
-
/* @__PURE__ */ (0,
|
|
2239
|
-
/* @__PURE__ */ (0,
|
|
2240
|
-
/* @__PURE__ */ (0,
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
2252
|
+
channel && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-channel-card", children: [
|
|
2254
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WeixinGlyph, { large: true }) }),
|
|
2255
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "WECHAT CHANNEL" }),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: channel.name }),
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: channel.accountId })
|
|
2242
2259
|
] }),
|
|
2243
|
-
/* @__PURE__ */ (0,
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Status, { channel }),
|
|
2261
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": channel.enabled, disabled: busy, "aria-label": channel.enabled ? "\u505C\u7528\u5FAE\u4FE1\u6E20\u9053" : "\u542F\u7528\u5FAE\u4FE1\u6E20\u9053", onClick: () => {
|
|
2245
2262
|
void toggle();
|
|
2246
|
-
}, children: /* @__PURE__ */ (0,
|
|
2263
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}) })
|
|
2247
2264
|
] }),
|
|
2248
|
-
channel.lastError && /* @__PURE__ */ (0,
|
|
2249
|
-
/* @__PURE__ */ (0,
|
|
2250
|
-
/* @__PURE__ */ (0,
|
|
2251
|
-
/* @__PURE__ */ (0,
|
|
2252
|
-
/* @__PURE__ */ (0,
|
|
2265
|
+
channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-inline-error", children: channel.lastError }),
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-pairing-heading", children: [
|
|
2267
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "ACCESS" }),
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u79C1\u804A\u914D\u5BF9" })
|
|
2253
2270
|
] }),
|
|
2254
|
-
/* @__PURE__ */ (0,
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("em", { children: [
|
|
2255
2272
|
pairings.filter((item) => item.status === "pending").length,
|
|
2256
2273
|
" \u4E2A\u5F85\u5904\u7406"
|
|
2257
2274
|
] })
|
|
2258
2275
|
] }),
|
|
2259
|
-
/* @__PURE__ */ (0,
|
|
2260
|
-
/* @__PURE__ */ (0,
|
|
2261
|
-
/* @__PURE__ */ (0,
|
|
2262
|
-
/* @__PURE__ */ (0,
|
|
2263
|
-
/* @__PURE__ */ (0,
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-pairings", children: pairings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u8FD8\u6CA1\u6709\u8054\u7CFB\u4EBA", detail: "\u6709\u4EBA\u9996\u6B21\u5411\u673A\u5668\u4EBA\u53D1\u6D88\u606F\u540E\uFF0C\u914D\u5BF9\u8BF7\u6C42\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002", compact: true }) : pairings.map((pairing) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { children: [
|
|
2277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `is-${pairing.status}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUserOutline16, { size: 16 }) }),
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: pairing.displayName }),
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [
|
|
2264
2281
|
pairing.status === "pending" ? "\u7B49\u5F85\u5BA1\u6279" : pairing.status === "approved" ? "\u5DF2\u6388\u6743\u72EC\u7ACB\u4F1A\u8BDD" : "\u5DF2\u963B\u6B62",
|
|
2265
2282
|
" \xB7 ",
|
|
2266
2283
|
new Date(pairing.updatedAt).toLocaleString()
|
|
2267
2284
|
] })
|
|
2268
2285
|
] }),
|
|
2269
|
-
pairing.status === "pending" && /* @__PURE__ */ (0,
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2286
|
+
pairing.status === "pending" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2287
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => {
|
|
2271
2288
|
void actPairing(pairing.id, "blocked");
|
|
2272
2289
|
}, children: "\u62D2\u7EDD" }),
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "is-primary", onClick: () => {
|
|
2274
2291
|
void actPairing(pairing.id, "approved");
|
|
2275
2292
|
}, children: "\u6279\u51C6" })
|
|
2276
2293
|
] }),
|
|
2277
|
-
pairing.status === "approved" && /* @__PURE__ */ (0,
|
|
2294
|
+
pairing.status === "approved" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => {
|
|
2278
2295
|
void actPairing(pairing.id, "blocked");
|
|
2279
2296
|
}, children: "\u64A4\u9500" }),
|
|
2280
|
-
pairing.status === "blocked" && /* @__PURE__ */ (0,
|
|
2297
|
+
pairing.status === "blocked" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => {
|
|
2281
2298
|
void actPairing(pairing.id, "approved");
|
|
2282
2299
|
}, children: "\u91CD\u65B0\u6279\u51C6" })
|
|
2283
2300
|
] }, pairing.id)) })
|
|
2284
2301
|
] }),
|
|
2285
|
-
error && /* @__PURE__ */ (0,
|
|
2302
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-inline-error", children: error })
|
|
2286
2303
|
] });
|
|
2287
2304
|
}
|
|
2288
2305
|
function MemoryPanel({ companion, snapshot, openSession, renewSession, onChanged }) {
|
|
2289
2306
|
const sessions = snapshot.sessions.filter((item) => item.companionId === companion.id);
|
|
2290
2307
|
const heartbeat = snapshot.heartbeatStates.find((item) => item.companionId === companion.id);
|
|
2291
|
-
const [automation, setAutomation] = (0,
|
|
2292
|
-
const [memories, setMemories] = (0,
|
|
2293
|
-
const [reflections, setReflections] = (0,
|
|
2294
|
-
const [graph, setGraph] = (0,
|
|
2295
|
-
const [editing, setEditing] = (0,
|
|
2296
|
-
const [busy, setBusy] = (0,
|
|
2297
|
-
const [notice, setNotice] = (0,
|
|
2298
|
-
const [error, setError] = (0,
|
|
2299
|
-
const [modelCatalog, setModelCatalog] = (0,
|
|
2300
|
-
const loadMemory = (0,
|
|
2308
|
+
const [automation, setAutomation] = (0, import_react3.useState)(() => structuredClone(companion.automation));
|
|
2309
|
+
const [memories, setMemories] = (0, import_react3.useState)([]);
|
|
2310
|
+
const [reflections, setReflections] = (0, import_react3.useState)([]);
|
|
2311
|
+
const [graph, setGraph] = (0, import_react3.useState)({ memories: [], relations: [] });
|
|
2312
|
+
const [editing, setEditing] = (0, import_react3.useState)();
|
|
2313
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
2314
|
+
const [notice, setNotice] = (0, import_react3.useState)();
|
|
2315
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
2316
|
+
const [modelCatalog, setModelCatalog] = (0, import_react3.useState)();
|
|
2317
|
+
const loadMemory = (0, import_react3.useCallback)(async () => {
|
|
2301
2318
|
const [result, relations] = await Promise.all([api(`/companions/${companion.id}/memory`), api(`/companions/${companion.id}/memory/graph`)]);
|
|
2302
2319
|
setMemories(result.memories);
|
|
2303
2320
|
setReflections(result.reflections);
|
|
2304
2321
|
setGraph(relations);
|
|
2305
2322
|
}, [companion.id]);
|
|
2306
|
-
(0,
|
|
2323
|
+
(0, import_react3.useEffect)(() => {
|
|
2307
2324
|
setAutomation(structuredClone(companion.automation));
|
|
2308
2325
|
void loadMemory().catch((reason) => setError(message(reason)));
|
|
2309
2326
|
}, [companion.id, companion.updatedAt, loadMemory]);
|
|
2310
|
-
(0,
|
|
2327
|
+
(0, import_react3.useEffect)(() => {
|
|
2311
2328
|
void api("/models").then(setModelCatalog).catch((reason) => setError(message(reason)));
|
|
2312
2329
|
}, []);
|
|
2313
2330
|
const inheritedProvider = companion.provider || modelCatalog?.defaultSelection.provider || "";
|
|
@@ -2384,256 +2401,256 @@ function MemoryPanel({ companion, snapshot, openSession, renewSession, onChanged
|
|
|
2384
2401
|
setBusy(false);
|
|
2385
2402
|
}
|
|
2386
2403
|
};
|
|
2387
|
-
return /* @__PURE__ */ (0,
|
|
2388
|
-
/* @__PURE__ */ (0,
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2391
|
-
/* @__PURE__ */ (0,
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-form is-memory", children: [
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, { eyebrow: "CONTINUITY", title: "\u4F1A\u8BDD\u8BB0\u5FC6", detail: "\u8FD9\u91CC\u5C55\u793A\u6E20\u9053\u4F1A\u8BDD\u8FB9\u754C\u3002\u77E5\u8BC6\u5E93\u4ECD\u7531\u77E5\u8BC6\u5E93\u63D2\u4EF6\u7BA1\u7406\uFF0C\u4F19\u4F34\u4E0D\u4F1A\u628A\u4E0D\u540C\u5FAE\u4FE1\u8054\u7CFB\u4EBA\u7684\u539F\u59CB\u4E0A\u4E0B\u6587\u6DF7\u5728\u4E00\u8D77\u3002" }),
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-metrics", children: [
|
|
2407
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { children: [
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u6E20\u9053\u4F1A\u8BDD" }),
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: sessions.length }),
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u72EC\u7ACB" })
|
|
2394
2411
|
] }),
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2398
|
-
/* @__PURE__ */ (0,
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u957F\u671F\u8BB0\u5FC6" }),
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: memories.filter((item) => item.status === "active").length }),
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
2399
2416
|
reflections.length,
|
|
2400
2417
|
" \u7BC7\u6BCF\u65E5\u56DE\u987E"
|
|
2401
2418
|
] })
|
|
2402
2419
|
] }),
|
|
2403
|
-
/* @__PURE__ */ (0,
|
|
2404
|
-
/* @__PURE__ */ (0,
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
2406
|
-
/* @__PURE__ */ (0,
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { children: [
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u6700\u8FD1\u5FC3\u8DF3" }),
|
|
2422
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: heartbeat?.lastCheckedAt ? relativeTime(heartbeat.lastCheckedAt) : "\u5C1A\u672A" }),
|
|
2423
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: heartbeat?.lastError ? "\u4E0A\u6B21\u6267\u884C\u5F02\u5E38" : `\u4ECA\u65E5\u53D1\u9001 ${heartbeat?.sentCount ?? 0} \u6B21` })
|
|
2407
2424
|
] })
|
|
2408
2425
|
] }),
|
|
2409
|
-
/* @__PURE__ */ (0,
|
|
2410
|
-
/* @__PURE__ */ (0,
|
|
2411
|
-
/* @__PURE__ */ (0,
|
|
2412
|
-
/* @__PURE__ */ (0,
|
|
2413
|
-
/* @__PURE__ */ (0,
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
2426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-automation-grid", children: [
|
|
2427
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-automation", children: [
|
|
2428
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2429
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u5B66\u4E60\u4E0E\u957F\u671F\u8BB0\u5FC6" }),
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u6309\u8054\u7CFB\u4EBA\u5F52\u6863\u5B8C\u6574\u5BF9\u8BDD\uFF0C\u63D0\u70BC\u6BCF\u65E5\u56DE\u987E\u548C\u7ED3\u6784\u5316\u8BB0\u5FC6\uFF0C\u5E76\u5728\u76F8\u5173\u8BDD\u9898\u51FA\u73B0\u65F6\u53EC\u56DE\u3002" })
|
|
2415
2432
|
] }),
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": automation.memory.enabled, "aria-label": "\u542F\u7528\u4F19\u4F34\u5B66\u4E60", onClick: () => setAutomation((current) => ({ ...current, memory: { ...current.memory, enabled: !current.memory.enabled } })), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}) })
|
|
2417
2434
|
] }),
|
|
2418
|
-
/* @__PURE__ */ (0,
|
|
2419
|
-
/* @__PURE__ */ (0,
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
2421
|
-
/* @__PURE__ */ (0,
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2423
|
-
/* @__PURE__ */ (0,
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-automation-fields is-memory-model", children: [
|
|
2436
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u4FDD\u7559\u671F\u9650", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: automation.memory.retentionDays, onChange: (event) => setAutomation((current) => ({ ...current, memory: { ...current.memory, retentionDays: Number(event.target.value) } })), children: [
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 0, children: "\u6C38\u4E45\u4FDD\u7559" }),
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 30, children: "30 \u5929" }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 90, children: "90 \u5929" }),
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 180, children: "180 \u5929" }),
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 365, children: "1 \u5E74" }),
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 1095, children: "3 \u5E74" })
|
|
2426
2443
|
] }) }),
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u63D0\u70BC Provider", hint: "\u9ED8\u8BA4\u7EE7\u627F\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: automation.memory.provider ?? "", onChange: (event) => setAutomation((current) => ({ ...current, memory: { ...current.memory, provider: event.target.value, model: "" } })), children: [
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: "", children: [
|
|
2429
2446
|
"\u8DDF\u968F\u4F19\u4F34 \xB7 ",
|
|
2430
2447
|
inheritedProvider || "DSH \u9ED8\u8BA4"
|
|
2431
2448
|
] }),
|
|
2432
|
-
modelCatalog?.providers.map((provider) => /* @__PURE__ */ (0,
|
|
2449
|
+
modelCatalog?.providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: provider.id, children: provider.name || provider.id }, provider.id))
|
|
2433
2450
|
] }) }),
|
|
2434
|
-
/* @__PURE__ */ (0,
|
|
2435
|
-
/* @__PURE__ */ (0,
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u63D0\u70BC\u6A21\u578B", hint: "\u9ED8\u8BA4\u7EE7\u627F\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: automation.memory.model ?? "", onChange: (event) => setAutomation((current) => ({ ...current, memory: { ...current.memory, model: event.target.value } })), children: [
|
|
2452
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: "", children: [
|
|
2436
2453
|
"\u8DDF\u968F\u4F19\u4F34 \xB7 ",
|
|
2437
2454
|
companion.model || modelCatalog?.defaultSelection.model || "DSH \u9ED8\u8BA4"
|
|
2438
2455
|
] }),
|
|
2439
|
-
modelOptions.map((model) => /* @__PURE__ */ (0,
|
|
2456
|
+
modelOptions.map((model) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: model.id, children: model.name || model.id }, model.id))
|
|
2440
2457
|
] }) })
|
|
2441
2458
|
] }),
|
|
2442
|
-
/* @__PURE__ */ (0,
|
|
2443
|
-
/* @__PURE__ */ (0,
|
|
2444
|
-
/* @__PURE__ */ (0,
|
|
2445
|
-
/* @__PURE__ */ (0,
|
|
2446
|
-
/* @__PURE__ */ (0,
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-review-policy", children: [
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": automation.memory.dailyReviewEnabled, "aria-label": "\u542F\u7528\u6BCF\u65E5\u7EC8\u5BA1", onClick: () => setAutomation((current) => ({ ...current, memory: { ...current.memory, dailyReviewEnabled: !current.memory.dailyReviewEnabled } })), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}) }),
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2462
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u6BCF\u65E5\u7EC8\u5BA1" }),
|
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u6B21\u65E5\u81EA\u52A8\u5408\u5E76\u91CD\u590D\u3001\u7EA0\u6B63\u504F\u5DEE\u5E76\u5EFA\u7ACB\u8BB0\u5FC6\u5173\u7CFB" })
|
|
2447
2464
|
] }),
|
|
2448
|
-
/* @__PURE__ */ (0,
|
|
2465
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { "aria-label": "\u6BCF\u65E5\u7EC8\u5BA1\u65F6\u95F4", value: automation.memory.dailyReviewHour, onChange: (event) => setAutomation((current) => ({ ...current, memory: { ...current.memory, dailyReviewHour: Number(event.target.value) } })), children: Array.from({ length: 24 }, (_, hour) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: hour, children: [
|
|
2449
2466
|
String(hour).padStart(2, "0"),
|
|
2450
2467
|
":00"
|
|
2451
2468
|
] }, hour)) }) }),
|
|
2452
|
-
/* @__PURE__ */ (0,
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || reflections.length === 0, onClick: () => {
|
|
2453
2470
|
void review();
|
|
2454
2471
|
}, children: "\u7ACB\u5373\u7EC8\u5BA1" })
|
|
2455
2472
|
] })
|
|
2456
2473
|
] }),
|
|
2457
|
-
/* @__PURE__ */ (0,
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2459
|
-
/* @__PURE__ */ (0,
|
|
2460
|
-
/* @__PURE__ */ (0,
|
|
2461
|
-
/* @__PURE__ */ (0,
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-automation", children: [
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u4E3B\u52A8\u5DE1\u5BDF" }),
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u5468\u671F\u5524\u9192\u540E\u5728\u6709\u9650\u9884\u7B97\u5185\u53D1\u73B0\u5E76\u6838\u5B9E\u591A\u4E2A\u7EBF\u7D22\uFF1B\u53EA\u6709\u503C\u5F97\u544A\u8BC9\u4F60\u7684\u5185\u5BB9\u624D\u4F1A\u53D1\u9001\u3002" })
|
|
2462
2479
|
] }),
|
|
2463
|
-
/* @__PURE__ */ (0,
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": automation.heartbeat.enabled, "aria-label": "\u542F\u7528\u4F19\u4F34\u5FC3\u8DF3", onClick: () => setAutomation((current) => ({ ...current, heartbeat: { ...current.heartbeat, enabled: !current.heartbeat.enabled } })), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}) })
|
|
2464
2481
|
] }),
|
|
2465
|
-
/* @__PURE__ */ (0,
|
|
2466
|
-
/* @__PURE__ */ (0,
|
|
2467
|
-
/* @__PURE__ */ (0,
|
|
2468
|
-
/* @__PURE__ */ (0,
|
|
2469
|
-
/* @__PURE__ */ (0,
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2471
|
-
/* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-automation-fields is-heartbeat", children: [
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u68C0\u67E5\u95F4\u9694", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: automation.heartbeat.intervalMinutes, onChange: (event) => setAutomation((current) => ({ ...current, heartbeat: { ...current.heartbeat, intervalMinutes: Number(event.target.value) } })), children: [
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 30, children: "30 \u5206\u949F" }),
|
|
2485
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 60, children: "1 \u5C0F\u65F6" }),
|
|
2486
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 180, children: "3 \u5C0F\u65F6" }),
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 360, children: "6 \u5C0F\u65F6" }),
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 720, children: "12 \u5C0F\u65F6" }),
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 1440, children: "24 \u5C0F\u65F6" })
|
|
2473
2490
|
] }) }),
|
|
2474
|
-
/* @__PURE__ */ (0,
|
|
2475
|
-
/* @__PURE__ */ (0,
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
2478
|
-
/* @__PURE__ */ (0,
|
|
2479
|
-
/* @__PURE__ */ (0,
|
|
2480
|
-
/* @__PURE__ */ (0,
|
|
2481
|
-
/* @__PURE__ */ (0,
|
|
2482
|
-
/* @__PURE__ */ (0,
|
|
2491
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u514D\u6253\u6270\u5F00\u59CB", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "number", min: 0, max: 23, value: automation.heartbeat.quietStartHour, onChange: (event) => setAutomation((current) => ({ ...current, heartbeat: { ...current.heartbeat, quietStartHour: Number(event.target.value) } })) }) }),
|
|
2492
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u514D\u6253\u6270\u7ED3\u675F", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "number", min: 0, max: 23, value: automation.heartbeat.quietEndHour, onChange: (event) => setAutomation((current) => ({ ...current, heartbeat: { ...current.heartbeat, quietEndHour: Number(event.target.value) } })) }) }),
|
|
2493
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { label: "\u6BCF\u65E5\u4E0A\u9650", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: automation.heartbeat.dailyLimit, onChange: (event) => setAutomation((current) => ({ ...current, heartbeat: { ...current.heartbeat, dailyLimit: Number(event.target.value) } })), children: [
|
|
2494
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 0, children: "\u4E0D\u9650" }),
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 1, children: "1 \u6B21" }),
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 2, children: "2 \u6B21" }),
|
|
2497
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 3, children: "3 \u6B21" }),
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 5, children: "5 \u6B21" }),
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: 8, children: "8 \u6B21" })
|
|
2483
2500
|
] }) })
|
|
2484
2501
|
] }),
|
|
2485
|
-
heartbeat?.lastError && /* @__PURE__ */ (0,
|
|
2486
|
-
/* @__PURE__ */ (0,
|
|
2487
|
-
/* @__PURE__ */ (0,
|
|
2502
|
+
heartbeat?.lastError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-inline-error", children: heartbeat.lastError }),
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-automation-actions", children: [
|
|
2504
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || sessions.length === 0, onClick: () => {
|
|
2488
2505
|
void trigger();
|
|
2489
2506
|
}, children: "\u7ACB\u5373\u68C0\u67E5\u4E00\u6B21" }),
|
|
2490
|
-
/* @__PURE__ */ (0,
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "is-primary", disabled: busy, onClick: () => {
|
|
2491
2508
|
void save();
|
|
2492
2509
|
}, children: busy ? "\u6B63\u5728\u5904\u7406\u2026" : "\u4FDD\u5B58\u8BBE\u7F6E" })
|
|
2493
2510
|
] })
|
|
2494
2511
|
] })
|
|
2495
2512
|
] }),
|
|
2496
|
-
notice && /* @__PURE__ */ (0,
|
|
2497
|
-
/* @__PURE__ */ (0,
|
|
2513
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dsh-partner-inline-notice", children: [
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCheckOutline14, { size: 14 }),
|
|
2498
2515
|
notice
|
|
2499
2516
|
] }),
|
|
2500
|
-
error && /* @__PURE__ */ (0,
|
|
2501
|
-
/* @__PURE__ */ (0,
|
|
2517
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-partner-inline-error", children: error }),
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemoryLibrary, { memories, reflections, graph, editing, busy, setEditing, save: () => {
|
|
2502
2519
|
void saveMemory();
|
|
2503
2520
|
}, remove: (item) => {
|
|
2504
2521
|
void deleteMemory(item);
|
|
2505
2522
|
} }),
|
|
2506
|
-
/* @__PURE__ */ (0,
|
|
2507
|
-
/* @__PURE__ */ (0,
|
|
2508
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-section-heading", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "SESSIONS" }),
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u5171\u4EAB\u4F1A\u8BDD" })
|
|
2509
2526
|
] }) }),
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2511
|
-
sessions.map((item) => /* @__PURE__ */ (0,
|
|
2512
|
-
/* @__PURE__ */ (0,
|
|
2513
|
-
/* @__PURE__ */ (0,
|
|
2514
|
-
/* @__PURE__ */ (0,
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-session-list", children: [
|
|
2528
|
+
sessions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { "data-archived": item.archived, children: [
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconDataOutline16, { size: 16 }) }),
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
|
|
2515
2532
|
"\u5FAE\u4FE1\u8054\u7CFB\u4EBA \xB7 ",
|
|
2516
2533
|
item.userId.slice(-6)
|
|
2517
2534
|
] }),
|
|
2518
|
-
/* @__PURE__ */ (0,
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: item.archived ? "\u5DF2\u5F52\u6863 \xB7 \u957F\u671F\u8BB0\u5FC6\u4FDD\u7559" : `${item.sessionId} \xB7 ${new Date(item.lastMessageAt).toLocaleString()}` })
|
|
2519
2536
|
] }),
|
|
2520
|
-
/* @__PURE__ */ (0,
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: item.archived ? "is-primary" : void 0, onClick: () => {
|
|
2521
2538
|
if (item.archived) void renewSession(item.id);
|
|
2522
2539
|
else void openSession(item.id, item.sessionId);
|
|
2523
2540
|
}, children: item.archived ? "\u5F00\u59CB\u65B0\u4F1A\u8BDD" : "\u6253\u5F00\u4F1A\u8BDD" })
|
|
2524
2541
|
] }, item.id)),
|
|
2525
|
-
sessions.length === 0 && /* @__PURE__ */ (0,
|
|
2542
|
+
sessions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u8FD8\u6CA1\u6709\u5171\u4EAB\u4F1A\u8BDD", detail: "\u8054\u7CFB\u4EBA\u5B8C\u6210\u914D\u5BF9\u5E76\u53D1\u6765\u7B2C\u4E00\u6761\u6D88\u606F\u540E\uFF0C\u4F19\u4F34\u4F1A\u521B\u5EFA\u7F51\u9875\u4E0E\u5FAE\u4FE1\u5171\u7528\u7684\u4F1A\u8BDD\u3002", compact: true })
|
|
2526
2543
|
] })
|
|
2527
2544
|
] });
|
|
2528
2545
|
}
|
|
2529
2546
|
var MEMORY_KINDS = ["all", "profile", "preference", "task", "event", "relationship", "emotion"];
|
|
2530
2547
|
function MemoryLibrary({ memories, reflections, graph, editing, busy, setEditing, save, remove }) {
|
|
2531
|
-
const activeMemories = (0,
|
|
2532
|
-
const [mode, setMode] = (0,
|
|
2533
|
-
const [kind, setKind] = (0,
|
|
2534
|
-
const [query, setQuery] = (0,
|
|
2535
|
-
const [selectedMemoryId, setSelectedMemoryId] = (0,
|
|
2536
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
2548
|
+
const activeMemories = (0, import_react3.useMemo)(() => memories.filter((item) => item.status === "active"), [memories]);
|
|
2549
|
+
const [mode, setMode] = (0, import_react3.useState)("memory");
|
|
2550
|
+
const [kind, setKind] = (0, import_react3.useState)("all");
|
|
2551
|
+
const [query, setQuery] = (0, import_react3.useState)("");
|
|
2552
|
+
const [selectedMemoryId, setSelectedMemoryId] = (0, import_react3.useState)();
|
|
2553
|
+
const [selectedDate, setSelectedDate] = (0, import_react3.useState)();
|
|
2537
2554
|
const normalized = query.trim().toLocaleLowerCase();
|
|
2538
|
-
const filteredMemories = (0,
|
|
2555
|
+
const filteredMemories = (0, import_react3.useMemo)(() => activeMemories.filter(
|
|
2539
2556
|
(item) => (kind === "all" || item.kind === kind) && (!normalized || `${item.subject} ${item.content}`.toLocaleLowerCase().includes(normalized))
|
|
2540
2557
|
), [activeMemories, kind, normalized]);
|
|
2541
|
-
const filteredReflections = (0,
|
|
2558
|
+
const filteredReflections = (0, import_react3.useMemo)(() => reflections.filter(
|
|
2542
2559
|
(item) => !normalized || `${item.date} ${item.summary} ${item.events.join(" ")} ${item.openTasks.join(" ")} ${item.learnings.join(" ")}`.toLocaleLowerCase().includes(normalized)
|
|
2543
2560
|
), [reflections, normalized]);
|
|
2544
2561
|
const selectedMemory = filteredMemories.find((item) => item.id === selectedMemoryId) ?? filteredMemories[0];
|
|
2545
2562
|
const selectedReflection = filteredReflections.find((item) => item.date === selectedDate) ?? filteredReflections[0];
|
|
2546
|
-
return /* @__PURE__ */ (0,
|
|
2547
|
-
/* @__PURE__ */ (0,
|
|
2548
|
-
/* @__PURE__ */ (0,
|
|
2549
|
-
/* @__PURE__ */ (0,
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2551
|
-
/* @__PURE__ */ (0,
|
|
2563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-partner-memory-library", children: [
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-partner-library-header", children: [
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "MEMORY LIBRARY" }),
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u4F19\u4F34\u8BB0\u5FC6\u5E93" }),
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u6309\u7C7B\u578B\u68C0\u7D22\u957F\u671F\u7406\u89E3\uFF0C\u6216\u6309\u65E5\u671F\u56DE\u770B\u6BCF\u5929\u7684\u8BA4\u8BC6\u53D8\u5316\u3002" })
|
|
2552
2569
|
] }),
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2554
|
-
/* @__PURE__ */ (0,
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", { "aria-label": "\u8BB0\u5FC6\u5185\u5BB9", children: [
|
|
2571
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: mode === "memory" ? "is-active" : "", onClick: () => setMode("memory"), children: [
|
|
2555
2572
|
"\u957F\u671F\u8BB0\u5FC6 ",
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: activeMemories.length })
|
|
2557
2574
|
] }),
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: mode === "reflection" ? "is-active" : "", onClick: () => setMode("reflection"), children: [
|
|
2559
2576
|
"\u6BCF\u65E5\u56DE\u987E ",
|
|
2560
|
-
/* @__PURE__ */ (0,
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: reflections.length })
|
|
2561
2578
|
] }),
|
|
2562
|
-
/* @__PURE__ */ (0,
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: mode === "graph" ? "is-active" : "", onClick: () => setMode("graph"), children: [
|
|
2563
2580
|
"\u5173\u7CFB\u56FE\u8C31 ",
|
|
2564
|
-
/* @__PURE__ */ (0,
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: graph.relations.length })
|
|
2565
2582
|
] })
|
|
2566
2583
|
] })
|
|
2567
2584
|
] }),
|
|
2568
|
-
/* @__PURE__ */ (0,
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2570
|
-
/* @__PURE__ */ (0,
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-library-tools", children: [
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "\u641C\u7D22\u8BB0\u5FC6" }),
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: mode === "memory" ? "\u641C\u7D22\u4E3B\u9898\u6216\u8BB0\u5FC6\u5185\u5BB9" : "\u641C\u7D22\u65E5\u671F\u3001\u603B\u7ED3\u6216\u5F85\u529E" })
|
|
2572
2589
|
] }),
|
|
2573
|
-
mode === "memory" && /* @__PURE__ */ (0,
|
|
2590
|
+
mode === "memory" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-memory-kinds", children: MEMORY_KINDS.map((value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: kind === value ? "is-active" : "", onClick: () => setKind(value), children: value === "all" ? "\u5168\u90E8" : memoryKind(value) }, value)) })
|
|
2574
2591
|
] }),
|
|
2575
|
-
mode === "memory" ? /* @__PURE__ */ (0,
|
|
2576
|
-
/* @__PURE__ */ (0,
|
|
2592
|
+
mode === "memory" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-library-browser", children: [
|
|
2593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-library-list", role: "list", children: filteredMemories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: activeMemories.length === 0 ? "\u8FD8\u6CA1\u6709\u957F\u671F\u8BB0\u5FC6" : "\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6", detail: activeMemories.length === 0 ? "\u4F19\u4F34\u5B8C\u6210\u5BF9\u8BDD\u540E\u4F1A\u81EA\u52A8\u63D0\u70BC\u503C\u5F97\u957F\u671F\u4FDD\u7559\u7684\u4FE1\u606F\u3002" : "\u6362\u4E2A\u5173\u952E\u8BCD\u6216\u7C7B\u578B\u8BD5\u8BD5\u3002", compact: true }) : filteredMemories.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", role: "listitem", className: selectedMemory?.id === item.id ? "is-active" : "", onClick: () => {
|
|
2577
2594
|
setSelectedMemoryId(item.id);
|
|
2578
2595
|
setEditing(void 0);
|
|
2579
2596
|
}, children: [
|
|
2580
|
-
/* @__PURE__ */ (0,
|
|
2581
|
-
/* @__PURE__ */ (0,
|
|
2582
|
-
/* @__PURE__ */ (0,
|
|
2583
|
-
/* @__PURE__ */ (0,
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-kind": item.kind, children: memoryKind(item.kind) }),
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: item.subject }),
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: item.content }),
|
|
2600
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: relativeTime(item.updatedAt) })
|
|
2584
2601
|
] }, item.id)) }),
|
|
2585
|
-
/* @__PURE__ */ (0,
|
|
2586
|
-
] }) : mode === "reflection" ? /* @__PURE__ */ (0,
|
|
2587
|
-
/* @__PURE__ */ (0,
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
2589
|
-
/* @__PURE__ */ (0,
|
|
2602
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-library-detail", children: selectedMemory ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemoryCard, { item: selectedMemory, editing: editing?.id === selectedMemory.id ? editing : void 0, busy, setEditing, save, remove: () => remove(selectedMemory) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u9009\u62E9\u4E00\u6761\u8BB0\u5FC6", detail: "\u8BB0\u5FC6\u8BE6\u60C5\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002", compact: true }) })
|
|
2603
|
+
] }) : mode === "reflection" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-library-browser", children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-library-list is-diary", role: "list", children: filteredReflections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: reflections.length === 0 ? "\u8FD8\u6CA1\u6709\u6BCF\u65E5\u56DE\u987E" : "\u6CA1\u6709\u5339\u914D\u7684\u56DE\u987E", detail: reflections.length === 0 ? "\u6BCF\u65E5\u56DE\u987E\u4F1A\u5728\u6BCF\u8F6E\u5B8C\u6574\u5BF9\u8BDD\u540E\u6301\u7EED\u66F4\u65B0\u3002" : "\u6362\u4E2A\u5173\u952E\u8BCD\u6216\u65E5\u671F\u8BD5\u8BD5\u3002", compact: true }) : filteredReflections.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", role: "listitem", className: selectedReflection?.date === entry.date ? "is-active" : "", onClick: () => setSelectedDate(entry.date), children: [
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { children: entry.date }),
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
|
|
2590
2607
|
entry.turnCount,
|
|
2591
2608
|
" \u8F6E\u4EA4\u6D41"
|
|
2592
2609
|
] }),
|
|
2593
|
-
/* @__PURE__ */ (0,
|
|
2594
|
-
/* @__PURE__ */ (0,
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: entry.summary }),
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [
|
|
2595
2612
|
entry.openTasks.length,
|
|
2596
2613
|
" \u9879\u5F85\u8DDF\u8FDB \xB7 ",
|
|
2597
2614
|
entry.learnings.length,
|
|
2598
2615
|
" \u9879\u7406\u89E3"
|
|
2599
2616
|
] })
|
|
2600
2617
|
] }, entry.date)) }),
|
|
2601
|
-
/* @__PURE__ */ (0,
|
|
2602
|
-
] }) : /* @__PURE__ */ (0,
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-library-detail", children: selectedReflection ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DailyReflectionDetail, { entry: selectedReflection }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u9009\u62E9\u4E00\u5929", detail: "\u5F53\u5929\u7684\u603B\u7ED3\u4E0E\u5F85\u529E\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002", compact: true }) })
|
|
2619
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemoryGraph, { graph, query: normalized })
|
|
2603
2620
|
] });
|
|
2604
2621
|
}
|
|
2605
2622
|
function MemoryGraph({ graph, query }) {
|
|
2606
2623
|
const visible = graph.memories.filter((item) => !query || `${item.subject} ${item.content}`.toLocaleLowerCase().includes(query));
|
|
2607
|
-
const [selectedId, setSelectedId] = (0,
|
|
2624
|
+
const [selectedId, setSelectedId] = (0, import_react3.useState)();
|
|
2608
2625
|
const selected = visible.find((item) => item.id === selectedId) ?? visible[0];
|
|
2609
2626
|
const related = selected ? graph.relations.filter((item) => item.sourceMemoryId === selected.id || item.targetMemoryId === selected.id) : [];
|
|
2610
2627
|
const byId = new Map(graph.memories.map((item) => [item.id, item]));
|
|
2611
|
-
return /* @__PURE__ */ (0,
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
2613
|
-
/* @__PURE__ */ (0,
|
|
2614
|
-
/* @__PURE__ */ (0,
|
|
2615
|
-
/* @__PURE__ */ (0,
|
|
2628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-graph-browser", children: [
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-graph-index", children: visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u8FD8\u6CA1\u6709\u5173\u7CFB\u56FE\u8C31", detail: "\u5B8C\u6210\u6BCF\u65E5\u7EC8\u5BA1\u540E\uFF0C\u4F1A\u628A\u6709\u53EF\u9760\u8BC1\u636E\u7684\u8BB0\u5FC6\u5173\u7CFB\u6574\u7406\u5230\u8FD9\u91CC\u3002", compact: true }) : visible.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: selected?.id === item.id ? "is-active" : "", onClick: () => setSelectedId(item.id), children: [
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-kind": item.kind, children: memoryKind(item.kind) }),
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: item.subject }),
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [
|
|
2616
2633
|
graph.relations.filter((edge) => edge.sourceMemoryId === item.id || edge.targetMemoryId === item.id).length,
|
|
2617
2634
|
" \u6761\u5173\u7CFB"
|
|
2618
2635
|
] })
|
|
2619
2636
|
] }, item.id)) }),
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
2621
|
-
/* @__PURE__ */ (0,
|
|
2622
|
-
/* @__PURE__ */ (0,
|
|
2623
|
-
/* @__PURE__ */ (0,
|
|
2624
|
-
/* @__PURE__ */ (0,
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-graph-stage", children: selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-kind": selected.kind, children: memoryKind(selected.kind) }),
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: selected.subject }),
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: selected.content })
|
|
2625
2642
|
] }),
|
|
2626
|
-
/* @__PURE__ */ (0,
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-partner-graph-links", children: related.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(State, { title: "\u6682\u65E0\u53EF\u9760\u5173\u7CFB", detail: "\u7EC8\u5BA1\u4E0D\u4F1A\u4E3A\u4E86\u586B\u6EE1\u56FE\u8C31\u800C\u731C\u6D4B\u5173\u7CFB\u3002", compact: true }) : related.map((edge) => {
|
|
2627
2644
|
const outgoing = edge.sourceMemoryId === selected.id;
|
|
2628
2645
|
const target = byId.get(outgoing ? edge.targetMemoryId : edge.sourceMemoryId);
|
|
2629
|
-
return target ? /* @__PURE__ */ (0,
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2631
|
-
/* @__PURE__ */ (0,
|
|
2632
|
-
/* @__PURE__ */ (0,
|
|
2633
|
-
/* @__PURE__ */ (0,
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2646
|
+
return target ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", onClick: () => setSelectedId(target.id), children: [
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}),
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: outgoing ? relationLabel(edge.kind) : `\u88AB${relationLabel(edge.kind)}` }),
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: target.subject }),
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: edge.label })
|
|
2635
2652
|
] }),
|
|
2636
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("b", { children: [
|
|
2637
2654
|
Math.round(edge.confidence * 100),
|
|
2638
2655
|
"%"
|
|
2639
2656
|
] })
|
|
@@ -2646,53 +2663,53 @@ function relationLabel(kind) {
|
|
|
2646
2663
|
return { supports: "\u652F\u6301", depends_on: "\u4F9D\u8D56", about: "\u5173\u4E8E", conflicts_with: "\u51B2\u7A81", follows: "\u540E\u7EED" }[kind];
|
|
2647
2664
|
}
|
|
2648
2665
|
function DailyReflectionDetail({ entry }) {
|
|
2649
|
-
return /* @__PURE__ */ (0,
|
|
2650
|
-
/* @__PURE__ */ (0,
|
|
2651
|
-
/* @__PURE__ */ (0,
|
|
2652
|
-
/* @__PURE__ */ (0,
|
|
2666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { className: "dsh-partner-diary-detail", children: [
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { children: entry.date }),
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
|
|
2653
2670
|
entry.turnCount,
|
|
2654
2671
|
" \u8F6E\u4EA4\u6D41\u540E\u7684\u7406\u89E3"
|
|
2655
2672
|
] }),
|
|
2656
|
-
/* @__PURE__ */ (0,
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [
|
|
2657
2674
|
"\u66F4\u65B0\u4E8E ",
|
|
2658
2675
|
new Date(entry.updatedAt).toLocaleString()
|
|
2659
2676
|
] })
|
|
2660
2677
|
] }),
|
|
2661
|
-
/* @__PURE__ */ (0,
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2663
|
-
/* @__PURE__ */ (0,
|
|
2664
|
-
/* @__PURE__ */ (0,
|
|
2665
|
-
/* @__PURE__ */ (0,
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: entry.summary }),
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReflectionGroup, { title: "\u5F85\u8DDF\u8FDB", items: entry.openTasks }),
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReflectionGroup, { title: "\u5F53\u5929\u4E8B\u4EF6", items: entry.events }),
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReflectionGroup, { title: "\u65B0\u7406\u89E3", items: entry.learnings }),
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReflectionGroup, { title: "\u5DF2\u5B8C\u6210", items: entry.completedTasks })
|
|
2666
2683
|
] });
|
|
2667
2684
|
}
|
|
2668
2685
|
function ReflectionGroup({ title, items }) {
|
|
2669
2686
|
if (items.length === 0) return null;
|
|
2670
|
-
return /* @__PURE__ */ (0,
|
|
2671
|
-
/* @__PURE__ */ (0,
|
|
2672
|
-
/* @__PURE__ */ (0,
|
|
2687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { children: [
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: title }),
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: item }, item)) })
|
|
2673
2690
|
] });
|
|
2674
2691
|
}
|
|
2675
2692
|
function MemoryCard({ item, editing, busy, setEditing, save, remove }) {
|
|
2676
|
-
return /* @__PURE__ */ (0,
|
|
2677
|
-
/* @__PURE__ */ (0,
|
|
2678
|
-
/* @__PURE__ */ (0,
|
|
2679
|
-
/* @__PURE__ */ (0,
|
|
2680
|
-
/* @__PURE__ */ (0,
|
|
2681
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { "data-kind": item.kind, children: editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-partner-memory-editor", children: [
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { "aria-label": "\u8BB0\u5FC6\u4E3B\u9898", value: editing.subject, onChange: (event) => setEditing({ ...editing, subject: event.target.value }) }),
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { "aria-label": "\u8BB0\u5FC6\u5185\u5BB9", value: editing.content, onChange: (event) => setEditing({ ...editing, content: event.target.value }) }),
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setEditing(void 0), children: "\u53D6\u6D88" }),
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "is-primary", disabled: busy || !editing.subject.trim() || !editing.content.trim(), onClick: save, children: "\u4FDD\u5B58\u4FEE\u6B63" })
|
|
2682
2699
|
] })
|
|
2683
|
-
] }) : /* @__PURE__ */ (0,
|
|
2684
|
-
/* @__PURE__ */ (0,
|
|
2685
|
-
/* @__PURE__ */ (0,
|
|
2686
|
-
/* @__PURE__ */ (0,
|
|
2687
|
-
/* @__PURE__ */ (0,
|
|
2688
|
-
/* @__PURE__ */ (0,
|
|
2700
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: memoryKind(item.kind) }),
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2704
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setEditing({ ...item }), children: "\u7F16\u8F91" }),
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: remove, children: "\u5220\u9664" })
|
|
2689
2706
|
] })
|
|
2690
2707
|
] }),
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
2692
|
-
/* @__PURE__ */ (0,
|
|
2693
|
-
/* @__PURE__ */ (0,
|
|
2694
|
-
/* @__PURE__ */ (0,
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2708
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: item.subject }),
|
|
2709
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: item.content }),
|
|
2710
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { children: [
|
|
2711
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("progress", { max: 1, value: item.confidence, "aria-label": `\u7F6E\u4FE1\u5EA6 ${Math.round(item.confidence * 100)}%` }),
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [
|
|
2696
2713
|
item.locked ? "\u624B\u52A8\u786E\u8BA4" : `${Math.round(item.confidence * 100)}% \u53EF\u4FE1`,
|
|
2697
2714
|
" \xB7 ",
|
|
2698
2715
|
relativeTime(item.updatedAt)
|
|
@@ -2702,8 +2719,8 @@ function MemoryCard({ item, editing, busy, setEditing, save, remove }) {
|
|
|
2702
2719
|
}
|
|
2703
2720
|
function Status({ channel }) {
|
|
2704
2721
|
const status = !channel ? "unbound" : channel.runtimeStatus;
|
|
2705
|
-
return /* @__PURE__ */ (0,
|
|
2706
|
-
/* @__PURE__ */ (0,
|
|
2722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `dsh-partner-status is-${status}`, children: [
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}),
|
|
2707
2724
|
!channel ? "\u672A\u8FDE\u63A5" : statusLabel(channel.runtimeStatus)
|
|
2708
2725
|
] });
|
|
2709
2726
|
}
|
|
@@ -2711,41 +2728,41 @@ function statusLabel(status) {
|
|
|
2711
2728
|
return status === "running" ? "\u5FAE\u4FE1\u5728\u7EBF" : status === "starting" ? "\u8FDE\u63A5\u4E2D" : status === "error" ? "\u8FDE\u63A5\u5F02\u5E38" : "\u5DF2\u505C\u7528";
|
|
2712
2729
|
}
|
|
2713
2730
|
function Avatar({ name, small = false }) {
|
|
2714
|
-
return /* @__PURE__ */ (0,
|
|
2731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-partner-avatar${small ? " is-small" : ""}`, "aria-hidden": "true", children: [...name][0] ?? "\u4F34" });
|
|
2715
2732
|
}
|
|
2716
2733
|
function WeixinGlyph({ large = false }) {
|
|
2717
|
-
return /* @__PURE__ */ (0,
|
|
2718
|
-
/* @__PURE__ */ (0,
|
|
2719
|
-
/* @__PURE__ */ (0,
|
|
2734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `dsh-partner-weixin-glyph${large ? " is-large" : ""}`, "aria-hidden": "true", children: [
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {}),
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", {})
|
|
2720
2737
|
] });
|
|
2721
2738
|
}
|
|
2722
2739
|
function TabButton({ active, onClick, icon, children }) {
|
|
2723
|
-
return /* @__PURE__ */ (0,
|
|
2740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: active ? "is-active" : "", onClick, children: [
|
|
2724
2741
|
icon,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children })
|
|
2726
2743
|
] });
|
|
2727
2744
|
}
|
|
2728
2745
|
function Field({ label, hint, children }) {
|
|
2729
|
-
return /* @__PURE__ */ (0,
|
|
2730
|
-
/* @__PURE__ */ (0,
|
|
2731
|
-
/* @__PURE__ */ (0,
|
|
2732
|
-
hint && /* @__PURE__ */ (0,
|
|
2746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-partner-field", children: [
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: label }),
|
|
2749
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: hint })
|
|
2733
2750
|
] }),
|
|
2734
2751
|
children
|
|
2735
2752
|
] });
|
|
2736
2753
|
}
|
|
2737
2754
|
function Section({ eyebrow, title, detail }) {
|
|
2738
|
-
return /* @__PURE__ */ (0,
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2741
|
-
/* @__PURE__ */ (0,
|
|
2755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-partner-section", children: [
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: eyebrow }),
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: title }),
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: detail })
|
|
2742
2759
|
] });
|
|
2743
2760
|
}
|
|
2744
2761
|
function State({ title, detail, action, compact = false }) {
|
|
2745
|
-
return /* @__PURE__ */ (0,
|
|
2746
|
-
/* @__PURE__ */ (0,
|
|
2747
|
-
/* @__PURE__ */ (0,
|
|
2748
|
-
detail && /* @__PURE__ */ (0,
|
|
2762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `dsh-partner-state${compact ? " is-compact" : ""}`, children: [
|
|
2763
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 20 }),
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: title }),
|
|
2765
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: detail }),
|
|
2749
2766
|
action
|
|
2750
2767
|
] });
|
|
2751
2768
|
}
|