diff --git a/ai-hub/app/core/services/rag.py b/ai-hub/app/core/services/rag.py index 2dbd95a..f017093 100644 --- a/ai-hub/app/core/services/rag.py +++ b/ai-hub/app/core/services/rag.py @@ -262,9 +262,10 @@ # Final cleanup of the transient assistant message state if current_assistant_msg: - current_assistant_msg.content = full_answer - if full_reasoning and hasattr(current_assistant_msg, "reasoning_content"): - current_assistant_msg.reasoning_content = full_reasoning + assistant_message = current_assistant_msg + assistant_message.content = full_answer + if full_reasoning and hasattr(assistant_message, "reasoning_content"): + assistant_message.reasoning_content = full_reasoning db.commit() else: # Fallback if no tokens were yielded but we reached the end