From 821fe26b5641e31d074cb39efc98bfecd227a4fa Mon Sep 17 00:00:00 2001 From: Will Date: Fri, 15 Aug 2025 15:03:00 +0800 Subject: [PATCH] fix comparison with callable (#23978) --- api/services/conversation_service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/services/conversation_service.py b/api/services/conversation_service.py index d76981a23..4f3dd3c76 100644 --- a/api/services/conversation_service.py +++ b/api/services/conversation_service.py @@ -103,10 +103,10 @@ class ConversationService: @classmethod def _build_filter_condition(cls, sort_field: str, sort_direction: Callable, reference_conversation: Conversation): field_value = getattr(reference_conversation, sort_field) - if sort_direction == desc: + if sort_direction is desc: return getattr(Conversation, sort_field) < field_value - else: - return getattr(Conversation, sort_field) > field_value + + return getattr(Conversation, sort_field) > field_value @classmethod def rename( @@ -147,7 +147,7 @@ class ConversationService: app_model.tenant_id, message.query, conversation.id, app_model.id ) conversation.name = name - except: + except Exception: pass db.session.commit()