feat: user can select open ai model per import#1134
Conversation
|
Plugin build for 0023fc1 is ready 🛎️!
Note You can preview the changes in the Playground |
eb0ce07 to
51f1f1e
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds the capability for users to select OpenAI models on a per-action basis in the importer, enhancing flexibility for AI-powered content rewriting operations.
- Extracts the AI rewrite action into a dedicated component for better maintainability
- Implements model selection dropdown for OpenAI actions with support for both active and deprecated models
- Updates backend to pass selected AI model information to the OpenAI API calls
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| js/ActionPopup/SortableItem.js | Refactors code formatting and extracts chat_gpt_rewrite action into RewriteActionItem component |
| js/ActionPopup/RewriteActionItem.js | New component handling AI rewrite actions with model selection functionality |
| includes/admin/feedzy-rss-feeds-admin.php | Adds OpenAI model data to frontend localization for dropdown population |
| includes/admin/feedzy-rss-feeds-actions.php | Updates backend to handle selected AI model in API calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| </p>{' '} | ||
| <ExternalLink href={upsellLink}> | ||
| {__( | ||
| 'Upgrade to Feedzy PRO', |
There was a problem hiding this comment.
The error message text 'Upgrade to Feedzy PRO' should be 'Upgrade Feedzy PRO Plan' to match the text used in the original SortableItem.js file for consistency.
| 'Upgrade to Feedzy PRO', | |
| 'Upgrade Feedzy PRO Plan', |
| propRef.onChangeHandler({ | ||
| index: loopIndex, | ||
| aiProvider: currentValue ?? '', | ||
| aiModel: '', |
There was a problem hiding this comment.
When changing the AI provider, the aiModel is being reset to an empty string. This could cause issues if the user has already selected a model for OpenAI and then switches providers. The model should only be reset when switching to a provider that doesn't support model selection.
| aiModel: '', | |
| aiModel: currentValue !== 'openai' ? '' : propRef.selectedAIModel, |
| $all_open_ai_models = apply_filters( 'feedzy_openai_models', array() ); | ||
| $deprecated_open_ai_models = apply_filters( 'feedzy_openai_deprecated_models', array() ); | ||
| $active_open_ai_models = array_values( array_diff( $all_open_ai_models, $deprecated_open_ai_models ) ); | ||
|
|
There was a problem hiding this comment.
There's trailing whitespace at the end of this line that should be removed.
51f1f1e to
ddc1388
Compare
|
🎉 This PR is included in version 5.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Added an option to select which OpenAI model to use per action in the importer.
Important
Test with https://github.com/Codeinwp/feedzy-rss-feeds-pro/pull/926
Will affect visual aspect of the product
YES
Screenshots
Closes https://github.com/Codeinwp/feedzy-rss-feeds-pro/issues/879