feat(settings): add background model picker with KV cache performance warning
Exposes OLLAMA_BACKGROUND_MODEL as a per-user setting in General settings, alongside the Chat Model selector. Includes an inline warning when the same model is selected for both, explaining the KV cache performance impact. All background task callers (title generation, tag suggestions, project summaries, RSS classification) now read background_model from user settings, falling back to OLLAMA_BACKGROUND_MODEL env var. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from fabledassistant.models.conversation import Conversation, Message
|
||||
from fabledassistant.config import Config
|
||||
from fabledassistant.services.llm import generate_completion
|
||||
from fabledassistant.services.notes import create_note
|
||||
from fabledassistant.services.settings import get_setting
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -234,7 +235,8 @@ async def save_response_as_note(user_id: int, message_id: int) -> dict:
|
||||
},
|
||||
{"role": "user", "content": msg.content[:2000]},
|
||||
]
|
||||
title = await generate_completion(prompt_messages, Config.OLLAMA_BACKGROUND_MODEL)
|
||||
bg_model = await get_setting(user_id, "background_model", Config.OLLAMA_BACKGROUND_MODEL)
|
||||
title = await generate_completion(prompt_messages, bg_model)
|
||||
title = title.strip().strip('"\'').strip()[:100]
|
||||
except Exception:
|
||||
logger.warning("Failed to generate note title, using fallback", exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user