mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
refactor: route panel live-state helpers through panel bridge
This commit is contained in:
21
index.js
21
index.js
@@ -67,7 +67,11 @@ import {
|
||||
createDefaultTaskProfiles,
|
||||
migrateLegacyTaskProfiles,
|
||||
} from "./prompt-profiles.js";
|
||||
import { initializePanelBridgeController } from "./panel-bridge.js";
|
||||
import {
|
||||
createNoticePanelActionController,
|
||||
initializePanelBridgeController,
|
||||
refreshPanelLiveStateController,
|
||||
} from "./panel-bridge.js";
|
||||
import { resolveConfiguredTimeoutMs } from "./request-timeout.js";
|
||||
import { retrieve } from "./retriever.js";
|
||||
import {
|
||||
@@ -747,14 +751,9 @@ function buildAbortStageAction(stage) {
|
||||
}
|
||||
|
||||
function createNoticePanelAction() {
|
||||
if (!_panelModule?.openPanel) return undefined;
|
||||
return {
|
||||
label: "打开面板",
|
||||
kind: "neutral",
|
||||
onClick: () => {
|
||||
_panelModule?.openPanel?.();
|
||||
},
|
||||
};
|
||||
return createNoticePanelActionController({
|
||||
getPanelModule: () => _panelModule,
|
||||
});
|
||||
}
|
||||
|
||||
function dismissStageNotice(stage) {
|
||||
@@ -1714,7 +1713,9 @@ function clearInjectionState(options = {}) {
|
||||
}
|
||||
|
||||
function refreshPanelLiveState() {
|
||||
_panelModule?.refreshLiveState?.();
|
||||
refreshPanelLiveStateController({
|
||||
getPanelModule: () => _panelModule,
|
||||
});
|
||||
}
|
||||
|
||||
function notifyStatusToast(key, kind, message, title = "ST-BME") {
|
||||
|
||||
@@ -2,6 +2,25 @@ function resolvePanelTheme(settings) {
|
||||
return settings?.panelTheme || "crimson";
|
||||
}
|
||||
|
||||
export function createNoticePanelActionController(runtime) {
|
||||
if (!runtime.getPanelModule()?.openPanel) return undefined;
|
||||
return {
|
||||
label: "打开面板",
|
||||
kind: "neutral",
|
||||
onClick: () => {
|
||||
runtime.getPanelModule()?.openPanel?.();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function refreshPanelLiveStateController(runtime) {
|
||||
runtime.getPanelModule()?.refreshLiveState?.();
|
||||
}
|
||||
|
||||
export function openPanelController(runtime) {
|
||||
runtime.getPanelModule()?.openPanel?.();
|
||||
}
|
||||
|
||||
function injectOptionsMenuEntry(runtime) {
|
||||
if (runtime.document.getElementById("option_st_bme_panel")) {
|
||||
return;
|
||||
@@ -13,7 +32,7 @@ function injectOptionsMenuEntry(runtime) {
|
||||
<span>记忆图谱</span>
|
||||
</a>
|
||||
`).on("click", () => {
|
||||
runtime.getPanelModule()?.openPanel?.();
|
||||
openPanelController(runtime);
|
||||
runtime.$("#options").hide();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user