- 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.
This commit adds a new method `room_uses_assistant` to the OpenAI class. This method allows checking whether a given room uses an assistant. It uses the `room_settings` table in the database to determine if the specified room has the `openai_assistant` setting.
The commit modifies the image generation code in the OpenAI class. The size and model of the generated image can now be dynamically set based on the provided prompt. The code has been refactored to handle different image sizes and models correctly.
- Fixed bot command prefix recognition to include prefixes starting with an asterisk (= edited messages)
- Added handling of ignoring bot commands in the '_last_n_messages' method.
Previously, there was no option to specify the model for image generation in the OpenAI configuration. This commit adds a new option called "ImageModel" where you can specify the desired model. The default value for this option is "dall-e-2".
In the `GPTBot` class, the OpenAI object is now initialized with the `ImageModel` option if it is provided in the configuration. This allows the bot to use the specified image generation model in addition to the chat model.
Furthermore, in the `OpenAI` class, the `image_api` attribute has been renamed to `image_model` to reflect its purpose more accurately. The default value has also been updated to "dall-e-2" to align with the new configuration option.
This commit ensures that the OpenAI configuration is up-to-date and allows users to specify the desired image generation model.