feat: init commint
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def configure_non_chat_models(apps, schema_editor):
|
||||
ModelDeployment = apps.get_model("modelhub", "ModelDeployment")
|
||||
ModelDeployment.objects.filter(capability__in={"embedding", "rerank"}).update(
|
||||
structured_output_mode="none",
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("modelhub", "0002_modelprovider_image_egress_approved_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="structured_output_mode",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("unconfigured", "未配置"),
|
||||
("native_json_schema", "原生 JSON Schema"),
|
||||
("json_object", "JSON Object"),
|
||||
("prompt_schema", "Prompt Schema"),
|
||||
("none", "不支持"),
|
||||
],
|
||||
default="unconfigured",
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="structured_output_test_status",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("untested", "未验证"),
|
||||
("passed", "已通过"),
|
||||
("failed", "验证失败"),
|
||||
],
|
||||
default="untested",
|
||||
max_length=16,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="structured_output_test_message",
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="structured_output_verified_at",
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
migrations.RunPython(configure_non_chat_models, migrations.RunPython.noop),
|
||||
]
|
||||
@@ -0,0 +1,103 @@
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("modelhub", "0003_structured_output_governance"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="modelprovider",
|
||||
name="name",
|
||||
field=models.CharField(max_length=120),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modelprovider",
|
||||
name="archived_at",
|
||||
field=models.DateTimeField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modelprovider",
|
||||
name="archived_by",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="archived_model_providers",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modelprovider",
|
||||
name="credential_updated_at",
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modelprovider",
|
||||
name="credential_updated_by",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="updated_model_provider_credentials",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="archived_at",
|
||||
field=models.DateTimeField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="archived_by",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="archived_model_deployments",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modeldeployment",
|
||||
name="archived_via_provider",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="modelinvocation",
|
||||
name="diagnostics_scrubbed_at",
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
migrations.RemoveConstraint(
|
||||
model_name="modeldeployment",
|
||||
name="unique_provider_model_name",
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="modelprovider",
|
||||
constraint=models.UniqueConstraint(
|
||||
condition=models.Q(("archived_at__isnull", True)),
|
||||
fields=("name",),
|
||||
name="unique_active_model_provider_name",
|
||||
),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="modeldeployment",
|
||||
constraint=models.UniqueConstraint(
|
||||
condition=models.Q(("archived_at__isnull", True)),
|
||||
fields=("provider", "model_name"),
|
||||
name="unique_active_provider_model_name",
|
||||
),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="modelinvocation",
|
||||
index=models.Index(
|
||||
fields=["deployment", "created_at"],
|
||||
name="modelhub_mo_deploym_844a9d_idx",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def normalize_non_chat_structured_output(apps, schema_editor):
|
||||
ModelDeployment = apps.get_model("modelhub", "ModelDeployment")
|
||||
ModelDeployment.objects.filter(capability__in={"embedding", "rerank"}).update(
|
||||
structured_output_mode="none",
|
||||
structured_output_test_status="untested",
|
||||
structured_output_verified_at=None,
|
||||
structured_output_test_message="",
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("modelhub", "0004_modelhub_lifecycle_governance"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
normalize_non_chat_structured_output,
|
||||
migrations.RunPython.noop,
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user