Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: hide formats when using specific ai writer commands (#7648)
Richard Shiuea2303d35e858
diff --git a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/desktop_prompt_text_field.dart b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/desktop_prompt_text_field.dartindex 97850f6a1c..a2676f2c15 100644--- a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/desktop_prompt_text_field.dart+++ b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/desktop_prompt_text_field.dart@@ -23,6 +23,7 @@ class DesktopPromptInput extends StatefulWidget {required this.selectedSourcesNotifier,required this.onUpdateSelectedSources,this.hideDecoration = false,+ this.hideFormats = false,this.extraBottomActionButton,});@@ -34,6 +35,7 @@ class DesktopPromptInput extends StatefulWidget {final ValueNotifier<List<String>> selectedSourcesNotifier;final void Function(List<String>) onUpdateSelectedSources;final bool hideDecoration;+ final bool hideFormats;final Widget? extraBottomActionButton;@override@@ -139,11 +141,11 @@ class _DesktopPromptInputState extends State<DesktopPromptInput> {children: [ConstrainedBox(constraints: getTextFieldConstraints(- state.showPredefinedFormats,+ state.showPredefinedFormats && !widget.hideFormats,),child: inputTextField(),),- if (state.showPredefinedFormats)+ if (state.showPredefinedFormats && !widget.hideFormats)Positioned.fill(bottom: null,child: TextFieldTapRegion(@@ -168,8 +170,9 @@ class _DesktopPromptInputState extends State<DesktopPromptInput> {top: null,child: TextFieldTapRegion(child: _PromptBottomActions(- showPredefinedFormats:+ showPredefinedFormatBar:state.showPredefinedFormats,+ showPredefinedFormatButton: !widget.hideFormats,onTogglePredefinedFormatSection: () =>context.read<AIPromptInputBloc>().add(AIPromptInputEvent@@ -571,7 +574,8 @@ class PromptInputTextField extends StatelessWidget {class _PromptBottomActions extends StatelessWidget {const _PromptBottomActions({required this.sendButtonState,- required this.showPredefinedFormats,+ required this.showPredefinedFormatBar,+ required this.showPredefinedFormatButton,required this.onTogglePredefinedFormatSection,required this.onStartMention,required this.onSendPressed,@@ -581,7 +585,8 @@ class _PromptBottomActions extends StatelessWidget {this.extraBottomActionButton,});- final bool showPredefinedFormats;+ final bool showPredefinedFormatBar;+ final bool showPredefinedFormatButton;final void Function() onTogglePredefinedFormatSection;final void Function() onStartMention;final SendButtonState sendButtonState;@@ -600,10 +605,12 @@ class _PromptBottomActions extends StatelessWidget {builder: (context, state) {return Row(children: [- _predefinedFormatButton(),- const HSpace(- DesktopAIChatSizes.inputActionBarButtonSpacing,- ),+ if (showPredefinedFormatButton) ...[+ _predefinedFormatButton(),+ const HSpace(+ DesktopAIChatSizes.inputActionBarButtonSpacing,+ ),+ ],SelectModelMenu(aiModelStateNotifier:context.read<AIPromptInputBloc>().aiModelStateNotifier,@@ -641,7 +648,7 @@ class _PromptBottomActions extends StatelessWidget {Widget _predefinedFormatButton() {return PromptInputDesktopToggleFormatButton(- showFormatBar: showPredefinedFormats,+ showFormatBar: showPredefinedFormatBar,onTap: onTogglePredefinedFormatSection,);}diff --git a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_model_menu.dart b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_model_menu.dartindex 64a62b902c..eef2663370 100644--- a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_model_menu.dart+++ b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_model_menu.dart@@ -173,7 +173,6 @@ class _ModelItem extends StatelessWidget {model.i18n,figmaLineHeight: 20,overflow: TextOverflow.ellipsis,- color: isSelected ? Theme.of(context).colorScheme.primary : null,),if (model.desc.isNotEmpty)FlowyText(diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dartindex bfd7c24fea..f78f7d35fd 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart@@ -490,6 +490,12 @@ class MainContentArea extends StatelessWidget {return DesktopPromptInput(isStreaming: false,hideDecoration: true,+ hideFormats: [+ AiWriterCommand.fixSpellingAndGrammar,+ AiWriterCommand.improveWriting,+ AiWriterCommand.makeLonger,+ AiWriterCommand.makeShorter,+ ].contains(state.command),textController: textController,onSubmitted: (message, format, _) {cubit.runCommand(state.command, message, format);