-
Notifications
You must be signed in to change notification settings - Fork 64
Move Providers from being tied to Features to being global #1038
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
Open
dkotter
wants to merge
56
commits into
develop
Choose a base branch
from
feature/global-providers
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
…undation) - ProviderProfiles: registry mapping provider IDs to vendor profiles and credential fields; supports grouped and ungrouped profiles. - ProviderConfigStore: persistence for global provider configs in classifai_provider_configs option. - CredentialResolver: resolves effective credentials, preferring feature-level overrides over global config.
…onfigs - ProviderProfiles, ProviderConfigStore, CredentialResolver: registry, storage, and resolution for global provider credentials (override-aware). - GET/POST /classifai/v1/provider-configs: list profiles and configs, update config per profile. Plain-string labels in ProviderProfiles to avoid static initializer errors. - Providers tab: fetch provider-configs, list profiles with Configured / Not configured / No configuration needed. Redux: providerProfiles, providerConfigs, actions, selectors. Route and styles for Providers.
…ices - Feature: merge CredentialResolver into get_settings; sanitize override. - CredentialResolver: explicit override (true=Feature, false=global); infer from non-empty creds when unset. - ClassifAISettings: fetch provider-configs on load. - ProviderSettings: notices to configure in Providers tab or use Feature-level creds. - utils: getProfileForProvider, hasFeatureLevelCredentials
- Delete CredentialReuse helper and credential-reuse/(feature_id), credential-reuse/copy REST routes. - Remove CredentialReuseModal and its usage from ServiceSettings and EnableToggleControl. - Remove credential-reuse SCSS and Cypress modal commands/tests.
- ProviderProfileForm with inputs per credential_fields, Save wired to POST /provider-configs - ProviderCredentialsVerifier for OpenAI and Ollama; set authenticated and verification_error - Status (Verified / Not configured) only when config.authenticated === true - ProviderSettings: links to Providers tab and isProviderConfigured with global configs
…entials or an individual credential and pass that through a filter so others can change credentials if desired. Minor modifications to our CredentialResolver to only return credentials, not all Feature-Provider settings. Remove unneeded code from the Feature class
…tance and we use that to get the API key, passing through our new credential filtering. Ensure we can pass settings to our credential filtering and use those if passed instead of using the saved credentials. Allows us to filter credentials when settings are being saved.
…up for other Providers to work
… the Feature ID to avoid extra code duplication
…ed at the Feature-level we default to overriding credentials
… embedding operations. Bring back Provider labels as these are still used on the settings screen. Fix a bug where AWS Polly fields weren't showing properly
…ntials aren't at the Feature level
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
…sticPress by default and we also disable the admin bar changes ElasticPress makes as it seems that causes issues
1 task
- Include providerProfiles and providerConfigs in inline script data,
eliminating a separate API call on initial page load
- Add user-facing error notice in ProvidersSettings when loading fails
- Add fallback API fetch only when profiles are empty (edge cases)
- Display informative message when no Provider profiles are available
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
Warning
Apologies in advance for the large size of this PR. I kept finding things that needed adding or adjusting to get everything working properly, though there are lots of minor changes here like file renaming or moving code around.
I don't think there's a clean way to break this into multiple PRs and have each of those be good testable chunks but code review could be handled on those smaller PRs and then actual testing could be done here if that is more desirable
At the moment, the workflow in ClassifAI is to go into a Feature, choose the Provider you want for that Feature and enter in any Provider credentials from within that Feature. There's nothing wrong with this approach but it does require you to enter your credentials again for each Feature that you want to use the same Provider for (which is likely the majority of use cases).
This has been a common request (to simplify how Providers are setup) and we've also gotten quite a few recent requests around making it easier to programmatically manage credentials (for instance, setting those up as constants in
wp-config.phpinstead of having to enter those in the UI and have those saved to your database).This PR attempts to address both of these by introducing the concept of global Providers, while still retaining the ability to override credentials at the Feature-level if desired (and to help maintain backwards-compat).
At a high-level, this is what has been done:
classifai_provider_credentials) making it easy for other to hook in and change those credentialsScreenshots
How to test the Change
This is a fairly global change and as such, testing multiple Feature / Provider combinations is the ideal. In addition, testing Features with overridden credentials and Features with global credentials is ideal.
Changelog Entry
Credits
Props @dkotter, @fabiankaegy
Checklist: