mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-02 11:18:19 +08:00
fix: not annotation error in log (#686)
This commit is contained in:
parent
6a564e2d5c
commit
396197e881
@ -249,7 +249,7 @@ class ChatConversationApi(Resource):
|
||||
'status': fields.String,
|
||||
'from_source': fields.String,
|
||||
'from_end_user_id': fields.String,
|
||||
'from_end_user_session_id': fields.String(attribute='end_user.session_id'),
|
||||
'from_end_user_session_id': fields.String,
|
||||
'from_account_id': fields.String,
|
||||
'summary': fields.String(attribute='summary_or_query'),
|
||||
'read_at': TimestampField,
|
||||
@ -292,8 +292,6 @@ class ChatConversationApi(Resource):
|
||||
|
||||
query = db.select(Conversation).where(Conversation.app_id == app.id, Conversation.mode == 'chat')
|
||||
|
||||
query = query.options(joinedload(Conversation.end_user))
|
||||
|
||||
if args['keyword']:
|
||||
query = query.join(
|
||||
Message, Message.conversation_id == Conversation.id
|
||||
|
@ -226,7 +226,7 @@ class Conversation(db.Model):
|
||||
system_instruction_tokens = db.Column(db.Integer, nullable=False, server_default=db.text('0'))
|
||||
status = db.Column(db.String(255), nullable=False)
|
||||
from_source = db.Column(db.String(255), nullable=False)
|
||||
from_end_user_id = db.Column(UUID, db.ForeignKey('end_users.id'))
|
||||
from_end_user_id = db.Column(UUID)
|
||||
from_account_id = db.Column(UUID)
|
||||
read_at = db.Column(db.DateTime)
|
||||
read_account_id = db.Column(UUID)
|
||||
@ -236,8 +236,6 @@ class Conversation(db.Model):
|
||||
messages = db.relationship("Message", backref="conversation", lazy='select', passive_deletes="all")
|
||||
message_annotations = db.relationship("MessageAnnotation", backref="conversation", lazy='select', passive_deletes="all")
|
||||
|
||||
end_user = db.relationship("EndUser", backref="conversations")
|
||||
|
||||
is_deleted = db.Column(db.Boolean, nullable=False, server_default=db.text('false'))
|
||||
|
||||
@property
|
||||
@ -346,6 +344,15 @@ class Conversation(db.Model):
|
||||
def app(self):
|
||||
return db.session.query(App).filter(App.id == self.app_id).first()
|
||||
|
||||
@property
|
||||
def from_end_user_session_id(self):
|
||||
if self.from_end_user_id:
|
||||
end_user = db.session.query(EndUser).filter(EndUser.id == self.from_end_user_id).first()
|
||||
if end_user:
|
||||
return end_user.session_id
|
||||
|
||||
return None
|
||||
|
||||
@property
|
||||
def in_debug_mode(self):
|
||||
return self.override_model_configs is not None
|
||||
|
Loading…
Reference in New Issue
Block a user