Skip to content

Commit 92fba08

Browse files
committed
fix: handle potential None values for user in model serialization
1 parent bb4ad68 commit 92fba08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/models_provider/serializers/model_serializer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def model_to_dict(model: Model):
113113
model.model_type, model.model_name
114114
).encryption_dict(credential),
115115
'workspace_id': model.workspace_id,
116-
'nick_name': model.user.nick_name,
117-
'username': model.user.username
116+
'nick_name': model.user.nick_name if model.user else '',
117+
'username': model.user.username if model.user else ''
118118
}
119119

120120
class Operate(serializers.Serializer):

0 commit comments

Comments
 (0)