mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
Compatible with the situation where there is no user information. (#1792)
Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
parent
10fc44e2af
commit
185c2f86cd
|
@ -31,8 +31,9 @@ annotation_fields = {
|
||||||
}
|
}
|
||||||
|
|
||||||
annotation_hit_history_fields = {
|
annotation_hit_history_fields = {
|
||||||
'annotation_id': fields.String,
|
'annotation_id': fields.String(attribute='id'),
|
||||||
'annotation_create_account': fields.Nested(account_fields, allow_null=True)
|
'annotation_create_account': fields.Nested(account_fields, allow_null=True),
|
||||||
|
'created_at': TimestampField
|
||||||
}
|
}
|
||||||
|
|
||||||
message_file_fields = {
|
message_file_fields = {
|
||||||
|
|
|
@ -531,7 +531,11 @@ class Message(db.Model):
|
||||||
def annotation_hit_history(self):
|
def annotation_hit_history(self):
|
||||||
annotation_history = (db.session.query(AppAnnotationHitHistory)
|
annotation_history = (db.session.query(AppAnnotationHitHistory)
|
||||||
.filter(AppAnnotationHitHistory.message_id == self.id).first())
|
.filter(AppAnnotationHitHistory.message_id == self.id).first())
|
||||||
return annotation_history
|
if annotation_history:
|
||||||
|
annotation = (db.session.query(MessageAnnotation).
|
||||||
|
filter(MessageAnnotation.id == annotation_history.annotation_id).first())
|
||||||
|
return annotation
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def app_model_config(self):
|
def app_model_config(self):
|
||||||
|
@ -659,6 +663,11 @@ class MessageAnnotation(db.Model):
|
||||||
account = db.session.query(Account).filter(Account.id == self.account_id).first()
|
account = db.session.query(Account).filter(Account.id == self.account_id).first()
|
||||||
return account
|
return account
|
||||||
|
|
||||||
|
@property
|
||||||
|
def annotation_create_account(self):
|
||||||
|
account = db.session.query(Account).filter(Account.id == self.account_id).first()
|
||||||
|
return account
|
||||||
|
|
||||||
|
|
||||||
class AppAnnotationHitHistory(db.Model):
|
class AppAnnotationHitHistory(db.Model):
|
||||||
__tablename__ = 'app_annotation_hit_histories'
|
__tablename__ = 'app_annotation_hit_histories'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user