Skip to content

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.

chore: show text options still

Richard Shiuef8f9c3404a25
diff --git a/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart b/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart
index 7751a3357e..9d42370ed4 100644
--- a/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart
+++ b/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart
@@ -46,14 +46,11 @@ class AIPromptInputBloc extends Bloc<AIPromptInputEvent, AIPromptInputState> {
supportChatWithFile = false;
}
- final showPredefinedFormats =
- aiType.isCloud && state.showPredefinedFormats;
emit(
state.copyWith(
aiType: aiType,
supportChatWithFile: supportChatWithFile,
localAIState: localAIState,
- showPredefinedFormats: showPredefinedFormats,
),
);
},
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.dart
index 5bb7eb1c0d..b52898880c 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
@@ -148,14 +148,13 @@ class _DesktopPromptInputState extends State<DesktopPromptInput> {
start: 8.0,
),
child: ChangeFormatBar(
+ showImageFormats: state.aiType.isCloud,
predefinedFormat: state.predefinedFormat,
spacing: 4.0,
onSelectPredefinedFormat: (format) =>
context.read<AIPromptInputBloc>().add(
AIPromptInputEvent
- .updatePredefinedFormat(
- format,
- ),
+ .updatePredefinedFormat(format),
),
),
),
@@ -578,34 +577,29 @@ class _PromptBottomActions extends StatelessWidget {
child: _sendButton(),
);
}
- return state.aiType.isLocal
- ? Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- if (state.supportChatWithFile) ...[
- _attachmentButton(context),
- const HSpace(
- DesktopAIChatSizes.inputActionBarButtonSpacing,
- ),
- ],
- _sendButton(),
- ],
- )
- : Row(
- children: [
- _predefinedFormatButton(),
- const Spacer(),
- _selectSourcesButton(context),
- const HSpace(
- DesktopAIChatSizes.inputActionBarButtonSpacing,
- ),
- // _mentionButton(context),
- // const HSpace(
- // DesktopAIPromptSizes.actionBarButtonSpacing,
- // ),
- _sendButton(),
- ],
- );
+ return Row(
+ children: [
+ _predefinedFormatButton(),
+ const Spacer(),
+ if (state.aiType.isCloud) ...[
+ _selectSourcesButton(context),
+ const HSpace(
+ DesktopAIChatSizes.inputActionBarButtonSpacing,
+ ),
+ ],
+ // _mentionButton(context),
+ // const HSpace(
+ // DesktopAIPromptSizes.actionBarButtonSpacing,
+ // ),
+ if (state.supportChatWithFile) ...[
+ _attachmentButton(context),
+ const HSpace(
+ DesktopAIChatSizes.inputActionBarButtonSpacing,
+ ),
+ ],
+ _sendButton(),
+ ],
+ );
},
),
);
diff --git a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/predefined_format_buttons.dart b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/predefined_format_buttons.dart
index 189882ae4d..253d6f70b7 100644
--- a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/predefined_format_buttons.dart
+++ b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/predefined_format_buttons.dart
@@ -48,25 +48,30 @@ class ChangeFormatBar extends StatelessWidget {
required this.predefinedFormat,
required this.spacing,
required this.onSelectPredefinedFormat,
+ this.showImageFormats = false,
});
final PredefinedFormat? predefinedFormat;
final double spacing;
final void Function(PredefinedFormat) onSelectPredefinedFormat;
+ final bool showImageFormats;
@override
Widget build(BuildContext context) {
+ final showTextFormats = predefinedFormat?.imageFormat.hasText ?? true;
return SizedBox(
height: DesktopAIPromptSizes.predefinedFormatButtonHeight,
child: SeparatedRow(
mainAxisSize: MainAxisSize.min,
separatorBuilder: () => HSpace(spacing),
children: [
- _buildFormatButton(context, ImageFormat.text),
- _buildFormatButton(context, ImageFormat.textAndImage),
- _buildFormatButton(context, ImageFormat.image),
- if (predefinedFormat?.imageFormat.hasText ?? true) ...[
- _buildDivider(),
+ if (showImageFormats) ...[
+ _buildFormatButton(context, ImageFormat.text),
+ _buildFormatButton(context, ImageFormat.textAndImage),
+ _buildFormatButton(context, ImageFormat.image),
+ ],
+ if (showImageFormats && showTextFormats) _buildDivider(),
+ if (showTextFormats) ...[
_buildTextFormatButton(context, TextFormat.paragraph),
_buildTextFormatButton(context, TextFormat.bulletList),
_buildTextFormatButton(context, TextFormat.numberedList),