diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index 79a68969..b7fef39a 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -401,9 +401,7 @@ async def websocket_endpoint( ) continue - llm_response = construct_automation_created_message( - automation, crontime, query_to_run, subject, websocket.url - ) + llm_response = construct_automation_created_message(automation, crontime, query_to_run, subject) await sync_to_async(save_to_conversation_log)( q, llm_response, @@ -643,7 +641,7 @@ async def chat( status_code=500, ) - llm_response = construct_automation_created_message(automation, crontime, query_to_run, subject, request.url) + llm_response = construct_automation_created_message(automation, crontime, query_to_run, subject) await sync_to_async(save_to_conversation_log)( q, llm_response, diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index faa88dc7..cb3f5491 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -1001,15 +1001,14 @@ async def schedule_automation( return job -def construct_automation_created_message(automation: Job, crontime: str, query_to_run: str, subject: str, url: URL): +def construct_automation_created_message(automation: Job, crontime: str, query_to_run: str, subject: str): # Display next run time in user timezone instead of UTC schedule = f'{cron_descriptor.get_description(crontime)} {automation.next_run_time.strftime("%Z")}' next_run_time = automation.next_run_time.strftime("%Y-%m-%d %I:%M %p %Z") # Remove /automated_task prefix from inferred_query unprefixed_query_to_run = re.sub(r"^\/automated_task\s*", "", query_to_run) # Create the automation response - scheme = "http" if not url.is_secure else "https" - automation_icon_url = f"{scheme}://{url.netloc}/static/assets/icons/automation.svg" + automation_icon_url = f"/static/assets/icons/automation.svg" return f""" ### ![]({automation_icon_url}) Created Automation - Subject: **{subject}**