Fix chat model always using conv.model instead of user setting

conv.model was stored at conversation creation time and short-circuited
the get_setting() call, so changing default_model in Settings had no
effect on existing conversations. Now the user's default_model setting
is always the source of truth for generation and summarization.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 22:44:14 -05:00
parent 4fd2c915b6
commit 76c384ea53
+2 -2
View File
@@ -136,7 +136,7 @@ async def send_message_route(conv_id: int):
if msg.role != "system":
history.append({"role": msg.role, "content": msg.content})
model = conv.model or await get_setting(uid, "default_model", Config.OLLAMA_MODEL) or Config.OLLAMA_MODEL
model = await get_setting(uid, "default_model", Config.OLLAMA_MODEL) or Config.OLLAMA_MODEL
# Launch background generation task (context building happens inside the task)
asyncio.create_task(run_generation(
@@ -259,7 +259,7 @@ async def summarize_conversation_route(conv_id: int):
conv = await get_conversation(uid, conv_id)
if conv is None:
return jsonify({"error": "Conversation not found"}), 404
model = conv.model or await get_setting(uid, "default_model", Config.OLLAMA_MODEL) or Config.OLLAMA_MODEL
model = await get_setting(uid, "default_model", Config.OLLAMA_MODEL) or Config.OLLAMA_MODEL
try:
note = await summarize_conversation_as_note(uid, conv_id, model)
return jsonify(note), 201