mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Expose Ena Planner settings in panel
This commit is contained in:
@@ -445,6 +445,15 @@
|
||||
在这里集中配置第二记忆模型、功能开关、细粒度参数、任务预设和面板主题。
|
||||
</p>
|
||||
</div>
|
||||
<div class="bme-config-workspace-actions">
|
||||
<button class="bme-config-launch-btn" id="bme-open-ena-planner" type="button">
|
||||
<i class="fa-solid fa-wand-magic-sparkles"></i>
|
||||
<span>Ena Planner 设置</span>
|
||||
</button>
|
||||
<div class="bme-config-launch-hint" id="bme-open-ena-planner-hint">
|
||||
检测中...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bme-config-nav bme-config-nav-mobile">
|
||||
|
||||
40
panel.js
40
panel.js
@@ -408,6 +408,7 @@ export async function initPanel({
|
||||
_bindGraphControls();
|
||||
_bindActions();
|
||||
_bindConfigControls();
|
||||
_bindPlannerLauncher();
|
||||
currentTabId =
|
||||
panelEl?.querySelector(".bme-tab-btn.active")?.dataset.tab || "dashboard";
|
||||
_applyWorkspaceMode();
|
||||
@@ -736,6 +737,44 @@ function _switchTab(tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
function _getPlannerApi() {
|
||||
return globalThis?.stBmeEnaPlanner || null;
|
||||
}
|
||||
|
||||
function _refreshPlannerLauncher() {
|
||||
const button = document.getElementById("bme-open-ena-planner");
|
||||
const hint = document.getElementById("bme-open-ena-planner-hint");
|
||||
if (!button || !hint) return;
|
||||
|
||||
const plannerApi = _getPlannerApi();
|
||||
const ready = typeof plannerApi?.openSettings === "function";
|
||||
|
||||
button.disabled = !ready;
|
||||
button.classList.toggle("is-runtime-disabled", !ready);
|
||||
hint.textContent = ready
|
||||
? "已加载,可打开独立的 Ena Planner 设置页。"
|
||||
: "未检测到 Ena Planner 模块,请重载 ST-BME 后再试。";
|
||||
}
|
||||
|
||||
function _bindPlannerLauncher() {
|
||||
const button = document.getElementById("bme-open-ena-planner");
|
||||
if (!button || button.dataset.bmeBound === "true") {
|
||||
_refreshPlannerLauncher();
|
||||
return;
|
||||
}
|
||||
|
||||
button.addEventListener("click", () => {
|
||||
const plannerApi = _getPlannerApi();
|
||||
if (typeof plannerApi?.openSettings === "function") {
|
||||
plannerApi.openSettings();
|
||||
}
|
||||
_refreshPlannerLauncher();
|
||||
});
|
||||
|
||||
button.dataset.bmeBound = "true";
|
||||
_refreshPlannerLauncher();
|
||||
}
|
||||
|
||||
function _applyWorkspaceMode() {
|
||||
if (!panelEl) return;
|
||||
const isConfig = currentTabId === "config";
|
||||
@@ -1418,6 +1457,7 @@ function _bindActions() {
|
||||
|
||||
function _refreshConfigTab() {
|
||||
const settings = _getSettings?.() || {};
|
||||
_refreshPlannerLauncher();
|
||||
|
||||
_setCheckboxValue("bme-setting-enabled", settings.enabled ?? true);
|
||||
_setCheckboxValue(
|
||||
|
||||
66
style.css
66
style.css
@@ -953,9 +953,64 @@
|
||||
.bme-config-workspace-header {
|
||||
padding: 20px 22px 10px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.bme-config-workspace-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.bme-config-launch-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 38px;
|
||||
padding: 0 14px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: var(--bme-on-surface);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
background 0.2s ease,
|
||||
color 0.2s ease,
|
||||
transform 0.2s ease;
|
||||
}
|
||||
|
||||
.bme-config-launch-btn:hover {
|
||||
border-color: var(--bme-primary);
|
||||
color: var(--bme-primary);
|
||||
background: var(--bme-primary-dim);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.bme-config-launch-btn:disabled,
|
||||
.bme-config-launch-btn.is-runtime-disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
color: var(--bme-on-surface-dim);
|
||||
border-color: rgba(255, 255, 255, 0.06);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.bme-config-launch-hint {
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: var(--bme-on-surface-dim);
|
||||
text-align: right;
|
||||
max-width: 220px;
|
||||
}
|
||||
|
||||
.bme-config-workspace-title,
|
||||
.bme-config-section-title {
|
||||
margin: 0;
|
||||
@@ -2242,12 +2297,23 @@
|
||||
/* ⑦ Config mode 移动端 */
|
||||
.bme-config-workspace-header {
|
||||
padding: 14px 14px 8px;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.bme-config-workspace-title {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.bme-config-workspace-actions {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.bme-config-launch-hint {
|
||||
max-width: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.bme-config-sections {
|
||||
padding: 14px;
|
||||
padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
|
||||
|
||||
Reference in New Issue
Block a user