You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(core): Separate AI provider classes
This commit introduces a significant architectural refactoring to improve the plugin's modularity, maintainability, and scalability. The provider-specific logic for Google Gemini and OpenAI has been extracted from the main plugin class into dedicated, self-contained classes.
This change follows the Single Responsibility Principle, making the codebase cleaner and easier to extend.
Key changes include:
- A new `includes/providers/` directory has been created to house all provider-related code.
- A `DiffyWeb_GenAI_Provider_Interface` has been introduced to enforce a consistent `generate()` method across all current and future providers.
- New provider classes, `DiffyWeb_GenAI_Gemini_Provider` and `DiffyWeb_GenAI_OpenAI_Provider`, now encapsulate all API communication logic for their respective services.
- A new `DiffyWeb_GenAI_Image_Helper` class has been created to handle the shared responsibility of uploading and setting the featured image, removing this logic from the provider classes.
- The main `DiffyWeb_GenAI_Tools` class now acts as a controller, instantiating the correct provider based on user selection and delegating the generation task.
- The plugin version has been bumped to 2.7.0 to reflect these structural improvements.