From 504091bfcfd2c992e8621aaca5b3dfbfba7529fc Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 18 Feb 2026 19:37:36 -0500 Subject: [PATCH] Pull intent model on startup alongside main model If OLLAMA_INTENT_MODEL is configured and differs from OLLAMA_MODEL, both are pulled concurrently as fire-and-forget tasks at startup. Deduplicates via a set so pulling the same model twice is never attempted. Co-Authored-By: Claude Sonnet 4.6 --- src/fabledassistant/app.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/fabledassistant/app.py b/src/fabledassistant/app.py index f56ec82..9c9be67 100644 --- a/src/fabledassistant/app.py +++ b/src/fabledassistant/app.py @@ -93,18 +93,23 @@ def create_app() -> Quart: start_log_retention_loop() start_notification_loop() - async def _pull_model(): + async def _pull_model(model: str) -> None: try: - await ensure_model(Config.OLLAMA_MODEL) + await ensure_model(model) except Exception: logger.warning( "Failed to ensure model '%s' — chat may not work until model is available", - Config.OLLAMA_MODEL, + model, exc_info=True, ) - # Fire-and-forget so model pull doesn't block startup - asyncio.create_task(_pull_model()) + # Pull main model and (if configured) a separate intent model concurrently. + # Fire-and-forget so pulls don't block startup. + models_to_pull = {Config.OLLAMA_MODEL} + if Config.OLLAMA_INTENT_MODEL and Config.OLLAMA_INTENT_MODEL != Config.OLLAMA_MODEL: + models_to_pull.add(Config.OLLAMA_INTENT_MODEL) + for _model in models_to_pull: + asyncio.create_task(_pull_model(_model)) @app.route("/") async def serve_index():