fix: Fix limit for get_messages_by_ids (#2301)

This commit is contained in:
Matthew Zhou 2024-12-20 17:33:53 -08:00 committed by GitHub
parent b9b77fdc02
commit 2fc9b54f04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,7 @@ class MessageManager:
def get_messages_by_ids(self, message_ids: List[str], actor: PydanticUser) -> List[PydanticMessage]:
"""Fetch messages by ID and return them in the requested order."""
with self.session_maker() as session:
results = MessageModel.list(db_session=session, id=message_ids, organization_id=actor.organization_id)
results = MessageModel.list(db_session=session, id=message_ids, organization_id=actor.organization_id, limit=len(message_ids))
if len(results) != len(message_ids):
raise NoResultFound(