update applying current ai insight from dashboard-cpsp

This commit is contained in:
Alberto-Audrix committed 2026-10-05 14:25:22 +07:00
1 parent 31272035e9
commit b87f20e3b3
27 files changed
+5300 -343

No files matched your search

+17 -7
View File
@@ -29,21 +29,31 @@ class IotPanel(models.Model):
class AIInsight(models.Model):
date = models.DateField()
insight_text = models.TextField()
alert = models.CharField(max_length=100)
section = models.CharField(max_length=100)
session = models.CharField(max_length=100)
alert = models.CharField(max_length=100, blank=True, default="")
cycle = models.ForeignKey(Cycle, on_delete=models.CASCADE, related_name="ai_insights")
kandang = models.ForeignKey(
"farms.Kandang",
on_delete=models.CASCADE,
related_name="ai_insights",
null=True,
blank=True,
)
topic = models.CharField(max_length=64, blank=True, default="", db_index=True)
report_type = models.CharField(max_length=32, blank=True, default="page", db_index=True)
report_period = models.CharField(max_length=64, blank=True, default="current", db_index=True)
summary = models.TextField(blank=True, default="")
citations = models.TextField(blank=True, default="[]")
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
db_table = "ai_insight"
ordering = ["-date"]
ordering = ["-date", "-created_at"]
constraints = [
models.UniqueConstraint(
fields=["cycle", "date", "section", "session"],
name="uniq_ai_insight_cycle_date_section_session",
),
fields=["cycle", "kandang", "topic", "report_type", "report_period"],
name="uniq_ai_insight_cache_scope",
)
]