From 8f28f6cc1ed3be7be22b15fcee144a919e99d709 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 1 May 2024 05:32:10 +0530 Subject: [PATCH] Remove now unused location data from being passed to automation funcs --- src/khoj/routers/api_chat.py | 4 ++-- src/khoj/routers/helpers.py | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index ce9d4c01..79a68969 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -392,7 +392,7 @@ async def websocket_endpoint( if ConversationCommand.Automation in conversation_commands: try: automation, crontime, query_to_run, subject = await create_automation( - q, location, timezone, user, websocket.url, meta_log + q, timezone, user, websocket.url, meta_log ) except Exception as e: logger.error(f"Error scheduling task {q} for {user.email}: {e}") @@ -633,7 +633,7 @@ async def chat( if ConversationCommand.Automation in conversation_commands: try: automation, crontime, query_to_run, subject = await create_automation( - q, location, timezone, user, request.url, meta_log + q, timezone, user, request.url, meta_log ) except Exception as e: logger.error(f"Error creating automation {q} for {user.email}: {e}") diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 7a8d869c..559aaf38 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -336,7 +336,7 @@ async def generate_online_subqueries(q: str, conversation_history: dict, locatio return [q] -async def schedule_query(q: str, location_data: LocationData, conversation_history: dict) -> Tuple[str, ...]: +async def schedule_query(q: str, conversation_history: dict) -> Tuple[str, ...]: """ Schedule the date, time to run the query. Assume the server timezone is UTC. """ @@ -918,11 +918,9 @@ def scheduled_chat(query_to_run: str, scheduling_request: str, subject: str, use return raw_response -async def create_automation( - q: str, location: LocationData, 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 = {}): user_timezone = pytz.timezone(timezone) - crontime, query_to_run, subject = await schedule_query(q, location, meta_log) + crontime, query_to_run, subject = await schedule_query(q, meta_log) job = await schedule_automation(query_to_run, subject, crontime, user_timezone, q, user, calling_url) return job, crontime, query_to_run, subject