feat: modal & ai actions#2860
Merged
Merged
Conversation
| @@ -0,0 +1,64 @@ | |||
| const stripTags = ( html ) => html.replace( /<[^>]+>/g, '' ).trim(); | |||
Contributor
Bundle Size Diff
|
Contributor
|
Plugin build for 35e74e3 is ready 🛎️!
|
Contributor
E2E TestsPlaywright Test Status: See serial and parallel matrix jobs Performance ResultsserverResponse: {"q25":463.8,"q50":487.4,"q75":500,"cnt":10}, firstPaint: {"q25":1353.8,"q50":1439.9,"q75":1703.9,"cnt":10}, domContentLoaded: {"q25":3815.9,"q50":3846.15,"q75":3877.6,"cnt":10}, loaded: {"q25":3817.7,"q50":3848,"q75":3879.2,"cnt":10}, firstContentfulPaint: {"q25":4333.8,"q50":4362.4,"q75":4395.9,"cnt":10}, firstBlock: {"q25":14839.6,"q50":14875.55,"q75":14963.4,"cnt":10}, type: {"q25":27.33,"q50":28.41,"q75":31.33,"cnt":10}, typeWithoutInspector: {"q25":24.62,"q50":25.38,"q75":28.51,"cnt":10}, typeWithTopToolbar: {"q25":37.19,"q50":39.56,"q75":40.47,"cnt":10}, typeContainer: {"q25":17.12,"q50":18.91,"q75":19.61,"cnt":10}, focus: {"q25":138.15,"q50":147.64,"q75":154.61,"cnt":10}, inserterOpen: {"q25":43.33,"q50":45.92,"q75":47.25,"cnt":10}, inserterSearch: {"q25":17.21,"q50":19.01,"q75":21.19,"cnt":10}, inserterHover: {"q25":5.63,"q50":5.86,"q75":6.34,"cnt":20}, loadPatterns: {"q25":1846.68,"q50":1888.34,"q75":1912.95,"cnt":10}, listViewOpen: {"q25":248.09,"q50":260.08,"q75":270.25,"cnt":10} |
d2fa71f to
d3b83d6
Compare
Resolve conflicts integrating the multi-backend AI work (WP AI Client /
Connectors) with the content-ai toolbar/modal refactor:
- AI settings stay in the dedicated AI dashboard tab; ported the
multi-backend "WordPress AI"/Connectors panel, provider-status notices,
and legacy OpenAI-key fallback into AI.js.
- Editor toolbar gate now uses isAIBackendConfigured().
- Adapt prompt response consumers (modal, content-generator, block
generation) to the normalized {ok, content, usedTokens} contract; drop
the deleted ChatResponse type.
- Merge e2e specs/config and keep both server-side AI and captcha HTTP
stubs; dashboard specs cover the multi-backend states on the AI tab.
- Guard rest_sanitize_boolean inputs in toolbar-action sanitization.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # packages/e2e-tests/mu-plugins/otter-e2e-bootstrap.php
The content-generator refactor stopped passing the `resultHistory` attribute into PromptPlaceholder, so the component's restore-last-prompt effect bailed out (`! props.resultHistory`) and the prompt field came up empty for blocks that carry history. Re-wire the prop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ve across reset
Two pre-existing e2e failures on this branch:
- The AI mocks returned HTML, but the new `generateBlocksFromTask`
pipeline JSON.parses the reply expecting `{ rationale, roots }`, so no
blocks were produced. Make both the legacy /chat/completions and the WP
AI Client /responses mocks emit phase-aware block-generation JSON.
- `reset()` deleted PRO_LICENSE_OPTION, which global-setup activates only
once for the whole run. ai-toolbar's reset() therefore deactivated Pro
for every later spec, failing the Pro-gated Form tests. Restore the stub
license in reset() instead of deleting it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the separate "Replace" and "Insert below" buttons in the AI content generator with one primary "Done" button that applies the generated blocks in place (the former Replace behavior). Drop the now-unused insert-below handler/import and update the e2e specs to the new label. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The content generator labelled every generation request as an "OpenAI request (gpt-5-mini)", but the backend is resolved server-side: on the WP AI Client connector path the model pin is dropped and the configured provider/model is used. Make the debug labels backend-agnostic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
f1d49d4 to
9c74c9e
Compare
…orm submit Add two instructions to the block-generation prompt: - system prompt: for design requests, produce a clean, well-structured, visually appealing layout. - structure prompt: when using a form block, don't add a separate submit button — the Otter Form already renders its own. Also document the missing @param tags on buildStructureCatalog, buildAttributeSchema and validateStructure, which were failing `npm run lint` (jsdoc/require-param). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the aiDebug step logger that was on by default during the beta: delete debug.ts, its call sites in the block-generation pipeline and the content generator, and the test mock that silenced it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The block-generation rewrite hardcoded the "content" placeholder and title, so inserting the block with promptID 'form' no longer showed "Start describing what form you need…". Restore a small preset lookup keyed by promptID (form vs textTransformation) while keeping the single Done action. Fixes the ai-block-wp-client form e2e test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The content generator rewrite routed every prompt through the block generation pipeline, so promptID 'form' stopped producing Form field blocks. Send the form prompt through the embedded-prompt path again (onPreview → parseFormPromptResponseToBlocks → Form block), keeping the new pipeline for content prompts. Fixes the ai-block-wp-client form e2e. Also poll for the inserted item in the accordion "add new item" e2e instead of snapshotting immediately after the click, which raced the async store update and flaked under parallel load. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
In the WP 7.0 iframe editor, a button rendered through InnerBlocks'
renderAppender prop does not fire its React onClick when clicked, so
"Add Accordion Item" did nothing (the e2e add-item test caught this).
Render the appender as block content with renderAppender={false},
matching the working Tabs block, so the click reaches the handler.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The toolbar filter only returned actions whose availability matched 'richtext' when every selected block was rich text, which dropped "Any block" actions from text. Allow 'any' actions everywhere and restrict 'richtext' actions to all-rich-text selections, which also fixes mixed selections showing no actions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Update the attribute-fill prompt to set tasteful, coherent colors when a block exposes color attributes, keeping text readable, so generated layouts look polished instead of bland. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Phase 1 now produces a plan (mission, design direction, and a section outline with per-section notes) instead of a bare slug tree. The mission, design direction and each section's notes are trickled into every per-root attribute call so the page builds toward one coherent vision. generateBlocksFromTask gains onPlanReady/onRootComplete callbacks; the AI block renders the plan (mission, palette, outline checklist) and inserts each section as it completes, with a staleness guard and undo-safe previews. Verbose design chips stay internal (prompt context only). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…into feat/content-ai
Route follow-up turns in create mode to the edit path (they were re-running generation and ignoring the instruction), and fix a ReferenceError that broke every text-only edit. Send the selection's block schema on edit, add meaningful error states with an inline Retry, cap the preview height with internal scroll, lock the prompt while generating with a red Stop, and switch accents to the WP admin color.
…gateway 502 pages Cap block-generation output tokens and enforce JSON mode from response_format so a whole-markup rewrite no longer truncates into unparseable JSON. Classify provider gateway/timeout failures into clean, retryable errors instead of passing raw nginx 502 HTML through as the message, and retry HTML error pages the client can't parse.
…-markup rewrite A style-only edit now sends just each block's className (the text-edit pattern, for classes) and splices the transformed classes back into a clone, so the response is bounded by class count rather than the full serialized tree. This keeps recolor/restyle off the oversized REWRITE path that truncated and timed out, and makes structural/text drift impossible. Falls back to the full style rewrite when nothing carries a className.
… overlays Generalize the style-edit splice from className to any block's style attributes (the style object, color/spacing/font attrs), so recolor/restyle stays off the whole-markup rewrite for classic and core blocks too (class-nodes -> style-nodes). Classify 'add an overlay / new layer' as a structural redesign rather than a style tweak, and teach the atomic-wind rewrite the overlay idiom (an empty, absolutely-positioned box with a translucent background). Also make 'Edit with AI' the topmost toolbar-menu action and tidy the editor.scss comments.
Feat/ai generation [tbd]
| const content = block.attributes?.content; | ||
|
|
||
| if ( 'string' === typeof tagName && HEADING_TAGS.has( tagName ) && 'string' === typeof content ) { | ||
| const text = content.replace( /<[^>]+>/g, '' ).trim(); |
7 tasks
|
@Soare-Robert-Daniel, The Go to AI Settings link under the Integration tab redirects to an invalid URL (https://retrievebag.s3-tastewp.com/wp-admin/undefined#ai).
Also, the AI Provider text is not showing in one line
|
The Integrations tab link built its URL from optionsPath, which is not localized on the dashboard page, producing wp-admin/undefined#ai. Switch tabs in place via setTab instead. Also opt SelectControl out of the flex row layout forced on base-control fields so its stacked label no longer wraps. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
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.


Closes #2124
Closes https://github.com/Codeinwp/otter-internals/issues/280
Closes https://github.com/Codeinwp/otter-internals/issues/281
Closes https://github.com/Codeinwp/otter-internals/issues/285
Ref https://github.com/Codeinwp/otter-internals/issues/282
Summary
Reworks a bunch of the AI functionality:
Screenshots
Test instructions:
Important
Custom Actions:
Editor AI integration:
Checklist before the final review