Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix comparison with callable (#23978)

Will821fe26b5641
diff --git a/api/services/conversation_service.py b/api/services/conversation_service.py
index d76981a23f1..4f3dd3c7626 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()