diff --git a/src/khoj/database/adapters/__init__.py b/src/khoj/database/adapters/__init__.py
index d7730c0e..67cbafbf 100644
--- a/src/khoj/database/adapters/__init__.py
+++ b/src/khoj/database/adapters/__init__.py
@@ -446,19 +446,21 @@ class AgentAdapters:
agent.slug = AgentAdapters.DEFAULT_AGENT_SLUG
agent.name = AgentAdapters.DEFAULT_AGENT_NAME
agent.save()
- return agent
+ else:
+ # The default agent is public and managed by the admin. It's handled a little differently than other agents.
+ agent = Agent.objects.create(
+ name=AgentAdapters.DEFAULT_AGENT_NAME,
+ public=True,
+ managed_by_admin=True,
+ chat_model=default_conversation_config,
+ personality=default_personality,
+ tools=["*"],
+ avatar=AgentAdapters.DEFAULT_AGENT_AVATAR,
+ slug=AgentAdapters.DEFAULT_AGENT_SLUG,
+ )
+ Conversation.objects.filter(agent=None).update(agent=agent)
- # The default agent is public and managed by the admin. It's handled a little differently than other agents.
- return Agent.objects.create(
- name=AgentAdapters.DEFAULT_AGENT_NAME,
- public=True,
- managed_by_admin=True,
- chat_model=default_conversation_config,
- personality=default_personality,
- tools=["*"],
- avatar=AgentAdapters.DEFAULT_AGENT_AVATAR,
- slug=AgentAdapters.DEFAULT_AGENT_SLUG,
- )
+ return agent
@staticmethod
async def aget_default_agent():
diff --git a/src/khoj/database/migrations/0031_alter_googleuser_locale.py b/src/khoj/database/migrations/0031_alter_googleuser_locale.py
index 99c4573a..a5b4cdab 100644
--- a/src/khoj/database/migrations/0031_alter_googleuser_locale.py
+++ b/src/khoj/database/migrations/0031_alter_googleuser_locale.py
@@ -3,6 +3,18 @@
from django.db import migrations, models
+def set_default_locale(apps, schema_editor):
+ return
+
+
+def reverse_set_default_locale(apps, schema_editor):
+ GoogleUser = apps.get_model("database", "GoogleUser")
+ for user in GoogleUser.objects.all():
+ if not user.locale:
+ user.locale = "en"
+ user.save()
+
+
class Migration(migrations.Migration):
dependencies = [
("database", "0030_conversation_slug_and_title"),
@@ -14,4 +26,5 @@ class Migration(migrations.Migration):
name="locale",
field=models.CharField(blank=True, default=None, max_length=200, null=True),
),
+ migrations.RunPython(set_default_locale, reverse_set_default_locale),
]
diff --git a/src/khoj/interface/web/agent.html b/src/khoj/interface/web/agent.html
index 6e6619cf..6e6a5ef7 100644
--- a/src/khoj/interface/web/agent.html
+++ b/src/khoj/interface/web/agent.html
@@ -24,7 +24,7 @@
-
{{ agent.personality }}