feat: implement t-604 keyword prompt moderation
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# Generated by Codex for T-604.
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="SensitiveWord",
|
||||
fields=[
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("word", models.CharField(max_length=255, verbose_name="敏感词")),
|
||||
("normalized_word", models.CharField(editable=False, max_length=255, verbose_name="归一化敏感词")),
|
||||
("category", models.CharField(blank=True, default="custom", max_length=64, verbose_name="分类")),
|
||||
("action", models.CharField(choices=[("block", "拦截")], default="block", max_length=16, verbose_name="动作")),
|
||||
("is_active", models.BooleanField(default=True, verbose_name="启用")),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
|
||||
("updated_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "敏感词",
|
||||
"verbose_name_plural": "敏感词",
|
||||
"db_table": "sensitive_word",
|
||||
"ordering": ("category", "word"),
|
||||
},
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="sensitiveword",
|
||||
index=models.Index(fields=["is_active", "category"], name="sw_active_category_idx"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="sensitiveword",
|
||||
index=models.Index(fields=["normalized_word"], name="sw_normalized_word_idx"),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="sensitiveword",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("category", "normalized_word"),
|
||||
name="unique_sensitive_word_per_category",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user