-
Notifications
You must be signed in to change notification settings - Fork 34
OpenAI Image Generation Support #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e environment variable for API key
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…Generator to use environment variable for host configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces comprehensive support for OpenAI's DALL-E image generation alongside the existing SwarmUI provider, refactoring the image generation system to support multiple providers and updating documentation with new features and configuration options.
Key Changes:
- Adds OpenAI DALL-E image generation support with dedicated environment variables
- Refactors image generation system from static instance to dynamic factory pattern
- Updates configuration management and documentation with new provider options
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| chatbot/test_image_generators.py | New test script for validating both SwarmUI and OpenAI image generators |
| chatbot/app/image/swarmui_generator.py | New dedicated SwarmUI image generator implementation with base class inheritance |
| chatbot/app/image/openai_generator.py | New OpenAI DALL-E image generator with API validation and model-specific constraints |
| chatbot/app/image/base.py | New abstract base class defining the image generator interface |
| chatbot/app/image/init.py | Refactored from monolithic class to factory pattern with provider selection |
| chatbot/app/core/config.py | Added OpenAI image generation environment variables and version bump |
| chatbot/app/api/routes.py | Updated routes to use dynamic image generator creation and handle multiple formats |
| chatbot/RELEASE.md | New release documentation with version history |
| chatbot/README.md | Updated with quick start guide and image generation configuration |
| chatbot/IMAGE_CONFIG.md | New comprehensive image generation configuration guide |
Comments suppressed due to low confidence (2)
chatbot/test_image_generators.py:50
- The test is using OPENAI_API_KEY but should use OPENAI_IMAGE_API_KEY to match the documented dedicated environment variable for image generation.
api_key=os.environ.get("OPENAI_API_KEY", "fake-key-for-testing"), # Use env var or clearly fake key
chatbot/test_image_generators.py:78
- Inconsistent environment variable usage. Should use OPENAI_IMAGE_API_KEY instead of OPENAI_API_KEY to match the dedicated image generation configuration.
api_key=os.environ.get("OPENAI_API_KEY", "sk-test-fake-key"), # Use env var or obviously fake key
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces support for OpenAI's DALL-E image generation alongside the existing SwarmUI provider, updates the documentation accordingly, and refactors the image generation logic to dynamically select the provider based on configuration. Key changes include new environment variables for OpenAI settings, updates to documentation and examples, and enhancements to the image generation codebase.
New Features and Enhancements:
OpenAI Image Generation Support:
OPENAI_IMAGE_API_KEY,OPENAI_IMAGE_MODEL, etc.). [1] [2]IMAGE_PROVIDERsetting.Documentation Updates:
README.mdwith quick start instructions, environment variables, and a new section on image generation. [1] [2] [3]IMAGE_CONFIG.md.RELEASE.mdto include release notes for recent versions, highlighting new features and fixes.Codebase Refactoring:
ImageGeneratorinstance with a dynamiccreate_image_generatorfunction to support multiple providers.These changes improve flexibility by enabling users to choose between local (SwarmUI) and cloud-based (OpenAI) image generation, while ensuring clear documentation and robust configuration options.