From 43c9ec260d5ebf3bf54ba9607a8bc2b28ffd1150 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Fri, 24 Jan 2025 08:24:53 -0800 Subject: [PATCH] Allow agent personality to be nullable, in which case the default prompt will be used. --- ..._modes_alter_agent_personality_and_more.py | 71 +++++++++++++++++++ src/khoj/database/models/__init__.py | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/khoj/database/migrations/0083_alter_agent_output_modes_alter_agent_personality_and_more.py diff --git a/src/khoj/database/migrations/0083_alter_agent_output_modes_alter_agent_personality_and_more.py b/src/khoj/database/migrations/0083_alter_agent_output_modes_alter_agent_personality_and_more.py new file mode 100644 index 00000000..7a2b45d0 --- /dev/null +++ b/src/khoj/database/migrations/0083_alter_agent_output_modes_alter_agent_personality_and_more.py @@ -0,0 +1,71 @@ +# Generated by Django 5.0.10 on 2025-01-24 16:23 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("database", "0082_merge_20250121_1842"), + ] + + operations = [ + migrations.AlterField( + model_name="agent", + name="output_modes", + field=django.contrib.postgres.fields.ArrayField( + base_field=models.CharField( + choices=[("image", "Image"), ("automation", "Automation"), ("diagram", "Diagram")], max_length=200 + ), + blank=True, + default=list, + null=True, + size=None, + ), + ), + migrations.AlterField( + model_name="agent", + name="personality", + field=models.TextField(blank=True, default=None, null=True), + ), + migrations.AlterField( + model_name="agent", + name="style_color", + field=models.CharField( + choices=[ + ("blue", "Blue"), + ("green", "Green"), + ("red", "Red"), + ("yellow", "Yellow"), + ("orange", "Orange"), + ("purple", "Purple"), + ("pink", "Pink"), + ("teal", "Teal"), + ("cyan", "Cyan"), + ("lime", "Lime"), + ("indigo", "Indigo"), + ("fuchsia", "Fuchsia"), + ("rose", "Rose"), + ("sky", "Sky"), + ("amber", "Amber"), + ("emerald", "Emerald"), + ], + default="orange", + max_length=200, + ), + ), + migrations.AlterField( + model_name="processlock", + name="name", + field=models.CharField( + choices=[ + ("index_content", "Index Content"), + ("scheduled_job", "Scheduled Job"), + ("schedule_leader", "Schedule Leader"), + ("apply_migrations", "Apply Migrations"), + ], + max_length=200, + unique=True, + ), + ), + ] diff --git a/src/khoj/database/models/__init__.py b/src/khoj/database/models/__init__.py index ea7fbfe8..f377c9f7 100644 --- a/src/khoj/database/models/__init__.py +++ b/src/khoj/database/models/__init__.py @@ -293,7 +293,7 @@ class Agent(DbBaseModel): KhojUser, on_delete=models.CASCADE, default=None, null=True, blank=True ) # Creator will only be null when the agents are managed by admin name = models.CharField(max_length=200) - personality = models.TextField() + personality = models.TextField(default=None, null=True, blank=True) input_tools = ArrayField( models.CharField(max_length=200, choices=InputToolOptions.choices), default=list, null=True, blank=True )