Self-hosted AI workspace.
Python
Merge lab into refactor/settings-shell-modules
Alexandre Teixeira33387d4a4c36
diff --cc static/js/settings.jsindex 4b1c3c664,9e633a5cb..2cd9b6e89--- a/static/js/settings.js+++ b/static/js/settings.js@@@ -4,10 -4,22 +4,15 @@@import uiModule from './ui.js?v=20260916largetoolscroll1';import searchModule from './search.js';import { byId } from './settings/dom.js';+ import { postSettings as _postSettings } from './settings/api.js';+ import { initTtsSettings, initSttSettings } from './settings/speech.js';+ import { initDocumentWritingStyle } from './settings/writingStyle.js';+ import { initImageSettings } from './settings/imageModels.js';+ import { initAgentSettings } from './settings/agent.js';-import {- getSettingsRegistryIssues,- isAdminManagedSettingsTab,-} from './settings/registry.js';+import { getSettingsRegistryIssues } from './settings/registry.js';import { bindSettingsSearch } from './settings/search.js';import { bindSettingsSidebar } from './settings/sidebar.js';-import {- activateSettingsPanel,- getActiveSettingsTab,- bindSettingsNavigation,-} from './settings/navigation.js';+import { bindSettingsNavigation } from './settings/navigation.js';import {bindSettingsDrag,bindSettingsClose,@@@ -5571,11 -5239,82 +5172,11 @@@ async function initUnifiedIntegrations(/* ═══════════════════════════════════════════PUBLIC API═══════════════════════════════════════════ */-export function open(tab) {- if (!initialized) initAll();-- syncAppearanceCheckboxes();- showSettingsModal(modalEl);- syncAdminVisibility();-- if (tab) {- activateSettingsPanel(modalEl, tab);- }-- // Preserve existing panel-specific side effects when Settings is opened- // directly to a tab as well as when the user navigates there.- const activeTab = tab || getActiveSettingsTab(modalEl);- onSettingsPanelActivated(activeTab);-- // Auto-init admin data if showing an admin tab.- if (isAdminManagedSettingsTab(activeTab) && window.adminModule && !window.adminModule._initialized) {- window.adminModule._initData();- }-}--export function close() {- if (!modalEl) return;+export function open(tab) { _shell.open(tab); }+export function close() { _shell.close(); }- export function syncAdminVisibility() { _shell.syncAdminVisibility(); }++function syncAdminVisibility() { _shell.syncAdminVisibility(); }- // Always clear the Appearance state so the rest of the app does not remain- // dimmed if Settings is closed while that panel is active.- document.body.classList.remove('settings-appearance-open');- syncAppearanceOpacity(false);-- hideSettingsModal(modalEl);-}--// Handle redirect back from Google OAuth2 — open settings to integrations and show status.-(function _handleOauthRedirect() {- const sp = new URLSearchParams(window.location.search);- if (!sp.has('email_oauth_success') && !sp.has('email_oauth_error')) return;- // Strip params from URL without a page reload.- const clean = window.location.pathname + window.location.hash;- window.history.replaceState(null, '', clean);- const success = sp.has('email_oauth_success');- const errMsg = sp.get('email_oauth_error') || '';- // Open settings → integrations once the document is ready. This module owns- // the open() API, so it does not need to wait for a window-level alias.- function _showResult() {- open('integrations');- // Brief toast-style banner.- const banner = document.createElement('div');- banner.textContent = success- ? 'Google account connected — email is ready'- : `Google OAuth failed: ${errMsg || 'unknown error'}`;- Object.assign(banner.style, {- position: 'fixed', bottom: '24px', left: '50%', transform: 'translateX(-50%)',- background: success ? 'var(--accent, #50fa7b)' : 'var(--red, #ff5555)',- color: '#000', padding: '8px 18px', borderRadius: '6px', fontSize: '12px',- fontWeight: '600', zIndex: '99999', pointerEvents: 'none',- boxShadow: '0 2px 12px rgba(0,0,0,0.3)',- });- document.body.appendChild(banner);- setTimeout(() => banner.remove(), 4000);- }- if (document.readyState === 'loading') {- document.addEventListener('DOMContentLoaded', _showResult, { once: true });- } else {- _showResult();- }-})();+handleSettingsOauthReturn({ openSettings: open });const settingsModule = { open, close, initIntegrations, initUnifiedIntegrations, syncAdminVisibility, refreshAiModelEndpoints };diff --cc tests/helpers/test_settings_shell_coordinator.mjsindex 6607ecddb,305700abe..199f6283b--- a/tests/helpers/test_settings_shell_coordinator.mjs+++ b/tests/helpers/test_settings_shell_coordinator.mjs@@@ -20,9 -20,11 +20,14 @@@ const REAL_MODULES = new Set(path.join(JS, 'settings/sidebar.js'),path.join(JS, 'settings/navigation.js'),path.join(JS, 'settings/lifecycle.js'),+ path.join(JS, 'settings/api.js'),+ path.join(JS, 'settings/speech.js'),+ path.join(JS, 'settings/writingStyle.js'),+ path.join(JS, 'settings/imageModels.js'),+ path.join(JS, 'settings/agent.js'),+ path.join(JS, 'settings/shell.js'),+ path.join(JS, 'settings/peek.js'),+ path.join(JS, 'settings/oauthReturn.js'),path.join(JS, 'searchProviderIcons.js'),]);