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