mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-11-01 18:52:21 +01:00
fix(editor): synchronize quick edit model events and register imagePreferences in test coordinator
This commit is contained in:
@@ -140,6 +140,22 @@ export function modelCaps(modelId, endpointName, endpointType) {
|
|||||||
return { gen: false, inpaint: false };
|
return { gen: false, inpaint: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Global listeners resolve live controls instead of retaining editor instances.
|
||||||
|
function syncCommandModel(value) {
|
||||||
|
const select = document.getElementById('ge-ai-command-model');
|
||||||
|
if (!select || !select._modelsReady) return;
|
||||||
|
if (select.value !== value) {
|
||||||
|
select.value = value;
|
||||||
|
if (select.value !== value) select.value = '';
|
||||||
|
updateFooterEditModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
window.addEventListener('ge-ai-command-model-change', e => syncCommandModel(e.detail?.value || ''));
|
||||||
|
window.addEventListener('storage', e => {
|
||||||
|
if (e.key === 'ge-ai-command-model') syncCommandModel(e.newValue || '');
|
||||||
|
});
|
||||||
|
}
|
||||||
globalThis.window?.addEventListener('ge:model-endpoints-updated', e => {
|
globalThis.window?.addEventListener('ge:model-endpoints-updated', e => {
|
||||||
document.getElementById('ge-ai-command-model')?._refreshAIModels?.(e.detail?.baseUrl || '');
|
document.getElementById('ge-ai-command-model')?._refreshAIModels?.(e.detail?.baseUrl || '');
|
||||||
});
|
});
|
||||||
@@ -328,11 +344,15 @@ export function wireAIModelSelectors({ container, apiBase = '', openCookbookForI
|
|||||||
// Sentinel changes are handled by the component's delegated listener.
|
// Sentinel changes are handled by the component's delegated listener.
|
||||||
if (aiCommandSelect) {
|
if (aiCommandSelect) {
|
||||||
aiCommandSelect._modelsReady = true;
|
aiCommandSelect._modelsReady = true;
|
||||||
|
// Legacy URL migration check: legacy endpoints with raw URLs are scrubbed.
|
||||||
|
const scrubModelUrl = (saved) => (saved && saved.startsWith('http://') ? '' : saved);
|
||||||
if (aiCommandSelect._commandWired !== listeners) {
|
if (aiCommandSelect._commandWired !== listeners) {
|
||||||
aiCommandSelect._commandWired = listeners;
|
aiCommandSelect._commandWired = listeners;
|
||||||
listen(aiCommandSelect, 'change', () => {
|
listen(aiCommandSelect, 'change', () => {
|
||||||
if (aiCommandSelect.value === '__serve_cookbook__') return;
|
if (aiCommandSelect.value === '__serve_cookbook__') return;
|
||||||
|
const val = scrubModelUrl(aiCommandSelect.value) || '';
|
||||||
updateFooterEditModel();
|
updateFooterEditModel();
|
||||||
|
globalThis.window?.dispatchEvent?.(new CustomEvent('ge-ai-command-model-change', { detail: { value: val } }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const REAL_MODULES = new Set([
|
|||||||
path.join(JS, 'settings/speech.js'),
|
path.join(JS, 'settings/speech.js'),
|
||||||
path.join(JS, 'settings/writingStyle.js'),
|
path.join(JS, 'settings/writingStyle.js'),
|
||||||
path.join(JS, 'settings/imageModels.js'),
|
path.join(JS, 'settings/imageModels.js'),
|
||||||
|
path.join(JS, 'settings/imagePreferences.js'),
|
||||||
path.join(JS, 'settings/agent.js'),
|
path.join(JS, 'settings/agent.js'),
|
||||||
path.join(JS, 'settings/shell.js'),
|
path.join(JS, 'settings/shell.js'),
|
||||||
path.join(JS, 'settings/peek.js'),
|
path.join(JS, 'settings/peek.js'),
|
||||||
|
|||||||
Reference in New Issue
Block a user