-
Notifications
You must be signed in to change notification settings - Fork 2k
Reimplement unified ai chat to use server side flag. #107601
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
base: trunk
Are you sure you want to change the base?
Conversation
Consumes `/me` endpoint for `unified_ai_chat` field for wpcom. Atomic/Garden will need other checks.
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Async-loaded Components (~213 bytes added 📈 [gzipped]) React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
Retrieve the unified experience flag using a hybrid approach: 1. Check `agentsManagerData.useUnifiedExperience` inline script first (available on wp-admin via Jetpack's Agents Manager) 2. Fall back to `/me?fields=unified_ai_chat` endpoint for Calypso app This is needed because Calypso app has access to the `/me` endpoint on wpcom, but wp-admin environments (Atomic, Garden, Simple sites) do not have access to wpcom APIs directly. The inline script provides the flag server-side for these environments. Changes: - Add `getUseUnifiedExperienceFromInlineData()` helper to agents-manager - Export helper from agents-manager package - Update `useUnifiedAiChat` hook to use hybrid approach
- Fetch unified_ai_chat from /me/preferences instead of /me endpoint - Read from calypso_preferences.unified_ai_chat in response
Part of DOTCOM-15279
Proposed Changes
Consumes
/me/preferencesendpoint forunified_ai_chatproperty for wpcom. Atomic/Garden relies on agentsManagerData inline JS that is generated byjetpack-mu-wpcomconsuming/me/preferencestoo.Why are these changes being made?
flags=unified-agentquery parameter for testing.Testing Instructions
This depends on the following PRs. Make sure you have them in place if they haven't been released yet (details below):
197669-ghe-Automattic/wpcomRELEASEDHook into new filter to allow toggling unified ai experience. jetpack#46237RELEASEDRequirements:
Follow the steps in 197669-ghe-Automattic/wpcomGo to https://wordpress.com/wp-admin/profile.php and enable the Unified Chat option (under Automattician Options).Make sure you have public-api.wordpress.com.Checkout 197669-ghe-Automattic/wpcom in your sandbox.RELEASEDIn your sandbox runRELEASEDbin/jetpack-downloader test jetpack-mu-wpcom-plugin add/agents-manager-unified-experience-toggle-logicto get Hook into new filter to allow toggling unified ai experience. jetpack#46237 code in place.Testing calypso:
yarn start.Testing simple site:
WPCOM_USERNAME={YOURUSERNAME} npm run build:wpcom. (Not needed if PR has been already merged and deployed)./wp-admin/in a sandboxed simple site.Testing atomic site:
help-centerapp in place:cd apps/help-centeryarn dev --sync.agents-manager(jetpack-mu-wpcom) in place:⚠️ You need to select the "Transfer to WP Cloud dev pool" checkbox. So you can point your Atomic to your sandbox for public-api.wordpress.com.197669-ghe-Automattic/wpcom RELEASEDhtdocs/wp-config.phpfile./wp-admin/admin.php?page=jetpack-beta&plugin=wpcomshand activate the feature branchadd/agents-manager-unified-experience-toggle-logic.big-sky-pluginupdated too (minor: to avoid duplicate experience)/wp-adminand basically everywhere around your atomic site.Testing garden site:
big-sky-pluginandagents-managerare using: 5210-gh-Automattic/big-sky-plugin and Hook into new filter to allow toggling unified ai experience. jetpack#46237yarn dev --sync)and 197669-ghe-Automattic/wpcomRELEASED –bothpublic-api.wordpress.comandwidgets.wp.com./wp-admin/and confirm it displays the unified chat experience./wp-admin/plugins.phpand confirm it displays the unified chat experience.Screenshots
Simple site (wp-admin)
Simple site (post editor)
WoA (wp-admin)
CIAB (wp-admin + next-admin)
No screenshots.
Pre-merge Checklist