Jul 9 - Chat - Add knowledge base for AI training

This commit is contained in:
2026-07-09 15:21:21 -04:00
parent 43d6776185
commit 8d4b8b72eb
8 changed files with 438 additions and 30 deletions
+19
View File
@@ -90,3 +90,22 @@ class SupportChatMessage(db.Model):
def __repr__(self):
return f'<SupportChatMessage {self.id} session={self.session_id} role={self.role}>'
class SupportKnowledge(db.Model):
"""Admin-curated knowledge entries injected into the AI support chat's system
prompt (phase38). Lets staff 'train' the chatbot's app knowledge without code
changes — each active entry is appended to the prompt on every chat request."""
__tablename__ = 'support_knowledge'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(200), nullable=False) # topic / question
content = db.Column(db.Text, nullable=False) # the answer / knowledge
active = db.Column(db.Boolean, nullable=False, default=True)
sort_order = db.Column(db.Integer, nullable=False, default=0)
created_by = db.Column(db.Integer, db.ForeignKey('users.id', ondelete='SET NULL'), nullable=True)
created_at = db.Column(db.DateTime, default=now_eastern, nullable=False)
updated_at = db.Column(db.DateTime, default=now_eastern, nullable=False)
def __repr__(self):
return f'<SupportKnowledge {self.id} "{self.title[:30]}" active={self.active}>'