mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Exit early when running an automation if the conversation for the automation does not exist.
This commit is contained in:
parent
7468f6a6ed
commit
a5e2b9e745
1 changed files with 5 additions and 0 deletions
|
@ -1582,6 +1582,11 @@ def scheduled_chat(
|
|||
# encode the conversation_id to avoid any issues with special characters
|
||||
query_dict["conversation_id"] = [quote(str(conversation_id))]
|
||||
|
||||
# validate that the conversation id exists. If not, delete the automation and exit.
|
||||
if not ConversationAdapters.get_conversation_by_id(conversation_id):
|
||||
AutomationAdapters.delete_automation(user, job_id)
|
||||
return
|
||||
|
||||
# Restructure the original query_dict into a valid JSON payload for the chat API
|
||||
json_payload = {key: values[0] for key, values in query_dict.items()}
|
||||
|
||||
|
|
Loading…
Reference in a new issue