Files
Logic/Modules/Ai/rag/migrations/0001_initial.py
T
2026-05-11 03:27:21 +03:30

34 lines
2.0 KiB
Python

from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="ChatAuditLog",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("farm_uuid", models.UUIDField(blank=True, help_text="شناسه مزرعه مرتبط با درخواست چت", null=True)),
("service_id", models.CharField(default="chat", help_text="شناسه سرویس RAG استفاده شده برای این درخواست", max_length=64)),
("model", models.CharField(blank=True, help_text="مدل LLM استفاده شده برای پاسخ", max_length=128)),
("user_query", models.TextField(help_text="متن پرسش کاربر")),
("system_prompt", models.TextField(blank=True, help_text="system prompt نهایی ارسال شده به مدل")),
("messages", models.JSONField(blank=True, default=list, help_text="لیست کامل پیام‌های ارسال شده به مدل")),
("response_text", models.TextField(blank=True, help_text="متن کامل پاسخ دریافتی از مدل")),
("error_message", models.TextField(blank=True, help_text="خطای رخ داده هنگام فراخوانی مدل یا استریم")),
("status", models.CharField(choices=[("started", "شروع شده"), ("completed", "تکمیل شده"), ("failed", "ناموفق")], default="started", max_length=16)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
],
options={
"db_table": "rag_chatauditlog",
"ordering": ["-created_at"],
"verbose_name": "لاگ چت RAG",
"verbose_name_plural": "لاگ\u200cهای چت RAG",
},
),
]