From c144aa9c902d3996bbcb0fab9d18134f60fa5356 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 8 Jul 2025 21:05:13 -0700 Subject: [PATCH] Handle automation calling url of both url and string type Calling url can be of url type in production but locally it is of string type. Unclear why. But this change should mitigate the issue for now. --- src/khoj/routers/helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index db75423a..48fa4252 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -2174,7 +2174,7 @@ def scheduled_chat( scheduling_request: str, subject: str, user: KhojUser, - calling_url: str, + calling_url: str | URL, job_id: str = None, conversation_id: str = None, ): @@ -2194,8 +2194,8 @@ def scheduled_chat( return # Extract relevant params from the original URL - parsed_url = urlparse(calling_url) - scheme = parsed_url.scheme + parsed_url = URL(calling_url) if isinstance(calling_url, str) else calling_url + scheme = "http" if not parsed_url.is_secure else "https" query_dict = parse_qs(parsed_url.query) # Pop the stream value from query_dict if it exists