feat: display account name on the logs page for the apps (#7668)

Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
kurokobo
2024-08-27 13:40:44 +09:00
committed by GitHub
parent 122ce41020
commit d7aa4076c9
21 changed files with 46 additions and 36 deletions

View File

@@ -111,6 +111,7 @@ conversation_fields = {
"from_end_user_id": fields.String,
"from_end_user_session_id": fields.String(),
"from_account_id": fields.String,
"from_account_name": fields.String,
"read_at": TimestampField,
"created_at": TimestampField,
"annotation": fields.Nested(annotation_fields, allow_null=True),
@@ -146,6 +147,7 @@ conversation_with_summary_fields = {
"from_end_user_id": fields.String,
"from_end_user_session_id": fields.String,
"from_account_id": fields.String,
"from_account_name": fields.String,
"name": fields.String,
"summary": fields.String(attribute="summary_or_query"),
"read_at": TimestampField,

View File

@@ -490,7 +490,6 @@ class InstalledApp(db.Model):
return tenant
class Conversation(db.Model):
__tablename__ = 'conversations'
__table_args__ = (
@@ -623,6 +622,15 @@ class Conversation(db.Model):
return None
@property
def from_account_name(self):
if self.from_account_id:
account = db.session.query(Account).filter(Account.id == self.from_account_id).first()
if account:
return account.name
return None
@property
def in_debug_mode(self):
return self.override_model_configs is not None