mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Remove now unused location data from being passed to automation funcs
This commit is contained in:
@@ -392,7 +392,7 @@ async def websocket_endpoint(
|
|||||||
if ConversationCommand.Automation in conversation_commands:
|
if ConversationCommand.Automation in conversation_commands:
|
||||||
try:
|
try:
|
||||||
automation, crontime, query_to_run, subject = await create_automation(
|
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:
|
except Exception as e:
|
||||||
logger.error(f"Error scheduling task {q} for {user.email}: {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:
|
if ConversationCommand.Automation in conversation_commands:
|
||||||
try:
|
try:
|
||||||
automation, crontime, query_to_run, subject = await create_automation(
|
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:
|
except Exception as e:
|
||||||
logger.error(f"Error creating automation {q} for {user.email}: {e}")
|
logger.error(f"Error creating automation {q} for {user.email}: {e}")
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ async def generate_online_subqueries(q: str, conversation_history: dict, locatio
|
|||||||
return [q]
|
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.
|
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
|
return raw_response
|
||||||
|
|
||||||
|
|
||||||
async def create_automation(
|
async def create_automation(q: str, timezone: str, user: KhojUser, calling_url: URL, meta_log: dict = {}):
|
||||||
q: str, location: LocationData, timezone: str, user: KhojUser, calling_url: URL, meta_log: dict = {}
|
|
||||||
):
|
|
||||||
user_timezone = pytz.timezone(timezone)
|
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)
|
job = await schedule_automation(query_to_run, subject, crontime, user_timezone, q, user, calling_url)
|
||||||
return job, crontime, query_to_run, subject
|
return job, crontime, query_to_run, subject
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user