feat(audit): 增加审计日志与演示数据管理

This commit is contained in:
2026-05-30 00:10:26 +08:00
parent 4a831ee2c5
commit 5c9718ddb1
13 changed files with 333 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
# Generated by Django 5.2.14 on 2026-05-29 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="AgentAuditLog",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("scenario_id", models.CharField(db_index=True, max_length=100)),
("scenario_name", models.CharField(blank=True, max_length=200)),
("user_input", models.TextField()),
("retrieved_chunks", models.JSONField(blank=True, default=list)),
("tool_calls", models.JSONField(blank=True, default=list)),
("structured_output", models.JSONField(blank=True, default=dict)),
("final_answer", models.TextField(blank=True)),
("raw_output", models.TextField(blank=True)),
("model_name", models.CharField(blank=True, max_length=100)),
("latency_ms", models.PositiveIntegerField(default=0)),
(
"status",
models.CharField(db_index=True, default="success", max_length=20),
),
("error_message", models.TextField(blank=True)),
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
],
options={
"ordering": ["-created_at"],
},
),
]

View File

@@ -0,0 +1,35 @@
# Generated for V1 demo business records.
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("audit", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="DemoBusinessRecord",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("scenario_id", models.CharField(db_index=True, max_length=100)),
("record_type", models.CharField(db_index=True, max_length=100)),
("title", models.CharField(max_length=255)),
("payload", models.JSONField(blank=True, default=dict)),
("created_at", models.DateTimeField(auto_now_add=True)),
],
options={
"ordering": ["-created_at"],
},
),
]

View File