Skip to content

Commit

Permalink
Store conversation ID for new conversations as a string, not UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
sabaimran committed Sep 30, 2024
1 parent d92a349 commit 1dfc89e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/khoj/routers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ async def post_automation(
try:
# Use the query to run as the scheduling request if the scheduling request is unset
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:
logger.error(f"Error creating automation {q} for {user.email}: {e}", exc_info=True)
Expand Down Expand Up @@ -679,7 +679,7 @@ def edit_job(
# Create new Conversation Session associated with this new task
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

# Modify automation with updated query, subject
Expand Down
2 changes: 1 addition & 1 deletion src/khoj/routers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ def scheduled_chat(
# Replace the original conversation_id with the conversation_id
if conversation_id:
# 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
json_payload = {key: values[0] for key, values in query_dict.items()}
Expand Down

0 comments on commit 1dfc89e

Please sign in to comment.