@istarry/dsh-assistant-profile 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +575 -7
- package/lib/client.js.map +1 -1
- package/lib/index.js +476 -31
- package/package.json +7 -2
package/lib/client.js
CHANGED
|
@@ -7,6 +7,7 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
10
11
|
/** 三个内置人格,顺序即界面顺序。 */
|
|
11
12
|
const BUILTIN_PERSONAS = [
|
|
12
13
|
{
|
|
@@ -102,13 +103,13 @@ window.__ModuleLoader__.load({
|
|
|
102
103
|
];
|
|
103
104
|
//#endregion
|
|
104
105
|
//#region \0assistant-css:E:\Plugin\发布版\dsh-assistant-profile\src\client\ProfilePage.module.css.mjs
|
|
105
|
-
const css = "._2lYP0a_page{box-sizing:border-box;background:var(--dsw-alias-bg-layer-1);min-height:100%;padding:28px 32px 48px;overflow-y:auto}._2lYP0a_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:16px;margin:0 auto;display:flex}._2lYP0a_head{flex-direction:column;gap:4px;display:flex}._2lYP0a_title{margin:0;font-size:18px;font-weight:600;line-height:26px}._2lYP0a_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px;line-height:20px}._2lYP0a_form{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:18px;padding:20px;display:flex}._2lYP0a_row{grid-template-columns:minmax(0,1fr) minmax(0,240px);gap:16px;display:grid}@media (width<=640px){._2lYP0a_row{grid-template-columns:minmax(0,1fr)}}._2lYP0a_field{flex-direction:column;gap:6px;min-width:0;display:flex}._2lYP0a_label{font-size:13px;font-weight:500;line-height:18px}._2lYP0a_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._2lYP0a_hintWarn{color:var(--dsw-alias-state-warn-label)}._2lYP0a_control{width:100%}._2lYP0a_textareaWrap{position:relative}._2lYP0a_textarea{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:168px;color:var(--dsw-alias-label-primary);resize:vertical;outline:none;padding:9px 12px 26px;font-family:inherit;font-size:13px;line-height:21px;display:block}._2lYP0a_textarea::placeholder{color:var(--dsw-alias-label-dimmed)}._2lYP0a_textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary)}._2lYP0a_counter{color:var(--dsw-alias-label-tertiary);pointer-events:none;font-size:11px;line-height:14px;position:absolute;bottom:8px;right:10px}._2lYP0a_counter[data-long=true]{color:var(--dsw-alias-state-warn-label)}._2lYP0a_status{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._2lYP0a_statusError{color:var(--dsw-alias-state-error-primary)}._2lYP0a_footer{align-items:center;gap:10px;padding-top:2px;display:flex}._2lYP0a_presets{scrollbar-width:thin;flex:1;align-items:center;gap:6px;min-width:0;padding:2px 0;display:flex;overflow-x:auto}._2lYP0a_chip{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:999px;flex:none;padding:3px 10px;font-size:12px;line-height:18px;transition:background .12s,border-color .12s,color .12s}._2lYP0a_chip:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._2lYP0a_chip:disabled{cursor:default;opacity:.55}._2lYP0a_chipActive{border-color:var(--dsw-static-neutral-bluish-400);background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary)}._2lYP0a_custom{border:.5px solid var(--dsw-alias-border-l3);background:0 0;border-radius:999px;flex:none;align-items:center;transition:background .12s,border-color .12s;display:inline-flex}._2lYP0a_custom:hover{background:var(--dsw-alias-interactive-bg-hover)}._2lYP0a_custom ._2lYP0a_chip{border:none;border-radius:999px 0 0 999px;padding-right:4px}._2lYP0a_customDelete{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:0 999px 999px 0;padding:3px 8px 3px 2px;font-size:13px;line-height:18px}._2lYP0a_customDelete:hover:not(:disabled){color:var(--dsw-alias-state-error-primary)}._2lYP0a_customDelete:disabled{cursor:default;opacity:.55}._2lYP0a_nameplate{box-sizing:border-box;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;margin:12px 2px 0;padding:0 10px 8px;display:flex}._2lYP0a_nameplate[data-collapsed=true],._2lYP0a_nameplate[hidden]{display:none}._2lYP0a_nameplateText{text-align:center;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}";
|
|
106
|
-
const tagId = "@istarry/dsh-assistant-profile/ProfilePage.module.css";
|
|
107
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
106
|
+
const css$1 = "._2lYP0a_page{box-sizing:border-box;background:var(--dsw-alias-bg-layer-1);min-height:100%;padding:28px 32px 48px;overflow-y:auto}._2lYP0a_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:16px;margin:0 auto;display:flex}._2lYP0a_head{flex-direction:column;gap:4px;display:flex}._2lYP0a_title{margin:0;font-size:18px;font-weight:600;line-height:26px}._2lYP0a_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px;line-height:20px}._2lYP0a_form{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:18px;padding:20px;display:flex}._2lYP0a_row{grid-template-columns:minmax(0,1fr) minmax(0,240px);gap:16px;display:grid}@media (width<=640px){._2lYP0a_row{grid-template-columns:minmax(0,1fr)}}._2lYP0a_field{flex-direction:column;gap:6px;min-width:0;display:flex}._2lYP0a_label{font-size:13px;font-weight:500;line-height:18px}._2lYP0a_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._2lYP0a_hintWarn{color:var(--dsw-alias-state-warn-label)}._2lYP0a_control{width:100%}._2lYP0a_textareaWrap{position:relative}._2lYP0a_textarea{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:168px;color:var(--dsw-alias-label-primary);resize:vertical;outline:none;padding:9px 12px 26px;font-family:inherit;font-size:13px;line-height:21px;display:block}._2lYP0a_textarea::placeholder{color:var(--dsw-alias-label-dimmed)}._2lYP0a_textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary)}._2lYP0a_counter{color:var(--dsw-alias-label-tertiary);pointer-events:none;font-size:11px;line-height:14px;position:absolute;bottom:8px;right:10px}._2lYP0a_counter[data-long=true]{color:var(--dsw-alias-state-warn-label)}._2lYP0a_status{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._2lYP0a_statusError{color:var(--dsw-alias-state-error-primary)}._2lYP0a_footer{align-items:center;gap:10px;padding-top:2px;display:flex}._2lYP0a_presets{scrollbar-width:thin;flex:1;align-items:center;gap:6px;min-width:0;padding:2px 0;display:flex;overflow-x:auto}._2lYP0a_chip{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:999px;flex:none;padding:3px 10px;font-size:12px;line-height:18px;transition:background .12s,border-color .12s,color .12s}._2lYP0a_chip:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._2lYP0a_chip:disabled{cursor:default;opacity:.55}._2lYP0a_chipActive{border-color:var(--dsw-static-neutral-bluish-400);background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary)}._2lYP0a_custom{border:.5px solid var(--dsw-alias-border-l3);background:0 0;border-radius:999px;flex:none;align-items:center;transition:background .12s,border-color .12s;display:inline-flex}._2lYP0a_custom:hover{background:var(--dsw-alias-interactive-bg-hover)}._2lYP0a_custom ._2lYP0a_chip{border:none;border-radius:999px 0 0 999px;padding-right:4px}._2lYP0a_customDelete{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:0 999px 999px 0;padding:3px 8px 3px 2px;font-size:13px;line-height:18px}._2lYP0a_customDelete:hover:not(:disabled){color:var(--dsw-alias-state-error-primary)}._2lYP0a_customDelete:disabled{cursor:default;opacity:.55}._2lYP0a_nameplate{box-sizing:border-box;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;margin:12px 2px 0;padding:0 10px 8px;display:flex}._2lYP0a_nameplate[data-collapsed=true],._2lYP0a_nameplate[hidden]{display:none}._2lYP0a_nameplateText{text-align:center;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}";
|
|
107
|
+
const tagId$1 = "@istarry/dsh-assistant-profile/ProfilePage.module.css";
|
|
108
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
108
109
|
const tag = document.createElement("style");
|
|
109
110
|
tag.dataset.plugin = "@istarry/dsh-assistant-profile";
|
|
110
|
-
tag.dataset.pluginCss = tagId;
|
|
111
|
-
tag.textContent = css;
|
|
111
|
+
tag.dataset.pluginCss = tagId$1;
|
|
112
|
+
tag.textContent = css$1;
|
|
112
113
|
document.head.appendChild(tag);
|
|
113
114
|
}
|
|
114
115
|
var ProfilePage_module_css_default = {
|
|
@@ -678,6 +679,494 @@ window.__ModuleLoader__.load({
|
|
|
678
679
|
};
|
|
679
680
|
}
|
|
680
681
|
//#endregion
|
|
682
|
+
//#region \0assistant-css:E:\Plugin\发布版\dsh-assistant-profile\src\client\MemorySection.module.css.mjs
|
|
683
|
+
const css = "._26v_lW_page{flex-direction:column;gap:18px;padding:4px 0 24px;display:flex}._26v_lW_title{margin:0;font-size:16px;font-weight:600}._26v_lW_intro{opacity:.72;margin:0;font-size:13px;line-height:1.6}._26v_lW_group{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex-direction:column;gap:10px;padding:14px;display:flex}._26v_lW_groupHead{margin:0;font-size:13px;font-weight:600}._26v_lW_row{justify-content:space-between;align-items:center;gap:16px;padding:6px 0;display:flex}._26v_lW_rowText{flex-direction:column;gap:3px;display:flex}._26v_lW_rowTitle{font-size:13px}._26v_lW_rowDesc{opacity:.62;margin:0;font-size:12px;line-height:1.5}._26v_lW_switch{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-interactive-bg-default);cursor:pointer;border-radius:11px;flex:none;width:38px;height:22px;padding:0;transition:background .15s;position:relative}._26v_lW_switch:disabled{opacity:.45;cursor:not-allowed}._26v_lW_on{background:var(--dsw-static-deepseek-500,#4d6bfe);border-color:#0000}._26v_lW_knob{background:#fff;border-radius:50%;width:16px;height:16px;transition:transform .15s;position:absolute;top:2px;left:2px}._26v_lW_on ._26v_lW_knob{transform:translate(16px)}._26v_lW_editorHead{justify-content:space-between;align-items:baseline;display:flex}._26v_lW_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:100%;color:inherit;resize:vertical;border-radius:8px;padding:10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.6}._26v_lW_actions{flex-wrap:wrap;align-items:center;gap:10px;display:flex}._26v_lW_primary,._26v_lW_secondary{cursor:pointer;border-radius:7px;padding:5px 14px;font-size:12px}._26v_lW_primary{background:var(--dsw-static-deepseek-500,#4d6bfe);color:#fff;border:1px solid #0000}._26v_lW_secondary{border:1px solid var(--dsw-alias-border-l1);color:inherit;background:0 0}._26v_lW_primary:disabled,._26v_lW_secondary:disabled{opacity:.45;cursor:not-allowed}._26v_lW_link{color:var(--dsw-static-deepseek-500,#4d6bfe);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px}._26v_lW_ok{color:var(--dsw-static-deepseek-500,#4d6bfe);font-size:12px}._26v_lW_error{color:#d33;margin:0;font-size:12px}._26v_lW_overlay{z-index:60;background:#00000059;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}._26v_lW_dialog{background:var(--dsw-alias-bg-overlay,#fff);border-radius:12px;flex-direction:column;gap:12px;width:min(560px,92vw);max-height:84vh;padding:18px;display:flex;overflow:auto;box-shadow:0 12px 40px #00000038}._26v_lW_dialogTitle{margin:0;font-size:14px;font-weight:600}";
|
|
684
|
+
const tagId = "@istarry/dsh-assistant-profile/MemorySection.module.css";
|
|
685
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
686
|
+
const tag = document.createElement("style");
|
|
687
|
+
tag.dataset.plugin = "@istarry/dsh-assistant-profile";
|
|
688
|
+
tag.dataset.pluginCss = tagId;
|
|
689
|
+
tag.textContent = css;
|
|
690
|
+
document.head.appendChild(tag);
|
|
691
|
+
}
|
|
692
|
+
var MemorySection_module_css_default = {
|
|
693
|
+
"actions": "_26v_lW_actions",
|
|
694
|
+
"dialog": "_26v_lW_dialog",
|
|
695
|
+
"dialogTitle": "_26v_lW_dialogTitle",
|
|
696
|
+
"editorHead": "_26v_lW_editorHead",
|
|
697
|
+
"error": "_26v_lW_error",
|
|
698
|
+
"group": "_26v_lW_group",
|
|
699
|
+
"groupHead": "_26v_lW_groupHead",
|
|
700
|
+
"intro": "_26v_lW_intro",
|
|
701
|
+
"knob": "_26v_lW_knob",
|
|
702
|
+
"link": "_26v_lW_link",
|
|
703
|
+
"ok": "_26v_lW_ok",
|
|
704
|
+
"on": "_26v_lW_on",
|
|
705
|
+
"overlay": "_26v_lW_overlay",
|
|
706
|
+
"page": "_26v_lW_page",
|
|
707
|
+
"primary": "_26v_lW_primary",
|
|
708
|
+
"row": "_26v_lW_row",
|
|
709
|
+
"rowDesc": "_26v_lW_rowDesc",
|
|
710
|
+
"rowText": "_26v_lW_rowText",
|
|
711
|
+
"rowTitle": "_26v_lW_rowTitle",
|
|
712
|
+
"secondary": "_26v_lW_secondary",
|
|
713
|
+
"switch": "_26v_lW_switch",
|
|
714
|
+
"textarea": "_26v_lW_textarea",
|
|
715
|
+
"title": "_26v_lW_title"
|
|
716
|
+
};
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region ../src/client/MemorySection.tsx
|
|
719
|
+
/**
|
|
720
|
+
* 「Agent记忆」设置页。
|
|
721
|
+
*
|
|
722
|
+
* 一页四块:两个开关、记忆编辑框、提炼按钮、提炼弹窗。开关是互锁的——记忆关掉时
|
|
723
|
+
* 自动记忆灰置不可点,因为不注入的记忆没有意义。
|
|
724
|
+
*
|
|
725
|
+
* @module @istarry/dsh-assistant-profile/client/MemorySection
|
|
726
|
+
*/
|
|
727
|
+
/** 渲染设置页。 */
|
|
728
|
+
function MemorySection({ useMemorySection, toggle, setDraft, save, load, openPicker, closePicker, remember, t }) {
|
|
729
|
+
const state = useMemorySection((value) => value);
|
|
730
|
+
const [busy, setBusy] = (0, react.useState)(null);
|
|
731
|
+
const [pickerText, setPickerText] = (0, react.useState)("");
|
|
732
|
+
(0, react.useEffect)(() => {
|
|
733
|
+
load();
|
|
734
|
+
}, [load]);
|
|
735
|
+
const ready = state.status === "ready";
|
|
736
|
+
const memoryOn = state.switches.memoryEnabled;
|
|
737
|
+
const flip = (field, next) => {
|
|
738
|
+
setBusy(field);
|
|
739
|
+
toggle(field, next).finally(() => {
|
|
740
|
+
setBusy(null);
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
const { editor, remember: rememberState } = state;
|
|
744
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
745
|
+
className: MemorySection_module_css_default.page,
|
|
746
|
+
children: [
|
|
747
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
748
|
+
className: MemorySection_module_css_default.title,
|
|
749
|
+
children: t("memory.nav")
|
|
750
|
+
}),
|
|
751
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
752
|
+
className: MemorySection_module_css_default.intro,
|
|
753
|
+
children: t("memory.intro")
|
|
754
|
+
}),
|
|
755
|
+
state.status === "unavailable" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
756
|
+
className: MemorySection_module_css_default.error,
|
|
757
|
+
role: "alert",
|
|
758
|
+
children: t("memory.unavailable")
|
|
759
|
+
}),
|
|
760
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
761
|
+
className: MemorySection_module_css_default.group,
|
|
762
|
+
children: [
|
|
763
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
764
|
+
className: MemorySection_module_css_default.groupHead,
|
|
765
|
+
children: t("memory.switches")
|
|
766
|
+
}),
|
|
767
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
768
|
+
className: MemorySection_module_css_default.row,
|
|
769
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
770
|
+
className: MemorySection_module_css_default.rowText,
|
|
771
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
772
|
+
className: MemorySection_module_css_default.rowTitle,
|
|
773
|
+
children: t("memory.enabled.title")
|
|
774
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
775
|
+
className: MemorySection_module_css_default.rowDesc,
|
|
776
|
+
children: t("memory.enabled.description")
|
|
777
|
+
})]
|
|
778
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
779
|
+
type: "button",
|
|
780
|
+
role: "switch",
|
|
781
|
+
"aria-checked": memoryOn,
|
|
782
|
+
"aria-label": t("memory.enabled.title"),
|
|
783
|
+
className: memoryOn ? `${MemorySection_module_css_default.switch} ${MemorySection_module_css_default.on}` : MemorySection_module_css_default.switch,
|
|
784
|
+
disabled: !ready || busy === "memoryEnabled",
|
|
785
|
+
onClick: () => {
|
|
786
|
+
flip("memoryEnabled", !memoryOn);
|
|
787
|
+
},
|
|
788
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: MemorySection_module_css_default.knob })
|
|
789
|
+
})]
|
|
790
|
+
}),
|
|
791
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
792
|
+
className: MemorySection_module_css_default.row,
|
|
793
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
794
|
+
className: MemorySection_module_css_default.rowText,
|
|
795
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
796
|
+
className: MemorySection_module_css_default.rowTitle,
|
|
797
|
+
children: t("memory.auto.title")
|
|
798
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
799
|
+
className: MemorySection_module_css_default.rowDesc,
|
|
800
|
+
children: memoryOn ? t("memory.auto.description") : t("memory.auto.locked")
|
|
801
|
+
})]
|
|
802
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
803
|
+
type: "button",
|
|
804
|
+
role: "switch",
|
|
805
|
+
"aria-checked": state.switches.autoMemory,
|
|
806
|
+
"aria-label": t("memory.auto.title"),
|
|
807
|
+
className: state.switches.autoMemory ? `${MemorySection_module_css_default.switch} ${MemorySection_module_css_default.on}` : MemorySection_module_css_default.switch,
|
|
808
|
+
disabled: !ready || !memoryOn || busy === "autoMemory",
|
|
809
|
+
onClick: () => {
|
|
810
|
+
flip("autoMemory", !state.switches.autoMemory);
|
|
811
|
+
},
|
|
812
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: MemorySection_module_css_default.knob })
|
|
813
|
+
})]
|
|
814
|
+
})
|
|
815
|
+
]
|
|
816
|
+
}),
|
|
817
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
818
|
+
className: MemorySection_module_css_default.group,
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
821
|
+
className: MemorySection_module_css_default.editorHead,
|
|
822
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
823
|
+
className: MemorySection_module_css_default.groupHead,
|
|
824
|
+
children: t("memory.editor")
|
|
825
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
826
|
+
type: "button",
|
|
827
|
+
className: MemorySection_module_css_default.link,
|
|
828
|
+
disabled: !ready,
|
|
829
|
+
onClick: () => {
|
|
830
|
+
load();
|
|
831
|
+
},
|
|
832
|
+
children: t("memory.reload")
|
|
833
|
+
})]
|
|
834
|
+
}),
|
|
835
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
836
|
+
className: MemorySection_module_css_default.rowDesc,
|
|
837
|
+
children: t("memory.editor.hint")
|
|
838
|
+
}),
|
|
839
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
840
|
+
className: MemorySection_module_css_default.textarea,
|
|
841
|
+
value: editor.text,
|
|
842
|
+
placeholder: t("memory.editor.placeholder"),
|
|
843
|
+
rows: 12,
|
|
844
|
+
disabled: !ready || editor.saveState === "saving",
|
|
845
|
+
onChange: (event) => {
|
|
846
|
+
setDraft(event.target.value);
|
|
847
|
+
}
|
|
848
|
+
}),
|
|
849
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
850
|
+
className: MemorySection_module_css_default.actions,
|
|
851
|
+
children: [
|
|
852
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
853
|
+
type: "button",
|
|
854
|
+
className: MemorySection_module_css_default.primary,
|
|
855
|
+
disabled: !ready || editor.saveState === "saving",
|
|
856
|
+
onClick: () => {
|
|
857
|
+
save();
|
|
858
|
+
},
|
|
859
|
+
children: editor.saveState === "saving" ? t("memory.saving") : t("memory.save")
|
|
860
|
+
}),
|
|
861
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
862
|
+
type: "button",
|
|
863
|
+
className: MemorySection_module_css_default.secondary,
|
|
864
|
+
disabled: !ready,
|
|
865
|
+
onClick: openPicker,
|
|
866
|
+
children: t("memory.remember")
|
|
867
|
+
}),
|
|
868
|
+
editor.saveState === "saved" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
869
|
+
className: MemorySection_module_css_default.ok,
|
|
870
|
+
role: "status",
|
|
871
|
+
children: t("memory.saved")
|
|
872
|
+
}),
|
|
873
|
+
editor.saveState === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
874
|
+
className: MemorySection_module_css_default.error,
|
|
875
|
+
role: "alert",
|
|
876
|
+
children: editor.error ?? t("memory.saveFailed")
|
|
877
|
+
}),
|
|
878
|
+
rememberState.state === "done" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
879
|
+
className: MemorySection_module_css_default.ok,
|
|
880
|
+
role: "status",
|
|
881
|
+
children: [
|
|
882
|
+
t("memory.remembered"),
|
|
883
|
+
" ",
|
|
884
|
+
rememberState.message
|
|
885
|
+
]
|
|
886
|
+
}),
|
|
887
|
+
rememberState.state === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
888
|
+
className: MemorySection_module_css_default.error,
|
|
889
|
+
role: "alert",
|
|
890
|
+
children: rememberState.message
|
|
891
|
+
})
|
|
892
|
+
]
|
|
893
|
+
})
|
|
894
|
+
]
|
|
895
|
+
}),
|
|
896
|
+
state.picker && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
897
|
+
className: MemorySection_module_css_default.overlay,
|
|
898
|
+
role: "dialog",
|
|
899
|
+
"aria-modal": "true",
|
|
900
|
+
"aria-label": t("memory.picker.title"),
|
|
901
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
902
|
+
className: MemorySection_module_css_default.dialog,
|
|
903
|
+
children: [
|
|
904
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
905
|
+
className: MemorySection_module_css_default.dialogTitle,
|
|
906
|
+
children: t("memory.picker.title")
|
|
907
|
+
}),
|
|
908
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
909
|
+
className: MemorySection_module_css_default.rowDesc,
|
|
910
|
+
children: t("memory.picker.hint")
|
|
911
|
+
}),
|
|
912
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
913
|
+
className: MemorySection_module_css_default.textarea,
|
|
914
|
+
value: pickerText,
|
|
915
|
+
placeholder: t("memory.picker.placeholder"),
|
|
916
|
+
rows: 6,
|
|
917
|
+
onChange: (event) => {
|
|
918
|
+
setPickerText(event.target.value);
|
|
919
|
+
}
|
|
920
|
+
}),
|
|
921
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
922
|
+
className: MemorySection_module_css_default.actions,
|
|
923
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
924
|
+
type: "button",
|
|
925
|
+
className: MemorySection_module_css_default.primary,
|
|
926
|
+
disabled: rememberState.state === "running" || pickerText.trim() === "" || state.sessions.length === 0,
|
|
927
|
+
onClick: () => {
|
|
928
|
+
const first = state.sessions[0];
|
|
929
|
+
if (first !== void 0) remember(first.id, pickerText);
|
|
930
|
+
},
|
|
931
|
+
children: rememberState.state === "running" ? t("memory.running") : t("memory.picker.run")
|
|
932
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
933
|
+
type: "button",
|
|
934
|
+
className: MemorySection_module_css_default.secondary,
|
|
935
|
+
onClick: closePicker,
|
|
936
|
+
children: t("memory.picker.cancel")
|
|
937
|
+
})]
|
|
938
|
+
}),
|
|
939
|
+
state.sessions.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
940
|
+
className: MemorySection_module_css_default.error,
|
|
941
|
+
children: t("memory.picker.noSessions")
|
|
942
|
+
})
|
|
943
|
+
]
|
|
944
|
+
})
|
|
945
|
+
})
|
|
946
|
+
]
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region ../src/client/memoryStore.ts
|
|
951
|
+
/** 把持久化的开关段解码成两个开关(形状不对时全关)。 */
|
|
952
|
+
function decodeSwitches(section) {
|
|
953
|
+
const source = typeof section === "object" && section !== null && !Array.isArray(section) ? section : {};
|
|
954
|
+
return {
|
|
955
|
+
memoryEnabled: source.memoryEnabled === true,
|
|
956
|
+
autoMemory: source.autoMemory === true
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
/** 设置页控制器(每个浏览器页面一个)。 */
|
|
960
|
+
var MemorySettingsController = class {
|
|
961
|
+
form;
|
|
962
|
+
resolveRemote;
|
|
963
|
+
resolveSessions;
|
|
964
|
+
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
|
|
965
|
+
status: "loading",
|
|
966
|
+
switches: decodeSwitches(void 0),
|
|
967
|
+
editor: {
|
|
968
|
+
text: "",
|
|
969
|
+
saveState: "idle",
|
|
970
|
+
error: null
|
|
971
|
+
},
|
|
972
|
+
picker: false,
|
|
973
|
+
sessions: [],
|
|
974
|
+
remember: {
|
|
975
|
+
state: "idle",
|
|
976
|
+
message: null
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
unsubscribe;
|
|
980
|
+
/**
|
|
981
|
+
* @param form - 本插件在设置通道里的配置表。
|
|
982
|
+
* @param resolveRemote - 调用时解析 `assistantProfile` Remote 命名空间。
|
|
983
|
+
* @param resolveSessions - 调用时解析会话列表快照。
|
|
984
|
+
*/
|
|
985
|
+
constructor(form, resolveRemote, resolveSessions) {
|
|
986
|
+
this.form = form;
|
|
987
|
+
this.resolveRemote = resolveRemote;
|
|
988
|
+
this.resolveSessions = resolveSessions;
|
|
989
|
+
this.unsubscribe = form.subscribe(() => {
|
|
990
|
+
this.deriveSwitches();
|
|
991
|
+
});
|
|
992
|
+
this.deriveSwitches();
|
|
993
|
+
}
|
|
994
|
+
/** 释放订阅。 */
|
|
995
|
+
dispose() {
|
|
996
|
+
this.unsubscribe();
|
|
997
|
+
}
|
|
998
|
+
/** 切换一个开关。 */
|
|
999
|
+
async toggle(field, next) {
|
|
1000
|
+
await this.form.set(field, next);
|
|
1001
|
+
}
|
|
1002
|
+
/** 更新编辑框草稿(只在客户端,保存前不落盘)。 */
|
|
1003
|
+
setDraft(text) {
|
|
1004
|
+
const snapshot = this.store.getSnapshot();
|
|
1005
|
+
this.store.set({
|
|
1006
|
+
...snapshot,
|
|
1007
|
+
editor: {
|
|
1008
|
+
...snapshot.editor,
|
|
1009
|
+
text,
|
|
1010
|
+
saveState: "idle"
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
/** 载入记忆文档。 */
|
|
1015
|
+
async load() {
|
|
1016
|
+
const remote = this.resolveRemote();
|
|
1017
|
+
if (remote === void 0) {
|
|
1018
|
+
this.failEditor("assistantProfile namespace is not mounted");
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
try {
|
|
1022
|
+
const read = await remote.readMemory();
|
|
1023
|
+
if (!read.ok) throw new Error(read.error?.message ?? "read failed");
|
|
1024
|
+
this.store.set({
|
|
1025
|
+
...this.store.getSnapshot(),
|
|
1026
|
+
editor: {
|
|
1027
|
+
text: read.value ?? "",
|
|
1028
|
+
saveState: "idle",
|
|
1029
|
+
error: null
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
} catch (error) {
|
|
1033
|
+
this.failEditor(error instanceof Error ? error.message : String(error));
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
/** 保存编辑框内容。 */
|
|
1037
|
+
async save() {
|
|
1038
|
+
const remote = this.resolveRemote();
|
|
1039
|
+
if (remote === void 0) {
|
|
1040
|
+
this.failEditor("assistantProfile namespace is not mounted");
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
const current = this.store.getSnapshot();
|
|
1044
|
+
this.store.set({
|
|
1045
|
+
...current,
|
|
1046
|
+
editor: {
|
|
1047
|
+
...current.editor,
|
|
1048
|
+
saveState: "saving",
|
|
1049
|
+
error: null
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
try {
|
|
1053
|
+
const written = await remote.writeMemory(current.editor.text);
|
|
1054
|
+
if (!written.ok) throw new Error(written.error?.message ?? "write failed");
|
|
1055
|
+
this.store.set({
|
|
1056
|
+
...this.store.getSnapshot(),
|
|
1057
|
+
editor: {
|
|
1058
|
+
...this.store.getSnapshot().editor,
|
|
1059
|
+
saveState: "saved"
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
} catch (error) {
|
|
1063
|
+
this.failEditor(error instanceof Error ? error.message : String(error));
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
/** 打开提炼弹窗(顺带刷新会话列表)。 */
|
|
1067
|
+
openPicker() {
|
|
1068
|
+
const current = this.store.getSnapshot();
|
|
1069
|
+
this.store.set({
|
|
1070
|
+
...current,
|
|
1071
|
+
picker: true,
|
|
1072
|
+
sessions: this.resolveSessions(),
|
|
1073
|
+
remember: {
|
|
1074
|
+
state: "idle",
|
|
1075
|
+
message: null
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
/** 关闭提炼弹窗。 */
|
|
1080
|
+
closePicker() {
|
|
1081
|
+
const current = this.store.getSnapshot();
|
|
1082
|
+
this.store.set({
|
|
1083
|
+
...current,
|
|
1084
|
+
picker: false
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* 从一个会话提炼记忆。
|
|
1089
|
+
* @param sessionId - 要提炼的会话。
|
|
1090
|
+
* @param text - 该会话里选中的对话文本。
|
|
1091
|
+
*/
|
|
1092
|
+
async remember(sessionId, text) {
|
|
1093
|
+
const remote = this.resolveRemote();
|
|
1094
|
+
if (remote === void 0) {
|
|
1095
|
+
this.failRemember("assistantProfile namespace is not mounted");
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
this.store.set({
|
|
1099
|
+
...this.store.getSnapshot(),
|
|
1100
|
+
remember: {
|
|
1101
|
+
state: "running",
|
|
1102
|
+
message: null
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
|
+
try {
|
|
1106
|
+
const result = await remote.rememberFromSession(sessionId, text);
|
|
1107
|
+
if (!result.ok) throw new Error(result.error?.message ?? "remember failed");
|
|
1108
|
+
const value = result.value;
|
|
1109
|
+
if (value === void 0) throw new Error("empty response");
|
|
1110
|
+
if (value.saved) {
|
|
1111
|
+
const count = value.entries?.length ?? 0;
|
|
1112
|
+
this.store.set({
|
|
1113
|
+
...this.store.getSnapshot(),
|
|
1114
|
+
picker: false,
|
|
1115
|
+
remember: {
|
|
1116
|
+
state: "done",
|
|
1117
|
+
message: `+${count}`
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
await this.load();
|
|
1121
|
+
} else this.failRemember(value.outcome);
|
|
1122
|
+
} catch (error) {
|
|
1123
|
+
this.failRemember(error instanceof Error ? error.message : String(error));
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
failEditor(message) {
|
|
1127
|
+
const current = this.store.getSnapshot();
|
|
1128
|
+
this.store.set({
|
|
1129
|
+
...current,
|
|
1130
|
+
editor: {
|
|
1131
|
+
...current.editor,
|
|
1132
|
+
saveState: "failed",
|
|
1133
|
+
error: message
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
failRemember(message) {
|
|
1138
|
+
this.store.set({
|
|
1139
|
+
...this.store.getSnapshot(),
|
|
1140
|
+
remember: {
|
|
1141
|
+
state: "failed",
|
|
1142
|
+
message
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
deriveSwitches() {
|
|
1147
|
+
const snapshot = this.form.getSnapshot();
|
|
1148
|
+
this.store.set({
|
|
1149
|
+
...this.store.getSnapshot(),
|
|
1150
|
+
status: snapshot.status === "ready" ? "ready" : snapshot.status === "loading" ? "loading" : "unavailable",
|
|
1151
|
+
switches: decodeSwitches(snapshot.value)
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
/** 把会话列表快照折成弹窗选项(跳过子代理会话)。 */
|
|
1156
|
+
function sessionOptions(snapshot) {
|
|
1157
|
+
const ids = snapshot.order ?? Object.keys(snapshot.byId);
|
|
1158
|
+
const options = [];
|
|
1159
|
+
for (const id of ids) {
|
|
1160
|
+
const entry = snapshot.byId[id];
|
|
1161
|
+
if (entry === void 0) continue;
|
|
1162
|
+
options.push({
|
|
1163
|
+
id,
|
|
1164
|
+
title: entry.displayTitle ?? id
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
return options;
|
|
1168
|
+
}
|
|
1169
|
+
//#endregion
|
|
681
1170
|
//#region ../src/client/locales.ts
|
|
682
1171
|
/**
|
|
683
1172
|
* 词典:助理档案页与侧栏入口的文案。
|
|
@@ -713,7 +1202,33 @@ window.__ModuleLoader__.load({
|
|
|
713
1202
|
"dirty": "有未保存的改动",
|
|
714
1203
|
"failed": "保存失败",
|
|
715
1204
|
"unavailable": "设置通道还没就绪,稍后再试。",
|
|
716
|
-
"readonly": "当前 profile 不可写。"
|
|
1205
|
+
"readonly": "当前 profile 不可写。",
|
|
1206
|
+
"memory.nav": "Agent记忆",
|
|
1207
|
+
"memory.intro": "这份记忆跟着人格走:注入到系统提示里,所有会话共享。可以自己写,也可以从聊天记录里提炼。",
|
|
1208
|
+
"memory.unavailable": "设置通道还没就绪,稍后再试。",
|
|
1209
|
+
"memory.switches": "开关",
|
|
1210
|
+
"memory.enabled.title": "启用记忆",
|
|
1211
|
+
"memory.enabled.description": "把下面这份记忆注入系统提示。关掉后记忆不生效,也不会被写入。",
|
|
1212
|
+
"memory.auto.title": "自动记忆",
|
|
1213
|
+
"memory.auto.description": "允许模型在对话中自己判断该记什么,并直接写入。",
|
|
1214
|
+
"memory.auto.locked": "先启用记忆,才能打开自动记忆。",
|
|
1215
|
+
"memory.editor": "记忆内容",
|
|
1216
|
+
"memory.editor.hint": "每行一条,格式「- [时间] 内容」;也可以写普通段落,模型照样会读到。",
|
|
1217
|
+
"memory.editor.placeholder": "- [2026-10-24 12:00] 用户偏好简洁的中文回答",
|
|
1218
|
+
"memory.reload": "重新载入",
|
|
1219
|
+
"memory.save": "保存记忆",
|
|
1220
|
+
"memory.saving": "保存中…",
|
|
1221
|
+
"memory.saved": "已保存",
|
|
1222
|
+
"memory.saveFailed": "保存失败",
|
|
1223
|
+
"memory.remember": "从聊天记录提炼",
|
|
1224
|
+
"memory.remembered": "已记入",
|
|
1225
|
+
"memory.running": "提炼中…",
|
|
1226
|
+
"memory.picker.title": "从聊天记录提炼记忆",
|
|
1227
|
+
"memory.picker.hint": "选中一段对话文本,模型会把它提炼成稳定的记忆条目。",
|
|
1228
|
+
"memory.picker.placeholder": "粘贴要提炼的对话内容…",
|
|
1229
|
+
"memory.picker.run": "提炼并记入",
|
|
1230
|
+
"memory.picker.cancel": "取消",
|
|
1231
|
+
"memory.picker.noSessions": "还没有打开的会话,无法调用模型。"
|
|
717
1232
|
};
|
|
718
1233
|
/** 英文词典:与中文键一一对应。 */
|
|
719
1234
|
const en = {
|
|
@@ -743,7 +1258,33 @@ window.__ModuleLoader__.load({
|
|
|
743
1258
|
"dirty": "Unsaved changes",
|
|
744
1259
|
"failed": "Save failed",
|
|
745
1260
|
"unavailable": "The settings channel is not ready yet; try again in a moment.",
|
|
746
|
-
"readonly": "This profile is read-only."
|
|
1261
|
+
"readonly": "This profile is read-only.",
|
|
1262
|
+
"memory.nav": "Agent Memory",
|
|
1263
|
+
"memory.intro": "This memory belongs to the persona: it is injected into the system prompt and shared by every session. Write it yourself, or distill it from a chat.",
|
|
1264
|
+
"memory.unavailable": "The settings channel is not ready yet; try again in a moment.",
|
|
1265
|
+
"memory.switches": "Switches",
|
|
1266
|
+
"memory.enabled.title": "Enable memory",
|
|
1267
|
+
"memory.enabled.description": "Inject the memory below into the system prompt. Turned off, it neither applies nor gets written.",
|
|
1268
|
+
"memory.auto.title": "Automatic memory",
|
|
1269
|
+
"memory.auto.description": "Let the model decide what is worth remembering and write it directly.",
|
|
1270
|
+
"memory.auto.locked": "Enable memory first to turn on automatic memory.",
|
|
1271
|
+
"memory.editor": "Memory content",
|
|
1272
|
+
"memory.editor.hint": "One entry per line, in the shape \"- [time] content\"; plain prose works too, the model reads all of it.",
|
|
1273
|
+
"memory.editor.placeholder": "- [2026-10-24 12:00] Prefers concise Chinese answers",
|
|
1274
|
+
"memory.reload": "Reload",
|
|
1275
|
+
"memory.save": "Save memory",
|
|
1276
|
+
"memory.saving": "Saving…",
|
|
1277
|
+
"memory.saved": "Saved",
|
|
1278
|
+
"memory.saveFailed": "Save failed",
|
|
1279
|
+
"memory.remember": "Distill from a chat",
|
|
1280
|
+
"memory.remembered": "Remembered",
|
|
1281
|
+
"memory.running": "Distilling…",
|
|
1282
|
+
"memory.picker.title": "Distill memory from a chat",
|
|
1283
|
+
"memory.picker.hint": "Select a stretch of conversation; the model condenses it into stable memory entries.",
|
|
1284
|
+
"memory.picker.placeholder": "Paste the conversation to distill…",
|
|
1285
|
+
"memory.picker.run": "Distill and save",
|
|
1286
|
+
"memory.picker.cancel": "Cancel",
|
|
1287
|
+
"memory.picker.noSessions": "No open session, so there is no model to call."
|
|
747
1288
|
};
|
|
748
1289
|
//#endregion
|
|
749
1290
|
//#region ../src/client/index.ts
|
|
@@ -784,6 +1325,33 @@ window.__ModuleLoader__.load({
|
|
|
784
1325
|
locale: NS,
|
|
785
1326
|
inject: () => ({ profile })
|
|
786
1327
|
}, ProfilePage));
|
|
1328
|
+
const controller = new MemorySettingsController(ctx.configForms.get(PANEL_ID), () => ctx.get("remote.assistantProfile"), () => sessionOptions(ctx.sessions.list.getSnapshot()));
|
|
1329
|
+
ctx.effect(() => () => {
|
|
1330
|
+
controller.dispose();
|
|
1331
|
+
}, "assistant-profile: memory form");
|
|
1332
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
1333
|
+
name: "settings.section",
|
|
1334
|
+
id: "assistant-memory",
|
|
1335
|
+
order: 26,
|
|
1336
|
+
label: () => t("memory.nav"),
|
|
1337
|
+
locale: NS,
|
|
1338
|
+
inject: () => ({
|
|
1339
|
+
hooks: { memorySection: controller.store },
|
|
1340
|
+
toggle: (field, next) => controller.toggle(field, next),
|
|
1341
|
+
setDraft: (text) => {
|
|
1342
|
+
controller.setDraft(text);
|
|
1343
|
+
},
|
|
1344
|
+
save: () => controller.save(),
|
|
1345
|
+
load: () => controller.load(),
|
|
1346
|
+
openPicker: () => {
|
|
1347
|
+
controller.openPicker();
|
|
1348
|
+
},
|
|
1349
|
+
closePicker: () => {
|
|
1350
|
+
controller.closePicker();
|
|
1351
|
+
},
|
|
1352
|
+
remember: (sessionId, text) => controller.remember(sessionId, text)
|
|
1353
|
+
})
|
|
1354
|
+
}, MemorySection));
|
|
787
1355
|
}
|
|
788
1356
|
//#endregion
|
|
789
1357
|
exports.apply = apply;
|