diff --git a/src/fabledassistant/routes/settings.py b/src/fabledassistant/routes/settings.py index b5e94f9..ad75d23 100644 --- a/src/fabledassistant/routes/settings.py +++ b/src/fabledassistant/routes/settings.py @@ -7,7 +7,7 @@ from fabledassistant.auth import login_required, get_current_user_id from fabledassistant.config import Config from fabledassistant.services.caldav import CALDAV_SETTING_KEYS, get_caldav_config, test_connection from fabledassistant.services.llm import get_installed_models, _is_private_url -from fabledassistant.services.settings import delete_setting, get_all_settings, set_settings_batch +from fabledassistant.services.settings import delete_setting, get_all_settings, get_setting, set_settings_batch logger = logging.getLogger(__name__) @@ -80,6 +80,18 @@ async def update_settings_route(): if to_save: await set_settings_batch(uid, to_save) + # When timezone changes, live-patch the briefing scheduler immediately + if "user_timezone" in to_save: + import json as _json + from fabledassistant.services.briefing_scheduler import update_user_schedule + config_raw = await get_setting(uid, "briefing_config", "{}") + try: + config = _json.loads(config_raw) if isinstance(config_raw, str) else {} + except Exception: + config = {} + if config.get("enabled"): + update_user_schedule(uid, config, tz_override=to_save["user_timezone"] or None) + if "default_model" in to_save and to_save["default_model"]: asyncio.create_task(_prime_kv_cache_bg(uid, to_save["default_model"]))