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.
This commit is contained in:
Debanjum
2025-07-08 21:05:13 -07:00
parent fad6a638bd
commit c144aa9c90

View File

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