From fe0c8d04e4a23fb3a9497d2bff2d045ad1103bab Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Thu, 7 May 2026 11:04:22 +0530 Subject: [PATCH 1/3] OpenConceptLab/ocl_issues#2383 | saving prompt template url --- ...mapproject_prompt_template_url_and_more.py | 23 +++++++++++++++++++ core/map_projects/models.py | 3 ++- core/map_projects/serializers.py | 5 ++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 core/map_projects/migrations/0033_mapproject_prompt_template_url_and_more.py diff --git a/core/map_projects/migrations/0033_mapproject_prompt_template_url_and_more.py b/core/map_projects/migrations/0033_mapproject_prompt_template_url_and_more.py new file mode 100644 index 00000000..20f6d0e3 --- /dev/null +++ b/core/map_projects/migrations/0033_mapproject_prompt_template_url_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 5.1.15 on 2026-05-07 04:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('map_projects', '0032_alter_mapproject_encoder_model'), + ] + + operations = [ + migrations.AddField( + model_name='mapproject', + name='prompt_template_url', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='mapproject', + name='encoder_model', + field=models.TextField(blank=True, default='BAAI/bge-reranker-v2-m3', null=True), + ), + ] diff --git a/core/map_projects/models.py b/core/map_projects/models.py index 7e64d1e8..cf998c2e 100644 --- a/core/map_projects/models.py +++ b/core/map_projects/models.py @@ -40,13 +40,14 @@ class MapProject(BaseModel): lookup_config = models.JSONField(default=dict, null=True, blank=True) analysis = models.JSONField(default=dict, null=True, blank=True) encoder_model = models.TextField(null=True, blank=True, default=settings.ENCODER_MODEL_NAME) + prompt_template_url = models.TextField(null=True, blank=True) # Fields that define how a project matches — # excluding identity, results, logs, and audit metadata. # Used by the copy-project flow. CONFIGURATION_FIELDS = [ 'algorithms', 'encoder_model', 'filters', 'include_retired', - 'lookup_config', 'score_configuration', 'target_repo_url', + 'lookup_config', 'score_configuration', 'target_repo_url', 'prompt_template_url' ] class Meta: diff --git a/core/map_projects/serializers.py b/core/map_projects/serializers.py index 56b2973c..a6540b6a 100644 --- a/core/map_projects/serializers.py +++ b/core/map_projects/serializers.py @@ -22,7 +22,8 @@ class Meta: 'created_by', 'updated_by', 'created_at', 'updated_at', 'url', 'is_active', 'public_access', 'file', 'user_id', 'organization_id', 'description', 'target_repo_url', 'include_retired', 'score_configuration', - 'filters', 'candidates', 'algorithms', 'lookup_config', 'analysis', 'encoder_model' + 'filters', 'candidates', 'algorithms', 'lookup_config', 'analysis', 'encoder_model', + 'prompt_template_url' ] def prepare_object(self, validated_data, instance=None, file=None): @@ -37,7 +38,7 @@ def prepare_object(self, validated_data, instance=None, file=None): for attr in [ 'name', 'description', 'extras', 'target_repo_url', 'include_retired', 'score_configuration', 'filters', 'candidates', 'algorithms', 'lookup_config', 'analysis', - 'encoder_model' + 'encoder_model', 'prompt_template_url' ]: setattr(instance, attr, validated_data.get(attr, get(instance, attr))) if not instance.id: From f4e50b3ad28bf953b013c91d3b84538c0af82337 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Thu, 7 May 2026 17:55:35 +0530 Subject: [PATCH 2/3] OpenConceptLab/ocl_issues#2383 | renamed to prompt_template_key --- ...plate_url_mapproject_prompt_template_key.py | 18 ++++++++++++++++++ core/map_projects/models.py | 4 ++-- core/map_projects/serializers.py | 4 ++-- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 core/map_projects/migrations/0034_rename_prompt_template_url_mapproject_prompt_template_key.py diff --git a/core/map_projects/migrations/0034_rename_prompt_template_url_mapproject_prompt_template_key.py b/core/map_projects/migrations/0034_rename_prompt_template_url_mapproject_prompt_template_key.py new file mode 100644 index 00000000..d1e1016f --- /dev/null +++ b/core/map_projects/migrations/0034_rename_prompt_template_url_mapproject_prompt_template_key.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.15 on 2026-05-07 12:21 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('map_projects', '0033_mapproject_prompt_template_url_and_more'), + ] + + operations = [ + migrations.RenameField( + model_name='mapproject', + old_name='prompt_template_url', + new_name='prompt_template_key', + ), + ] diff --git a/core/map_projects/models.py b/core/map_projects/models.py index cf998c2e..adfa9074 100644 --- a/core/map_projects/models.py +++ b/core/map_projects/models.py @@ -40,14 +40,14 @@ class MapProject(BaseModel): lookup_config = models.JSONField(default=dict, null=True, blank=True) analysis = models.JSONField(default=dict, null=True, blank=True) encoder_model = models.TextField(null=True, blank=True, default=settings.ENCODER_MODEL_NAME) - prompt_template_url = models.TextField(null=True, blank=True) + prompt_template_key = models.TextField(null=True, blank=True) # Fields that define how a project matches — # excluding identity, results, logs, and audit metadata. # Used by the copy-project flow. CONFIGURATION_FIELDS = [ 'algorithms', 'encoder_model', 'filters', 'include_retired', - 'lookup_config', 'score_configuration', 'target_repo_url', 'prompt_template_url' + 'lookup_config', 'score_configuration', 'target_repo_url', 'prompt_template_key' ] class Meta: diff --git a/core/map_projects/serializers.py b/core/map_projects/serializers.py index a6540b6a..201f03d8 100644 --- a/core/map_projects/serializers.py +++ b/core/map_projects/serializers.py @@ -23,7 +23,7 @@ class Meta: 'public_access', 'file', 'user_id', 'organization_id', 'description', 'target_repo_url', 'include_retired', 'score_configuration', 'filters', 'candidates', 'algorithms', 'lookup_config', 'analysis', 'encoder_model', - 'prompt_template_url' + 'prompt_template_key' ] def prepare_object(self, validated_data, instance=None, file=None): @@ -38,7 +38,7 @@ def prepare_object(self, validated_data, instance=None, file=None): for attr in [ 'name', 'description', 'extras', 'target_repo_url', 'include_retired', 'score_configuration', 'filters', 'candidates', 'algorithms', 'lookup_config', 'analysis', - 'encoder_model', 'prompt_template_url' + 'encoder_model', 'prompt_template_key' ]: setattr(instance, attr, validated_data.get(attr, get(instance, attr))) if not instance.id: From 4657de349fa562800439259a6376c15c0185d9d6 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Thu, 7 May 2026 17:57:50 +0530 Subject: [PATCH 3/3] OpenConceptLab/ocl_issues#2383 | added test for configuration to cover prompt template key --- core/map_projects/tests/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/map_projects/tests/tests.py b/core/map_projects/tests/tests.py index 43d33179..05e84114 100644 --- a/core/map_projects/tests/tests.py +++ b/core/map_projects/tests/tests.py @@ -134,6 +134,7 @@ def test_get_200(self): lookup_config={'concepts': {'limit': 20}}, score_configuration={'recommended': 95, 'available': 75}, target_repo_url='/orgs/CIEL/sources/CIEL/', + prompt_template_key='match-recommend' ) project.save() @@ -154,5 +155,6 @@ def test_get_200(self): self.assertEqual(response.data['lookup_config'], {'concepts': {'limit': 20}}) self.assertEqual(response.data['score_configuration'], {'recommended': 95, 'available': 75}) self.assertEqual(response.data['target_repo_url'], '/orgs/CIEL/sources/CIEL/') + self.assertEqual(response.data['prompt_template_key'], 'match-recommend') for field in ['analysis', 'input_file_name', 'candidates', 'matches', 'columns', 'created_by', 'updated_by']: self.assertNotIn(field, response.data)