Jul 9 - Chat - Add knowledge base for AI training
This commit is contained in:
@@ -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}>'
|
||||
|
||||
Reference in New Issue
Block a user