mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Do not hard code base url of path to automation icon in chat message
This commit is contained in:
@@ -401,9 +401,7 @@ async def websocket_endpoint(
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
llm_response = construct_automation_created_message(
|
llm_response = construct_automation_created_message(automation, crontime, query_to_run, subject)
|
||||||
automation, crontime, query_to_run, subject, websocket.url
|
|
||||||
)
|
|
||||||
await sync_to_async(save_to_conversation_log)(
|
await sync_to_async(save_to_conversation_log)(
|
||||||
q,
|
q,
|
||||||
llm_response,
|
llm_response,
|
||||||
@@ -643,7 +641,7 @@ async def chat(
|
|||||||
status_code=500,
|
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)(
|
await sync_to_async(save_to_conversation_log)(
|
||||||
q,
|
q,
|
||||||
llm_response,
|
llm_response,
|
||||||
|
|||||||
@@ -1001,15 +1001,14 @@ async def schedule_automation(
|
|||||||
return job
|
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
|
# Display next run time in user timezone instead of UTC
|
||||||
schedule = f'{cron_descriptor.get_description(crontime)} {automation.next_run_time.strftime("%Z")}'
|
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")
|
next_run_time = automation.next_run_time.strftime("%Y-%m-%d %I:%M %p %Z")
|
||||||
# Remove /automated_task prefix from inferred_query
|
# Remove /automated_task prefix from inferred_query
|
||||||
unprefixed_query_to_run = re.sub(r"^\/automated_task\s*", "", query_to_run)
|
unprefixed_query_to_run = re.sub(r"^\/automated_task\s*", "", query_to_run)
|
||||||
# Create the automation response
|
# Create the automation response
|
||||||
scheme = "http" if not url.is_secure else "https"
|
automation_icon_url = f"/static/assets/icons/automation.svg"
|
||||||
automation_icon_url = f"{scheme}://{url.netloc}/static/assets/icons/automation.svg"
|
|
||||||
return f"""
|
return f"""
|
||||||
###  Created Automation
|
###  Created Automation
|
||||||
- Subject: **{subject}**
|
- Subject: **{subject}**
|
||||||
|
|||||||
Reference in New Issue
Block a user