Browse Source

Refactor OpenAI class to use asynchronous room check for generating response.

- Replaced synchronous room check with asynchronous room check using `await`.
- Updated the code to use the `await` keyword before calling `self.room_uses_assistant(room)`.
- This change enables the code to generate assistant response asynchronously.
Kumi 1 year ago
parent
commit
c3fe074b1e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/gptbot/classes/openai.py

+ 1 - 1
src/gptbot/classes/openai.py

@@ -167,7 +167,7 @@ class OpenAI:
         """
         self.logger.log(f"Generating response to {len(messages)} messages using {self.chat_model}...")
 
-        if self.room_uses_assistant(room):
+        if await self.room_uses_assistant(room):
             return await self.generate_assistant_response(messages, room, user)
 
         chat_partial = partial(