mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Use Personality vernacular in agent page
- When setting up the default agent, configure every conversation that doesn't have an agent to use the Khoj agent - Fix reverse migration for the locale removal migration
This commit is contained in:
@@ -446,19 +446,21 @@ class AgentAdapters:
|
|||||||
agent.slug = AgentAdapters.DEFAULT_AGENT_SLUG
|
agent.slug = AgentAdapters.DEFAULT_AGENT_SLUG
|
||||||
agent.name = AgentAdapters.DEFAULT_AGENT_NAME
|
agent.name = AgentAdapters.DEFAULT_AGENT_NAME
|
||||||
agent.save()
|
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
|
||||||
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def aget_default_agent():
|
async def aget_default_agent():
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
from django.db import migrations, models
|
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):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("database", "0030_conversation_slug_and_title"),
|
("database", "0030_conversation_slug_and_title"),
|
||||||
@@ -14,4 +26,5 @@ class Migration(migrations.Migration):
|
|||||||
name="locale",
|
name="locale",
|
||||||
field=models.CharField(blank=True, default=None, max_length=200, null=True),
|
field=models.CharField(blank=True, default=None, max_length=200, null=True),
|
||||||
),
|
),
|
||||||
|
migrations.RunPython(set_default_locale, reverse_set_default_locale),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<img id="agent-avatar" src="{{ agent.avatar }}" alt="Agent Avatar">
|
<img id="agent-avatar" src="{{ agent.avatar }}" alt="Agent Avatar">
|
||||||
<input type="text" id="agent-name-input" value="{{ agent.name }}" {% if agent.creator_not_self %} disabled {% endif %}>
|
<input type="text" id="agent-name-input" value="{{ agent.name }}" {% if agent.creator_not_self %} disabled {% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div id="agent-instructions">Instructions</div>
|
<div id="agent-instructions">Personality</div>
|
||||||
<div id="agent-tuning">
|
<div id="agent-tuning">
|
||||||
<p>{{ agent.personality }}</p>
|
<p>{{ agent.personality }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user