-
Notifications
You must be signed in to change notification settings - Fork 53
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
Feature-first refactor #611
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sidsector9
force-pushed
the
classifai-non-react
branch
from
November 6, 2023 18:29
c40de69
to
97c2961
Compare
Sidsector9
changed the title
upkeep: Feature-first refactor of admin screen
[WIP]: upkeep: Feature-first refactor of admin screen
Nov 6, 2023
…ixed; some were failures due to DOM changes
[WIP]: Updated E2E tests for feature-first refactor
1 task
…classifai-non-react
…classifai-non-react
…hat need fixed upstream. Update all GitHub Action dependencies
dkotter
changed the title
upkeep: Feature-first refactor of admin screen
Feature-first refactor
Jan 31, 2024
dkotter
approved these changes
Jan 31, 2024
This was referenced Jan 31, 2024
12 tasks
This was referenced Feb 5, 2024
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
Closes #
Before reading further, it would be good to have this branch opened in the code-editor for reference.
For clarity, the
TitleGeneration.php
andExcerptGeneration.php
class can be referred.The classes and methods are internally documented which can be handy.
Add new feature
Internal developers
All the features live inside the
includes/Classifai/Features
directory and every feature extends from the Feature class.3rd party developers
wp_options data
Each Feature class must define a
const ID
that is a unique identifier for the feature.With the feature-first approach, every feature stores its data in a separate row in the
wp_options
table.For example, the ID for Title and Excerpt generation are
feature_title_generation
andfeature_excerpt_generation
, so the corresponding data in the options table will have keysclassifai_feature_title_generation
andclassifai_feature_excerpt_generation
.Feature setting data format:
All the root level keys (except
openai_chatgpt
) are feature-level settings, and all the data against theopenai_chatgpt
key are the provider-level settings.A Provider class has access to all the settings of a feature as the provider is tied to the feature via its constructor.
Important areas to understand:
public function setup_fields_sections()
in themethod in the
TitleGeneration.phpand
ChatGPT.php` files.public function sanitize_settings( $settings )
method in theTitleGeneration.php
file.LanguageProcessing.php
to accommodate the feature-first approach.Checklist
SavePostHandler.php
to respective Provider classes. (see the migration of thesynthesize_speech
from theSavePostHandler.php
file toSpeech.php
file. Similar changes have to be done for other features that run when a post is published/updated.Changelog Entry
Credits
Props @dkotter @Sidsector9
Checklist: