Allow has_ai_credentials() filter fallback for non-API-key connectors#337
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #337 +/- ##
=============================================
- Coverage 57.85% 57.83% -0.02%
Complexity 615 615
=============================================
Files 46 46
Lines 3165 3166 +1
=============================================
Hits 1831 1831
- Misses 1334 1335 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What?
Closes #336
Adds a filter-based fallback to
has_ai_credentials()so third-party/local providers that do not use API keys can still mark credentials as configured.Why?
The current configured-state check only returns
truewhen anai_providerconnector usesauthentication.method = api_keyand the related setting is non-empty. Local/self-hosted connectors (for example connectors usingauthentication.method = none) can be fully usable but still fail this configured check, which triggers the settings notice and blocks expected behavior.How?
$connectors = wp_get_connectors().api_keylogic unchanged.apply_filters( 'wpai_has_ai_credentials', false, $connectors )Use of AI Tools
Drafting and implementation assistance was done with GitHub Copilot (GPT-5.3-Codex). All changes were reviewed and validated before submission.
Testing Instructions
ai_providerconnector that does not use API-key auth (for example auth methodnone).wpai_has_ai_credentialsreturningtruewhen that connector is present.\WordPress\AI\has_ai_credentials()returnstrue.falsewithout API-key credentials).Testing Instructions for Keyboard
Screenshots or screencast
N/A (no UI/layout changes; behavior-only change).
wpai_has_ai_credentialswith access to registered connectors.