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: adjust default model name (#7634)

Richard Shiue07a78b4ad75e
diff --git a/frontend/appflowy_flutter/lib/ai/service/ai_model_state_notifier.dart b/frontend/appflowy_flutter/lib/ai/service/ai_model_state_notifier.dart
index c43bd01c6f..c65913cf19 100644
--- a/frontend/appflowy_flutter/lib/ai/service/ai_model_state_notifier.dart
+++ b/frontend/appflowy_flutter/lib/ai/service/ai_model_state_notifier.dart
@@ -170,3 +170,13 @@ class AIModelStateNotifier {
);
}
}
+
+extension AiModelExtension on AIModelPB {
+ bool get isDefault {
+ return name == "Default";
+ }
+
+ String get i18n {
+ return isDefault ? LocaleKeys.chat_switchModel_autoModel.tr() : name;
+ }
+}
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.dart
index b9e3daada9..1860bd7d63 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
@@ -55,7 +55,7 @@ class _SelectModelMenuState extends State<SelectModelMenu> {
);
},
child: _CurrentModelButton(
- modelName: state.selectedModel!.name,
+ model: state.selectedModel!,
onTap: () => popoverController.show(),
),
);
@@ -166,7 +166,10 @@ class _ModelItem extends StatelessWidget {
child: FlowyButton(
onTap: onTap,
margin: EdgeInsets.symmetric(horizontal: 8.0, vertical: 6.0),
- text: FlowyText(model.name),
+ text: FlowyText(
+ model.i18n,
+ overflow: TextOverflow.ellipsis,
+ ),
rightIcon: isSelected ? FlowySvg(FlowySvgs.check_s) : null,
),
);
@@ -175,11 +178,11 @@ class _ModelItem extends StatelessWidget {
class _CurrentModelButton extends StatelessWidget {
const _CurrentModelButton({
- required this.modelName,
+ required this.model,
required this.onTap,
});
- final String modelName;
+ final AIModelPB model;
final VoidCallback onTap;
@override
@@ -199,13 +202,26 @@ class _CurrentModelButton extends StatelessWidget {
padding: const EdgeInsetsDirectional.all(4.0),
child: Row(
children: [
- FlowyText(
- modelName,
- fontSize: 12,
- figmaLineHeight: 16,
- color: Theme.of(context).hintColor,
+ Padding(
+ // TODO: remove this after change icon to 20px
+ padding: EdgeInsets.all(2),
+ child: FlowySvg(
+ FlowySvgs.ai_sparks_s,
+ color: Theme.of(context).hintColor,
+ size: Size.square(16),
+ ),
),
- HSpace(2.0),
+ if (!model.isDefault)
+ Padding(
+ padding: EdgeInsetsDirectional.only(end: 2.0),
+ child: FlowyText(
+ model.i18n,
+ fontSize: 12,
+ figmaLineHeight: 16,
+ color: Theme.of(context).hintColor,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
FlowySvg(
FlowySvgs.ai_source_drop_down_s,
color: Theme.of(context).hintColor,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_prompt_input_more_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_prompt_input_more_button.dart
index 1bd80d081d..75c6589326 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_prompt_input_more_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_prompt_input_more_button.dart
@@ -42,13 +42,6 @@ class AiWriterPromptMoreButton extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
- FlowySvg(
- FlowySvgs.ai_sparks_s,
- color: isEnabled
- ? Theme.of(context).hintColor
- : Theme.of(context).disabledColor,
- ),
- const HSpace(2.0),
FlowyText(
LocaleKeys.ai_more.tr(),
fontSize: 12,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart
index bec4013a36..3df5ad3987 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart
@@ -1,3 +1,4 @@
+import 'package:appflowy/ai/ai.dart';
import 'package:appflowy_backend/protobuf/flowy-ai/entities.pb.dart';
import 'package:flutter/material.dart';
@@ -44,7 +45,7 @@ class AIModelSelection extends StatelessWidget {
(model) => buildDropdownMenuEntry<AIModelPB>(
context,
value: model,
- label: model.name,
+ label: model.i18n,
),
)
.toList(),
diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json
index 24f734af5d..429f1ea8c3 100644
--- a/frontend/resources/translations/en.json
+++ b/frontend/resources/translations/en.json
@@ -255,7 +255,8 @@
"switchModel": {
"label": "Switch model",
"localModel": "Local Model",
- "cloudModel": "Cloud Model"
+ "cloudModel": "Cloud Model",
+ "autoModel": "Auto"
},
"selectBanner": {
"saveButton": "Add to …",