Store conversation ID for new conversations as a string, not UUID

This commit is contained in:
sabaimran
2024-09-29 18:07:08 -07:00
parent d92a349292
commit 1dfc89e79f
2 changed files with 3 additions and 3 deletions

View File

@@ -574,7 +574,7 @@ async def post_automation(
try: try:
# Use the query to run as the scheduling request if the scheduling request is unset # Use the query to run as the scheduling request if the scheduling request is unset
automation = await schedule_automation( automation = await schedule_automation(
query_to_run, subject, crontime, timezone, q, user, calling_url, conversation.id query_to_run, subject, crontime, timezone, q, user, calling_url, str(conversation.id)
) )
except Exception as e: except Exception as e:
logger.error(f"Error creating automation {q} for {user.email}: {e}", exc_info=True) logger.error(f"Error creating automation {q} for {user.email}: {e}", exc_info=True)
@@ -679,7 +679,7 @@ def edit_job(
# Create new Conversation Session associated with this new task # Create new Conversation Session associated with this new task
conversation = ConversationAdapters.create_conversation_session(user, request.user.client_app, title=title) conversation = ConversationAdapters.create_conversation_session(user, request.user.client_app, title=title)
conversation_id = conversation.id conversation_id = str(conversation.id)
automation_metadata["conversation_id"] = conversation_id automation_metadata["conversation_id"] = conversation_id
# Modify automation with updated query, subject # Modify automation with updated query, subject

View File

@@ -1132,7 +1132,7 @@ def scheduled_chat(
# Replace the original conversation_id with the conversation_id # Replace the original conversation_id with the conversation_id
if conversation_id: if conversation_id:
# encode the conversation_id to avoid any issues with special characters # encode the conversation_id to avoid any issues with special characters
query_dict["conversation_id"] = [quote(conversation_id)] query_dict["conversation_id"] = [quote(str(conversation_id))]
# Restructure the original query_dict into a valid JSON payload for the chat API # Restructure the original query_dict into a valid JSON payload for the chat API
json_payload = {key: values[0] for key, values in query_dict.items()} json_payload = {key: values[0] for key, values in query_dict.items()}