05/31 Phase 1: initial codes
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from app.extensions import db
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class AiInsight(db.Model):
|
||||
__tablename__ = 'ai_insights'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
insight_date = db.Column(db.Date, nullable=False, index=True)
|
||||
insight_type = db.Column(
|
||||
db.Enum('daily_summary', 'weekly_summary', 'chat_response', 'alert'),
|
||||
nullable=False,
|
||||
default='daily_summary'
|
||||
)
|
||||
prompt_summary = db.Column(db.Text, nullable=True) # what context was sent
|
||||
content = db.Column(db.Text, nullable=False) # AI response
|
||||
model_used = db.Column(db.String(64), nullable=True)
|
||||
tokens_used = db.Column(db.Integer, nullable=True)
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<AiInsight {self.insight_type} {self.insight_date}>'
|
||||
Reference in New Issue
Block a user