"""Add the AC Beta controls to the existing stable fixed-height chat shell.""" from pathlib import Path HERE=Path(__file__).parent def enhance_frontend(page: str, *, is_admin: bool) -> str: page=page.replace('', '\n',1) if False else page css=(HERE/'beta_ui.css').read_text(encoding='utf-8') js=(HERE/'beta_ui.js').read_text(encoding='utf-8') page=page.replace('', '',1) page=page.replace('', '',1) # Separate Head Admin browser archives from public/guest archives on the # same origin. This must happen before any page script executes. if is_admin: css_google=(HERE/'google_dashboard_ui.css').read_text(encoding='utf-8') js_google=(HERE/'google_dashboard_ui.js').read_text(encoding='utf-8') page=page.replace('', '',1) page=page.replace('', '',1) for key in ('ac_archive','ac_current_history','ac_current_chat_id'): page=page.replace(key, key.replace('ac_', 'ac_admin_', 1)) return page