feat: init commint
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
TRUSTED_SKILL_CODES = {
|
||||
"ticket-fact-extraction",
|
||||
"ticket-draft",
|
||||
"support-analysis",
|
||||
"knowledge-distillation",
|
||||
}
|
||||
|
||||
|
||||
def classify_existing_skills(apps, schema_editor):
|
||||
SkillVersion = apps.get_model("skills", "SkillVersion")
|
||||
SkillVersion.objects.filter(
|
||||
definition__code__in=TRUSTED_SKILL_CODES,
|
||||
).update(output_enforcement="native_json_schema")
|
||||
|
||||
|
||||
def unclassify_existing_skills(apps, schema_editor):
|
||||
SkillVersion = apps.get_model("skills", "SkillVersion")
|
||||
SkillVersion.objects.filter(
|
||||
definition__code__in=TRUSTED_SKILL_CODES,
|
||||
).update(output_enforcement="validated_json")
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("skills", "0001_initial"),
|
||||
("modelhub", "0003_structured_output_governance"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="skillversion",
|
||||
name="output_enforcement",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("native_json_schema", "原生 JSON Schema"),
|
||||
("json_object", "JSON Object"),
|
||||
("validated_json", "校验型 JSON"),
|
||||
],
|
||||
default="validated_json",
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
migrations.RunPython(
|
||||
classify_existing_skills,
|
||||
unclassify_existing_skills,
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user