From f303ec14df49998bdec324a2ac919d51671d16b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=B8=83=E5=8A=B3=E5=A4=96=20=C2=B7=20=E8=B4=BE?= =?UTF-8?q?=E8=B4=B5?= <472285740@qq.com> Date: Wed, 6 Aug 2025 09:38:58 +0800 Subject: [PATCH] fix(core): generate image from text group (#13417) > CLOSE AF-2785 ## Summary by CodeRabbit * **New Features** * Streamlined AI action groups by consolidating image generation and text generation actions under a unified "generate from text" group. * Image processing and filtering actions are now organized into a distinct "touch up image" group for improved clarity in dynamic image options. * **Refactor** * Simplified and reorganized AI action groups for a more intuitive user experience. --- .../core/src/blocksuite/ai/_common/config.ts | 28 +++++----- .../ai/entries/edgeless/actions-config.ts | 56 ++++++++----------- 2 files changed, 37 insertions(+), 47 deletions(-) diff --git a/packages/frontend/core/src/blocksuite/ai/_common/config.ts b/packages/frontend/core/src/blocksuite/ai/_common/config.ts index 51f53c94e..b17593a2f 100644 --- a/packages/frontend/core/src/blocksuite/ai/_common/config.ts +++ b/packages/frontend/core/src/blocksuite/ai/_common/config.ts @@ -295,19 +295,6 @@ const ReviewTextAIGroup: AIItemGroupConfig = { ], }; -const TouchUpImageAIGroup: AIItemGroupConfig = { - name: 'touch up image', - items: [ - { - name: 'Generate an image', - testId: 'action-generate-image', - icon: ImageIcon(), - showWhen: textBlockShowWhen, - handler: actionToHandler('createImage', AIImageIconWithAnimation), - }, - ], -}; - const GenerateFromTextAIGroup: AIItemGroupConfig = { name: 'generate from text', items: [ @@ -347,6 +334,13 @@ const GenerateFromTextAIGroup: AIItemGroupConfig = { showWhen: textBlockShowWhen, handler: actionToHandler('writeOutline', AIPenIconWithAnimation), }, + { + name: 'Generate an image', + testId: 'action-generate-image', + icon: ImageIcon(), + showWhen: textBlockShowWhen, + handler: actionToHandler('createImage', AIImageIconWithAnimation), + }, { name: 'Brainstorm ideas with mind map', testId: 'action-brainstorm-mindmap', @@ -405,7 +399,6 @@ export const pageAIGroups: AIItemGroupConfig[] = [ ReviewCodeAIGroup, ReviewImageAIGroup, EditTextAIGroup, - TouchUpImageAIGroup, GenerateFromTextAIGroup, DraftFromTextAIGroup, OthersAIGroup, @@ -431,7 +424,7 @@ export function buildAIImageItemGroups(): AIItemGroupConfig[] { ], }, { - name: 'touch up image', + name: 'generate from text', items: [ { name: 'Generate an image', @@ -445,6 +438,11 @@ export function buildAIImageItemGroups(): AIItemGroupConfig[] { blockActionTrackerOptions ), }, + ], + }, + { + name: 'touch up image', + items: [ { name: 'Image processing', testId: 'action-image-processing', diff --git a/packages/frontend/core/src/blocksuite/ai/entries/edgeless/actions-config.ts b/packages/frontend/core/src/blocksuite/ai/entries/edgeless/actions-config.ts index d0bda2341..8c33071f8 100644 --- a/packages/frontend/core/src/blocksuite/ai/entries/edgeless/actions-config.ts +++ b/packages/frontend/core/src/blocksuite/ai/entries/edgeless/actions-config.ts @@ -281,9 +281,31 @@ const reviewTextGroup: AIItemGroupConfig = { ], }; -const touchUpImageGroup: AIItemGroupConfig = { - name: 'touch up image', +const generateFromTextGroup: AIItemGroupConfig = { + name: 'generate from text', items: [ + { + name: 'Summarize', + icon: PenIcon(), + testId: 'action-summarize', + showWhen: noteBlockOrTextShowWhen, + handler: actionToHandler('summary', AIPenIconWithAnimation), + }, + { + name: 'Generate headings', + icon: PenIcon(), + testId: 'action-generate-headings', + showWhen: noteBlockOrTextShowWhen, + handler: actionToHandler('createHeadings', AIPenIconWithAnimation), + beta: true, + }, + { + name: 'Generate outline', + icon: PenIcon(), + testId: 'action-generate-outline', + showWhen: noteBlockOrTextShowWhen, + handler: actionToHandler('writeOutline', AIPenIconWithAnimation), + }, { name: 'Generate an image', icon: ImageIcon(), @@ -359,35 +381,6 @@ const touchUpImageGroup: AIItemGroupConfig = { } ), }, - ], -}; - -const generateFromTextGroup: AIItemGroupConfig = { - name: 'generate from text', - items: [ - { - name: 'Summarize', - icon: PenIcon(), - testId: 'action-summarize', - showWhen: noteBlockOrTextShowWhen, - handler: actionToHandler('summary', AIPenIconWithAnimation), - }, - { - name: 'Generate headings', - icon: PenIcon(), - testId: 'action-generate-headings', - showWhen: noteBlockOrTextShowWhen, - handler: actionToHandler('createHeadings', AIPenIconWithAnimation), - beta: true, - }, - - { - name: 'Generate outline', - icon: PenIcon(), - testId: 'action-generate-outline', - showWhen: noteBlockOrTextShowWhen, - handler: actionToHandler('writeOutline', AIPenIconWithAnimation), - }, { name: 'Expand from this mind map node', icon: MindmapNodeIcon(), @@ -571,7 +564,6 @@ export const edgelessAIGroups: AIItemGroupConfig[] = [ reviewCodeGroup, reviewImageGroup, editTextGroup, - touchUpImageGroup, generateFromTextGroup, draftFromTextGroup, othersGroup,