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:
@@ -136,7 +136,7 @@ async def send_message_route(conv_id: int):
|
|||||||
if msg.role != "system":
|
if msg.role != "system":
|
||||||
history.append({"role": msg.role, "content": msg.content})
|
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)
|
# Launch background generation task (context building happens inside the task)
|
||||||
asyncio.create_task(run_generation(
|
asyncio.create_task(run_generation(
|
||||||
@@ -259,7 +259,7 @@ async def summarize_conversation_route(conv_id: int):
|
|||||||
conv = await get_conversation(uid, conv_id)
|
conv = await get_conversation(uid, conv_id)
|
||||||
if conv is None:
|
if conv is None:
|
||||||
return jsonify({"error": "Conversation not found"}), 404
|
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:
|
try:
|
||||||
note = await summarize_conversation_as_note(uid, conv_id, model)
|
note = await summarize_conversation_as_note(uid, conv_id, model)
|
||||||
return jsonify(note), 201
|
return jsonify(note), 201
|
||||||
|
|||||||
Reference in New Issue
Block a user