Skip to content

Version v2.7.0

Choose a tag to compare

@github-actions github-actions released this 06 Jul 22:17
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.