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,
|
createDefaultTaskProfiles,
|
||||||
migrateLegacyTaskProfiles,
|
migrateLegacyTaskProfiles,
|
||||||
} from "./prompt-profiles.js";
|
} 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 { resolveConfiguredTimeoutMs } from "./request-timeout.js";
|
||||||
import { retrieve } from "./retriever.js";
|
import { retrieve } from "./retriever.js";
|
||||||
import {
|
import {
|
||||||
@@ -747,14 +751,9 @@ function buildAbortStageAction(stage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createNoticePanelAction() {
|
function createNoticePanelAction() {
|
||||||
if (!_panelModule?.openPanel) return undefined;
|
return createNoticePanelActionController({
|
||||||
return {
|
getPanelModule: () => _panelModule,
|
||||||
label: "打开面板",
|
});
|
||||||
kind: "neutral",
|
|
||||||
onClick: () => {
|
|
||||||
_panelModule?.openPanel?.();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dismissStageNotice(stage) {
|
function dismissStageNotice(stage) {
|
||||||
@@ -1714,7 +1713,9 @@ function clearInjectionState(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshPanelLiveState() {
|
function refreshPanelLiveState() {
|
||||||
_panelModule?.refreshLiveState?.();
|
refreshPanelLiveStateController({
|
||||||
|
getPanelModule: () => _panelModule,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyStatusToast(key, kind, message, title = "ST-BME") {
|
function notifyStatusToast(key, kind, message, title = "ST-BME") {
|
||||||
|
|||||||
@@ -2,6 +2,25 @@ function resolvePanelTheme(settings) {
|
|||||||
return settings?.panelTheme || "crimson";
|
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) {
|
function injectOptionsMenuEntry(runtime) {
|
||||||
if (runtime.document.getElementById("option_st_bme_panel")) {
|
if (runtime.document.getElementById("option_st_bme_panel")) {
|
||||||
return;
|
return;
|
||||||
@@ -13,7 +32,7 @@ function injectOptionsMenuEntry(runtime) {
|
|||||||
<span>记忆图谱</span>
|
<span>记忆图谱</span>
|
||||||
</a>
|
</a>
|
||||||
`).on("click", () => {
|
`).on("click", () => {
|
||||||
runtime.getPanelModule()?.openPanel?.();
|
openPanelController(runtime);
|
||||||
runtime.$("#options").hide();
|
runtime.$("#options").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user