mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +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()
|
conversation.updated_at = django_timezone.now()
|
||||||
await conversation.asave()
|
await conversation.asave()
|
||||||
else:
|
else:
|
||||||
await Conversation.objects.acreate(
|
conversation = await Conversation.objects.acreate(
|
||||||
user=user, conversation_log=cleaned_conversation_log, client=client_application, slug=slug
|
user=user, conversation_log=cleaned_conversation_log, client=client_application, slug=slug
|
||||||
)
|
)
|
||||||
|
return conversation
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_conversation_processor_options():
|
def get_conversation_processor_options():
|
||||||
|
|||||||
@@ -491,8 +491,9 @@ async def save_to_conversation_log(
|
|||||||
updated_conversation = None
|
updated_conversation = None
|
||||||
logger.error(f"Error constructing chat history: {e}")
|
logger.error(f"Error constructing chat history: {e}")
|
||||||
|
|
||||||
|
db_conversation = None
|
||||||
if updated_conversation:
|
if updated_conversation:
|
||||||
await ConversationAdapters.save_conversation(
|
db_conversation = await ConversationAdapters.save_conversation(
|
||||||
user,
|
user,
|
||||||
updated_conversation,
|
updated_conversation,
|
||||||
client_application=client_application,
|
client_application=client_application,
|
||||||
@@ -505,7 +506,7 @@ async def save_to_conversation_log(
|
|||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"""
|
f"""
|
||||||
Saved Conversation Turn
|
Saved Conversation Turn ({db_conversation.id if db_conversation else 'N/A'}):
|
||||||
You ({user.username}): "{q}"
|
You ({user.username}): "{q}"
|
||||||
|
|
||||||
Khoj: "{chat_response}"
|
Khoj: "{chat_response}"
|
||||||
|
|||||||
Reference in New Issue
Block a user