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: rename predefined format enum variant (#7359)

Richard Shiue04e3246976d4
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 fe3b07cc13..13db6a0669 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
@@ -69,7 +69,7 @@ class ChangeFormatBar extends StatelessWidget {
_buildFormatButton(context, ImageFormat.image),
if (predefinedFormat?.imageFormat.hasText ?? true) ...[
_buildDivider(),
- _buildTextFormatButton(context, TextFormat.auto),
+ _buildTextFormatButton(context, TextFormat.paragraph),
_buildTextFormatButton(context, TextFormat.bulletList),
_buildTextFormatButton(context, TextFormat.numberedList),
_buildTextFormatButton(context, TextFormat.table),
@@ -88,7 +88,8 @@ class ChangeFormatBar extends StatelessWidget {
return;
}
if (format.hasText) {
- final textFormat = predefinedFormat?.textFormat ?? TextFormat.auto;
+ final textFormat =
+ predefinedFormat?.textFormat ?? TextFormat.paragraph;
onSelectPredefinedFormat(
PredefinedFormat(imageFormat: format, textFormat: textFormat),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_entity.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_entity.dart
index fe2ed44193..7b16c597cd 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_entity.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_entity.dart
@@ -149,7 +149,7 @@ class PredefinedFormat extends Equatable {
const PredefinedFormat.auto()
: imageFormat = ImageFormat.text,
- textFormat = TextFormat.auto;
+ textFormat = TextFormat.paragraph;
final ImageFormat imageFormat;
final TextFormat? textFormat;
@@ -162,7 +162,7 @@ class PredefinedFormat extends Equatable {
ImageFormat.textAndImage => ResponseImageFormatPB.TextAndImage,
},
textFormat: switch (textFormat) {
- TextFormat.auto => ResponseTextFormatPB.Paragraph,
+ TextFormat.paragraph => ResponseTextFormatPB.Paragraph,
TextFormat.bulletList => ResponseTextFormatPB.BulletedList,
TextFormat.numberedList => ResponseTextFormatPB.NumberedList,
TextFormat.table => ResponseTextFormatPB.Table,
@@ -201,14 +201,14 @@ enum ImageFormat {
}
enum TextFormat {
- auto,
+ paragraph,
bulletList,
numberedList,
table;
FlowySvgData get icon {
return switch (this) {
- TextFormat.auto => FlowySvgs.ai_paragraph_s,
+ TextFormat.paragraph => FlowySvgs.ai_paragraph_s,
TextFormat.bulletList => FlowySvgs.ai_list_s,
TextFormat.numberedList => FlowySvgs.ai_number_list_s,
TextFormat.table => FlowySvgs.ai_table_s,
@@ -217,7 +217,7 @@ enum TextFormat {
String get i18n {
return switch (this) {
- TextFormat.auto => LocaleKeys.chat_changeFormat_text.tr(),
+ TextFormat.paragraph => LocaleKeys.chat_changeFormat_text.tr(),
TextFormat.bulletList => LocaleKeys.chat_changeFormat_bullet.tr(),
TextFormat.numberedList => LocaleKeys.chat_changeFormat_number.tr(),
TextFormat.table => LocaleKeys.chat_changeFormat_table.tr(),
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_change_format_bottom_sheet.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_change_format_bottom_sheet.dart
index 7edc5f7d5e..f68453df75 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_change_format_bottom_sheet.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_change_format_bottom_sheet.dart
@@ -122,7 +122,7 @@ class _Body extends StatelessWidget {
opacity: predefinedFormat?.imageFormat.hasText ?? true ? 1 : 0,
child: Column(
children: [
- _buildTextFormatButton(TextFormat.auto, true),
+ _buildTextFormatButton(TextFormat.paragraph, true),
_buildTextFormatButton(TextFormat.bulletList),
_buildTextFormatButton(TextFormat.numberedList),
_buildTextFormatButton(TextFormat.table),
@@ -153,7 +153,8 @@ class _Body extends StatelessWidget {
return;
}
if (format.hasText) {
- final textFormat = predefinedFormat?.textFormat ?? TextFormat.auto;
+ final textFormat =
+ predefinedFormat?.textFormat ?? TextFormat.paragraph;
onSelectPredefinedFormat(
PredefinedFormat(imageFormat: format, textFormat: textFormat),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart
index 1dbeeb0ec2..bb79a6b2d3 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart
@@ -377,8 +377,9 @@ class _ChangeFormatPopoverContentState
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
- widget.onRegenerate
- ?.call(predefinedFormat ?? const PredefinedFormat.auto());
+ if (predefinedFormat != null) {
+ widget.onRegenerate?.call(predefinedFormat!);
+ }
},
child: SizedBox.square(
dimension: DesktopAIPromptSizes.predefinedFormatButtonHeight,