Skip to content

Commit 25f5f61

Browse files
committed
Merge branch 'main' into feat/notification
2 parents 944e064 + 07a78b4 commit 25f5f61

5 files changed

Lines changed: 40 additions & 19 deletions

File tree

frontend/appflowy_flutter/lib/ai/service/ai_model_state_notifier.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,13 @@ class AIModelStateNotifier {
170170
);
171171
}
172172
}
173+
174+
extension AiModelExtension on AIModelPB {
175+
bool get isDefault {
176+
return name == "Default";
177+
}
178+
179+
String get i18n {
180+
return isDefault ? LocaleKeys.chat_switchModel_autoModel.tr() : name;
181+
}
182+
}

frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_model_menu.dart

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class _SelectModelMenuState extends State<SelectModelMenu> {
5555
);
5656
},
5757
child: _CurrentModelButton(
58-
modelName: state.selectedModel!.name,
58+
model: state.selectedModel!,
5959
onTap: () => popoverController.show(),
6060
),
6161
);
@@ -166,7 +166,10 @@ class _ModelItem extends StatelessWidget {
166166
child: FlowyButton(
167167
onTap: onTap,
168168
margin: EdgeInsets.symmetric(horizontal: 8.0, vertical: 6.0),
169-
text: FlowyText(model.name),
169+
text: FlowyText(
170+
model.i18n,
171+
overflow: TextOverflow.ellipsis,
172+
),
170173
rightIcon: isSelected ? FlowySvg(FlowySvgs.check_s) : null,
171174
),
172175
);
@@ -175,11 +178,11 @@ class _ModelItem extends StatelessWidget {
175178

176179
class _CurrentModelButton extends StatelessWidget {
177180
const _CurrentModelButton({
178-
required this.modelName,
181+
required this.model,
179182
required this.onTap,
180183
});
181184

182-
final String modelName;
185+
final AIModelPB model;
183186
final VoidCallback onTap;
184187

185188
@override
@@ -199,13 +202,26 @@ class _CurrentModelButton extends StatelessWidget {
199202
padding: const EdgeInsetsDirectional.all(4.0),
200203
child: Row(
201204
children: [
202-
FlowyText(
203-
modelName,
204-
fontSize: 12,
205-
figmaLineHeight: 16,
206-
color: Theme.of(context).hintColor,
205+
Padding(
206+
// TODO: remove this after change icon to 20px
207+
padding: EdgeInsets.all(2),
208+
child: FlowySvg(
209+
FlowySvgs.ai_sparks_s,
210+
color: Theme.of(context).hintColor,
211+
size: Size.square(16),
212+
),
207213
),
208-
HSpace(2.0),
214+
if (!model.isDefault)
215+
Padding(
216+
padding: EdgeInsetsDirectional.only(end: 2.0),
217+
child: FlowyText(
218+
model.i18n,
219+
fontSize: 12,
220+
figmaLineHeight: 16,
221+
color: Theme.of(context).hintColor,
222+
overflow: TextOverflow.ellipsis,
223+
),
224+
),
209225
FlowySvg(
210226
FlowySvgs.ai_source_drop_down_s,
211227
color: Theme.of(context).hintColor,

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_prompt_input_more_button.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ class AiWriterPromptMoreButton extends StatelessWidget {
4242
child: Row(
4343
mainAxisSize: MainAxisSize.min,
4444
children: [
45-
FlowySvg(
46-
FlowySvgs.ai_sparks_s,
47-
color: isEnabled
48-
? Theme.of(context).hintColor
49-
: Theme.of(context).disabledColor,
50-
),
51-
const HSpace(2.0),
5245
FlowyText(
5346
LocaleKeys.ai_more.tr(),
5447
fontSize: 12,

frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:appflowy/ai/ai.dart';
12
import 'package:appflowy_backend/protobuf/flowy-ai/entities.pb.dart';
23
import 'package:flutter/material.dart';
34

@@ -44,7 +45,7 @@ class AIModelSelection extends StatelessWidget {
4445
(model) => buildDropdownMenuEntry<AIModelPB>(
4546
context,
4647
value: model,
47-
label: model.name,
48+
label: model.i18n,
4849
),
4950
)
5051
.toList(),

frontend/resources/translations/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@
255255
"switchModel": {
256256
"label": "Switch model",
257257
"localModel": "Local Model",
258-
"cloudModel": "Cloud Model"
258+
"cloudModel": "Cloud Model",
259+
"autoModel": "Auto"
259260
},
260261
"selectBanner": {
261262
"saveButton": "Add to …",

0 commit comments

Comments
 (0)