Connectors: Add logo URL support for custom AI providers#76190
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. |
jorgefilipecosta
left a comment
There was a problem hiding this comment.
I'm not sure if adding a new static image in core is a simple process (lib/experimental/connectors/default-connector-logo.svg), it may have some complexities that we may prefer to avoid during beta, if that's the case I guess we could consider storing the svg in code like we do in many other places.
|
@jorgefilipecosta - overall the default logo placeholder was a good way to validate it all works until we have a way to set logos for AI providers. I'm happy to inline it unless @shaunandrews decides we don't want to shaw the fallback logo at all 😄 |
|
Size Change: 0 B Total Size: 6.89 MB ℹ️ View Unchanged
|
@felixarntz, I found WordPress/php-ai-client#210 where the description was added as an optional parameter for the AI provider in its metadata. Should we replicate that for the logo URL, too? |
|
Flaky tests detected in 5aaba79. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22889537829
|
felixarntz
left a comment
There was a problem hiding this comment.
@gziolo Thanks for this! I think for the PHP AI Client integration, this will need to work a bit differently.
Another question: do we want to use URLs? I wonder whether we could allow returning SVG markup? Maybe a bad idea, but thinking out loud 😆
Returning SVG markup inline has some additional considerations to take into account:
|
jorgefilipecosta
left a comment
There was a problem hiding this comment.
The changes look good, just left some minor comments.
I think we should avoid lib/experimental/connectors/default-connector-logo.svg and if we add a default logo it should be hardcoded as the logo for the 3 main providers to avoid the need to ship a new static file in core late in the beta cycle.
Other than that seems good to merge and worked well on the tests I did.
phpunit/experimental/connectors/resolve-ai-provider-logo-url-test.php
Outdated
Show resolved
Hide resolved
|
@jorgefilipecosta, I addressed all your feedback with caf93b0. @felixarntz, I would appreciate your feedback on the current implementation. |
felixarntz
left a comment
There was a problem hiding this comment.
@gziolo Thanks for the updates, LGTM!
|
We should soon have support for |
Passes a `logoUrl` from the server to the client for custom connectors registered via the WP AI Client registry. Built-in connectors (Google, OpenAI, Anthropic) continue to use their hardcoded inline SVG logos, while custom providers get a default placeholder or a logo URL from the registry's `getLogoUrl()` metadata method when available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback from Felix Arntz: the AI Client library is not WordPress-specific, so providers should return file paths via getLogoPath() instead of URLs via getLogoUrl(). The WordPress layer converts paths to URLs using plugins_url(), supporting both WP_PLUGIN_DIR and WPMU_PLUGIN_DIR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use hardcoded URL values instead of plugins_url() calls in test expectations to actually verify the function's output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove static default-connector-logo.svg file, use inline JSX instead - Add file_exists() check in _gutenberg_resolve_ai_provider_logo_url() - Document logo_url in _gutenberg_get_connector_settings() docblock - Use site_url() instead of hardcoded URLs in tests - Add test for non-existent file path returning null - Use try/finally for test cleanup safety Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the WordPress logo with connector badge SVG with a simpler plug icon on a light rounded-rect background. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
caf93b0 to
5aaba79
Compare
* Connectors: Add logo URL support for custom AI providers Passes a `logoUrl` from the server to the client for custom connectors registered via the WP AI Client registry. Built-in connectors (Google, OpenAI, Anthropic) continue to use their hardcoded inline SVG logos, while custom providers get a default placeholder or a logo URL from the registry's `getLogoUrl()` metadata method when available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Connectors: Use file path instead of URL for provider logos Address review feedback from Felix Arntz: the AI Client library is not WordPress-specific, so providers should return file paths via getLogoPath() instead of URLs via getLogoUrl(). The WordPress layer converts paths to URLs using plugins_url(), supporting both WP_PLUGIN_DIR and WPMU_PLUGIN_DIR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Tests: Hardcode expected URLs in connector logo URL tests Use hardcoded URL values instead of plugins_url() calls in test expectations to actually verify the function's output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Tests: Use localhost:8889 for hardcoded URLs in connector logo tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address review feedback for connector logo URL support - Remove static default-connector-logo.svg file, use inline JSX instead - Add file_exists() check in _gutenberg_resolve_ai_provider_logo_url() - Document logo_url in _gutenberg_get_connector_settings() docblock - Use site_url() instead of hardcoded URLs in tests - Add test for non-existent file path returning null - Use try/finally for test cleanup safety Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Connectors: Simplify default connector logo design Replace the WordPress logo with connector badge SVG with a simpler plug icon on a light rounded-rect background. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org> Co-authored-by: felixarntz <flixos90@git.wordpress.org> Co-authored-by: shaunandrews <shaunandrews@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 91e7ac7 |
This updates the pinned hash from the `gutenberg` from `9b8144036fa5faf75de43d4502ff9809fcf689ad` to `8c78d87453509661a9f28f978ba2c242d515563b`. The following changes are included: - Navigation Editor: Allow any blocks to be inserted by gating contentOnly insertion rules to section blocks (WordPress/gutenberg#76189) - Add `fetchpriority=low` to `IMG` tags in collapsed Details blocks (WordPress/gutenberg#76269) - Connectors: Add logo URL support for custom AI providers (WordPress/gutenberg#76190) - Cover Block: Add a playlist parameter to loop YouTube background videos. (WordPress/gutenberg#76004) - Connectors: Memoize getConnectors selector (WordPress/gutenberg#76339) - HTML Block: Fix broken layout (WordPress/gutenberg#76278) - Tests: Skip connector logo URL tests when AI Client is unavailable (WordPress/gutenberg#76343) - Navigation Overlay: Explicitly set fetchpriority for images (WordPress/gutenberg#76208) - Connectors: Show API key source for env vars and wp-config constants (WordPress/gutenberg#76355) - Connectors: Move API key validation and masking to REST dispatch level (WordPress/gutenberg#76327) - Connectors: Replace apiFetch with core-data store selectors (WordPress/gutenberg#76333) - Do not sync local attributes (WordPress/gutenberg#76267) - Add `fetchpriority=low` to `IMG` tags in collapsed Accordion Item blocks (WordPress/gutenberg#76336) - Implement disconnection debounce after initial connection (WordPress/gutenberg#76114) - Allow Post Content to be edited when 'Show template' is active and Post content is nested in a Template Part (WordPress/gutenberg#76305) - Fix: Document Bar: Back button flickers (WordPress/gutenberg#76320) - RTC: Move event hooks from editor to core-data (WordPress/gutenberg#76358) - fix(navigation): prevent right-justified submenu overflow in custom overlays (WordPress/gutenberg#76360) - Connectors: Add connectors registry for extensibility (WordPress/gutenberg#76364) - Connectors: Add empty state when no connectors are registered (WordPress/gutenberg#76375) - Temp: Disable RTC in the site editor (WordPress/gutenberg#76223) - Connectors: Add AI Experiments plugin callout with install/activate functionality (WordPress/gutenberg#76379) - Editor: Polish real-time collaboration presence UI and move Avatar to editor package (WordPress/gutenberg#75652) (WordPress/gutenberg#76365) - RTC: Add collaborator selection highlighting in rich text (WordPress/gutenberg#76107) - Sync changes from `wp_enqueue_global_styles()` to Gutenberg override (WordPress/gutenberg#76127) - [RTC] Fix performance regression on post save (WordPress/gutenberg#76370) - Media: Enable AVIF support for client-side uploads (WordPress/gutenberg#76371) - Connectors: Move plugin status computation to script module data (WordPress/gutenberg#76409) - Revisions: Skip rendered fields in REST API responses (WordPress/gutenberg#76347) - E2E Tests: Add connector setup flow tests with test AI provider (WordPress/gutenberg#76433) - RTC: Place sync connection modal in front of popover (WordPress/gutenberg#76431) - Connectors: Sync PHP code with WordPress Core (WordPress/gutenberg#76443) - Editor: Show own presence in collaborative editing sessions (WordPress/gutenberg#76413) (WordPress/gutenberg#76445) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/9b8144036fa5faf75de43d4502ff9809fcf689ad…8c78d87453509661a9f28f978ba2c242d515563b. Log created with: git log --reverse --format="- %s" 9b8144036fa5faf75de43d4502ff9809fcf689ad..8c78d87453509661a9f28f978ba2c242d515563b | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. git-svn-id: https://develop.svn.wordpress.org/trunk@61988 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `9b8144036fa5faf75de43d4502ff9809fcf689ad` to `8c78d87453509661a9f28f978ba2c242d515563b`. The following changes are included: - Navigation Editor: Allow any blocks to be inserted by gating contentOnly insertion rules to section blocks (WordPress/gutenberg#76189) - Add `fetchpriority=low` to `IMG` tags in collapsed Details blocks (WordPress/gutenberg#76269) - Connectors: Add logo URL support for custom AI providers (WordPress/gutenberg#76190) - Cover Block: Add a playlist parameter to loop YouTube background videos. (WordPress/gutenberg#76004) - Connectors: Memoize getConnectors selector (WordPress/gutenberg#76339) - HTML Block: Fix broken layout (WordPress/gutenberg#76278) - Tests: Skip connector logo URL tests when AI Client is unavailable (WordPress/gutenberg#76343) - Navigation Overlay: Explicitly set fetchpriority for images (WordPress/gutenberg#76208) - Connectors: Show API key source for env vars and wp-config constants (WordPress/gutenberg#76355) - Connectors: Move API key validation and masking to REST dispatch level (WordPress/gutenberg#76327) - Connectors: Replace apiFetch with core-data store selectors (WordPress/gutenberg#76333) - Do not sync local attributes (WordPress/gutenberg#76267) - Add `fetchpriority=low` to `IMG` tags in collapsed Accordion Item blocks (WordPress/gutenberg#76336) - Implement disconnection debounce after initial connection (WordPress/gutenberg#76114) - Allow Post Content to be edited when 'Show template' is active and Post content is nested in a Template Part (WordPress/gutenberg#76305) - Fix: Document Bar: Back button flickers (WordPress/gutenberg#76320) - RTC: Move event hooks from editor to core-data (WordPress/gutenberg#76358) - fix(navigation): prevent right-justified submenu overflow in custom overlays (WordPress/gutenberg#76360) - Connectors: Add connectors registry for extensibility (WordPress/gutenberg#76364) - Connectors: Add empty state when no connectors are registered (WordPress/gutenberg#76375) - Temp: Disable RTC in the site editor (WordPress/gutenberg#76223) - Connectors: Add AI Experiments plugin callout with install/activate functionality (WordPress/gutenberg#76379) - Editor: Polish real-time collaboration presence UI and move Avatar to editor package (WordPress/gutenberg#75652) (WordPress/gutenberg#76365) - RTC: Add collaborator selection highlighting in rich text (WordPress/gutenberg#76107) - Sync changes from `wp_enqueue_global_styles()` to Gutenberg override (WordPress/gutenberg#76127) - [RTC] Fix performance regression on post save (WordPress/gutenberg#76370) - Media: Enable AVIF support for client-side uploads (WordPress/gutenberg#76371) - Connectors: Move plugin status computation to script module data (WordPress/gutenberg#76409) - Revisions: Skip rendered fields in REST API responses (WordPress/gutenberg#76347) - E2E Tests: Add connector setup flow tests with test AI provider (WordPress/gutenberg#76433) - RTC: Place sync connection modal in front of popover (WordPress/gutenberg#76431) - Connectors: Sync PHP code with WordPress Core (WordPress/gutenberg#76443) - Editor: Show own presence in collaborative editing sessions (WordPress/gutenberg#76413) (WordPress/gutenberg#76445) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/9b8144036fa5faf75de43d4502ff9809fcf689ad…8c78d87453509661a9f28f978ba2c242d515563b. Log created with: git log --reverse --format="- %s" 9b8144036fa5faf75de43d4502ff9809fcf689ad..8c78d87453509661a9f28f978ba2c242d515563b | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. Built from https://develop.svn.wordpress.org/trunk@61988 git-svn-id: http://core.svn.wordpress.org/trunk@61270 1a063a9b-81f0-0310-95a4-ce76da25c4cd

Summary
logoUrlfield to the connector data passed from PHP to the client via script module datagetLogoPath()on their metadata class — the PHP layer converts file paths to URLs usingplugins_url()WP_PLUGIN_DIRandWPMU_PLUGIN_DIR, withfile_exists()validation and_doing_it_wrong()for unsupported pathsiconprop (ReactNode) instead of separateLogocomponent proplogoUrltakes precedence over hardcoded inline SVG logos; unknown connectors without a logo URL get a default placeholder (WordPress logo with connector badge, rendered as inline JSX)Follow-up work
The PHP AI SDK and WordPress Core need to add support for
getLogoPath()on the provider metadata class so that individual AI providers (e.g., Grok, Mistral) can supply their own logo file paths. Until then, custom providers will display the default placeholder logo.TODO
reviewimprove the default placeholder logo design, or decide on whether it should be included if it is missing.Testing with custom AI providers
To test with custom (non-built-in) AI providers, you can install community plugins:
After activating either plugin, navigate to the Connectors screen to see the custom provider with the default placeholder logo.
Test plan
getLogoPath()with a valid file in the plugins directory shows the custom logo via URLnull(no broken image)_doing_it_wrong()and returnsnull🤖 Generated with Claude Code