From 6f94a076f72c9933dd709b38a69990f189c3b7aa Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sun, 11 Aug 2024 10:45:13 +0530 Subject: [PATCH] Add conversation_id parameter to the create_automation method --- src/khoj/routers/helpers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index d821ca4b..8d5a96ad 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -1109,7 +1109,7 @@ def scheduled_chat( # Replace the original conversation_id with the conversation_id if conversation_id: - query_dict["conversation_id"] = conversation_id + query_dict["conversation_id"] = [conversation_id] # Construct the URL to call the chat API with the scheduled query string encoded_query = urlencode(query_dict, doseq=True) @@ -1154,9 +1154,11 @@ def scheduled_chat( return raw_response -async def create_automation(q: str, timezone: str, user: KhojUser, calling_url: URL, meta_log: dict = {}): +async def create_automation( + q: str, timezone: str, user: KhojUser, calling_url: URL, meta_log: dict = {}, conversation_id: int = None +): crontime, query_to_run, subject = await schedule_query(q, meta_log) - job = await schedule_automation(query_to_run, subject, crontime, timezone, q, user, calling_url) + job = await schedule_automation(query_to_run, subject, crontime, timezone, q, user, calling_url, conversation_id) return job, crontime, query_to_run, subject