Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
Convert message preprocessing to gather
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklamers committed Jan 5, 2024
1 parent 56b521f commit 13dd245
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/openassistants/openassistants/core/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,13 @@ async def convert_list_message(self, messages, message, idx):
)

async def pre_process_messages(self, messages):
for idx, message in enumerate(messages):
if isinstance(message, OpasUserMessage) and isinstance(
message.content, list
):
self.convert_list_message(messages, message, idx)
tasks = [
self.convert_list_message(messages, message, idx)
for idx, message in enumerate(messages)
if isinstance(message, OpasUserMessage)
and isinstance(message.content, list)
]
await asyncio.gather(*tasks)
return messages

async def run_chat(
Expand Down

0 comments on commit 13dd245

Please sign in to comment.