mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Log conversation id to help troubleshoot errors faster
This commit is contained in:
@@ -1488,9 +1488,10 @@ class ConversationAdapters:
|
||||
conversation.updated_at = django_timezone.now()
|
||||
await conversation.asave()
|
||||
else:
|
||||
await Conversation.objects.acreate(
|
||||
conversation = await Conversation.objects.acreate(
|
||||
user=user, conversation_log=cleaned_conversation_log, client=client_application, slug=slug
|
||||
)
|
||||
return conversation
|
||||
|
||||
@staticmethod
|
||||
def get_conversation_processor_options():
|
||||
|
||||
@@ -491,8 +491,9 @@ async def save_to_conversation_log(
|
||||
updated_conversation = None
|
||||
logger.error(f"Error constructing chat history: {e}")
|
||||
|
||||
db_conversation = None
|
||||
if updated_conversation:
|
||||
await ConversationAdapters.save_conversation(
|
||||
db_conversation = await ConversationAdapters.save_conversation(
|
||||
user,
|
||||
updated_conversation,
|
||||
client_application=client_application,
|
||||
@@ -505,7 +506,7 @@ async def save_to_conversation_log(
|
||||
|
||||
logger.info(
|
||||
f"""
|
||||
Saved Conversation Turn
|
||||
Saved Conversation Turn ({db_conversation.id if db_conversation else 'N/A'}):
|
||||
You ({user.username}): "{q}"
|
||||
|
||||
Khoj: "{chat_response}"
|
||||
|
||||
Reference in New Issue
Block a user