Improving chat functionality significantly throughout the application.
This commit is contained in:
@@ -6,6 +6,7 @@ from .document import Embedding
|
||||
class ChatSession(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey(User.id), nullable=True)
|
||||
session_id = db.Column(db.String(36), nullable=True)
|
||||
session_start = db.Column(db.DateTime, nullable=False)
|
||||
session_end = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
@@ -21,6 +22,7 @@ class Interaction(db.Model):
|
||||
chat_session_id = db.Column(db.Integer, db.ForeignKey(ChatSession.id), nullable=False)
|
||||
question = db.Column(db.Text, nullable=False)
|
||||
answer = db.Column(db.Text, nullable=True)
|
||||
algorithm_used = db.Column(db.String(20), nullable=True)
|
||||
language = db.Column(db.String(2), nullable=False)
|
||||
appreciation = db.Column(db.Integer, nullable=True, default=100)
|
||||
|
||||
@@ -28,6 +30,9 @@ class Interaction(db.Model):
|
||||
question_at = db.Column(db.DateTime, nullable=False)
|
||||
answer_at = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
# Relations
|
||||
embeddings = db.relationship('InteractionEmbedding', backref='interaction', lazy=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Interaction {self.id}>"
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class Tenant(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(80), unique=True, nullable=False)
|
||||
website = db.Column(db.String(255), nullable=True)
|
||||
timezone = db.Column(db.String(50), nullable=True, default='UTC')
|
||||
|
||||
# language information
|
||||
default_language = db.Column(db.String(2), nullable=True)
|
||||
@@ -70,7 +71,9 @@ class Tenant(db.Model):
|
||||
'llm_model': self.llm_model,
|
||||
'license_start_date': self.license_start_date,
|
||||
'license_end_date': self.license_end_date,
|
||||
'allowed_monthly_interactions': self.allowed_monthly_interactions
|
||||
'allowed_monthly_interactions': self.allowed_monthly_interactions,
|
||||
'embed_tuning': self.embed_tuning,
|
||||
'rag_tuning': self.rag_tuning,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user