Remove now unused location data from being passed to automation funcs

This commit is contained in:
Debanjum Singh Solanky 2024-05-01 05:32:10 +05:30
parent 815966cb25
commit 8f28f6cc1e
2 changed files with 5 additions and 7 deletions

View file

@ -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}")

View file

@ -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