Compare commits

...

5 Commits

Author SHA1 Message Date
pablonyx
7cc56c7e4a quick nit 2025-03-26 17:29:23 -07:00
pablonyx
7d4328c695 update 2025-03-26 14:51:21 -07:00
pablonyx
eae3f74c39 Revert "Revert "fix session touching""
This reverts commit 26a71d40b6.
2025-03-26 13:37:08 -07:00
pablonyx
26a71d40b6 Revert "fix session touching"
This reverts commit c473d5c9a2.
2025-03-26 13:35:46 -07:00
pablonyx
c473d5c9a2 fix session touching 2025-03-26 13:33:36 -07:00
2 changed files with 20 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ from onyx.db.chat import get_or_create_root_message
from onyx.db.chat import reserve_message_id
from onyx.db.chat import translate_db_message_to_chat_message_detail
from onyx.db.chat import translate_db_search_doc_to_server_search_doc
from onyx.db.chat import update_chat_session_updated_at_timestamp
from onyx.db.engine import get_session_context_manager
from onyx.db.milestone import check_multi_assistant_milestone
from onyx.db.milestone import create_milestone_if_not_exists
@@ -1069,6 +1070,8 @@ def stream_chat_message_objects(
prev_message = next_answer_message
logger.debug("Committing messages")
# Explicitly update the timestamp on the chat session
update_chat_session_updated_at_timestamp(chat_session_id, db_session)
db_session.commit() # actually save user / assistant message
yield AgenticMessageResponseIDInfo(agentic_message_ids=agentic_message_ids)

View File

@@ -1089,3 +1089,20 @@ def log_agent_sub_question_results(
db_session.commit()
return None
def update_chat_session_updated_at_timestamp(
chat_session_id: UUID, db_session: Session
) -> None:
"""
Explicitly update the timestamp on a chat session without modifying other fields.
This is useful when adding messages to a chat session to reflect recent activity.
"""
# Direct SQL update to avoid loading the entire object if it's not already loaded
db_session.execute(
update(ChatSession)
.where(ChatSession.id == chat_session_id)
.values(time_updated=func.now())
)
# No commit - the caller is responsible for committing the transaction