mirror of
https://github.com/Darkatse/TauriTavern.git
synced 2026-10-19 15:45:12 +00:00
fix (PanelRuntime): Fixed compatibility issues between the PanelRuntime and the third-party extension JSR.
This commit is contained in:
parent
f3de9c96f5
commit
f0afcda117
3 changed files with 19 additions and 4 deletions
|
|
@ -179,6 +179,12 @@ Panel Runtime 会在 `APP_READY` 后安装,用于在抽屉关闭时把部分
|
|||
- 当前对扩展设置容器启用“子树 gate + park/hydrate”
|
||||
- **白名单永远保持连接**:`regex_container`、`qr_container`
|
||||
- 目的:避免 SPresets 等脚本在抽屉关闭时找不到 `#saved_regex_scripts` 触发 `MutationObserver.observe(target not Node)`。
|
||||
- `src/tauri/main/adapters/panel-runtime/top-settings-panel-parking.js`
|
||||
- `compat` 档会为左侧 Chat Completion 面板保留最小兼容面:
|
||||
- `#openai_api-presets`
|
||||
- `#completion_prompt_manager`
|
||||
- `#openai_api`
|
||||
- 目的:在左侧抽屉关闭时,仍保持 OpenAI 预设/Prompt Manager/上下文控制面可被第三方脚本访问,避免出现“世界书扫描 budget 与最终 ChatCompletion budget 脱节”的兼容问题。
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,14 @@ const LEFT_NAV_MAIN_API_BLOCKS = Object.freeze({
|
|||
},
|
||||
});
|
||||
|
||||
// Keep the OpenAI control surface connected in compat mode so third-party
|
||||
// scripts can continue to drive preset/context settings while the drawer is parked.
|
||||
const LEFT_NAV_COMPAT_PINNED_SELECTORS = Object.freeze([
|
||||
'#openai_api-presets',
|
||||
'#completion_prompt_manager',
|
||||
'#openai_api',
|
||||
]);
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} display
|
||||
|
|
@ -108,7 +116,7 @@ function syncLeftNavMainApiUi() {
|
|||
|
||||
/**
|
||||
* @param {EmbeddedRuntimeManager} manager
|
||||
* @param {{ panelId: string; parkedSelector: string; pinnedSelectors?: string[]; afterHydrate?: (reason: string) => void }} config
|
||||
* @param {{ panelId: string; parkedSelector: string; pinnedSelectors?: readonly string[]; afterHydrate?: (reason: string) => void }} config
|
||||
*/
|
||||
function registerDrawerParking(manager, { panelId, parkedSelector, pinnedSelectors = [], afterHydrate }) {
|
||||
const host = document.getElementById(panelId);
|
||||
|
|
@ -292,7 +300,7 @@ function registerDrawerParking(manager, { panelId, parkedSelector, pinnedSelecto
|
|||
*/
|
||||
export function installTopSettingsPanelParking({ manager }) {
|
||||
const leftNavPinnedSelectors = manager.profile === 'compat'
|
||||
? ['#openai_preset_import_file', '#completion_prompt_manager']
|
||||
? LEFT_NAV_COMPAT_PINNED_SELECTORS
|
||||
: [];
|
||||
|
||||
const registrations = [
|
||||
|
|
|
|||
|
|
@ -33,10 +33,11 @@ export function validatePanelRuntimeInvariants({ profileName }) {
|
|||
mustGetConnectedElementById('regex_container');
|
||||
mustGetConnectedElementById('qr_container');
|
||||
|
||||
// Anchor-zone compatibility: third-party scripts expect these anchors to be selectable even when parked.
|
||||
// Compat anchor-zone surface: keep the OpenAI preset / prompt / control hosts selectable while parked.
|
||||
if (profile === 'compat') {
|
||||
mustGetConnectedElementById('openai_preset_import_file');
|
||||
mustGetConnectedElementById('openai_api-presets');
|
||||
mustGetConnectedElementById('completion_prompt_manager');
|
||||
mustGetConnectedElementById('openai_api');
|
||||
}
|
||||
|
||||
// API connections control surface (only meaningful when left-nav is hydrated).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue