From 72986c905a9ee7c6d4ba4ed652f887a37aea2713 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Fri, 28 Mar 2025 19:04:10 +0530 Subject: [PATCH] Fix default agent creation to allow chat on first run Previously agent slug was not considered on create even when passed explicitly in agent creation step. This made the default agent slug different until next run when it was updated after creation. And didn't allow chat to work on first run The fix to use the agent slug when explicitly passed allows users to chat on first run. --- src/khoj/database/models/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/database/models/__init__.py b/src/khoj/database/models/__init__.py index 44dcac27..6da88c53 100644 --- a/src/khoj/database/models/__init__.py +++ b/src/khoj/database/models/__init__.py @@ -313,7 +313,7 @@ class Agent(DbBaseModel): if self.creator is None: self.managed_by_admin = True - if is_new: + if is_new and not self.slug: random_sequence = "".join(choice("0123456789") for i in range(6)) slug = f"{self.name.lower().replace(' ', '-')}-{random_sequence}" self.slug = slug