mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-10 15:38:08 +00:00
chore: hide formats when using specific ai writer commands (#7648)
* chore: hide formats for specific ai writer features * chore: use black color for selected model name
This commit is contained in:
parent
c87d9ab74f
commit
a2303d35e8
@ -23,6 +23,7 @@ class DesktopPromptInput extends StatefulWidget {
|
|||||||
required this.selectedSourcesNotifier,
|
required this.selectedSourcesNotifier,
|
||||||
required this.onUpdateSelectedSources,
|
required this.onUpdateSelectedSources,
|
||||||
this.hideDecoration = false,
|
this.hideDecoration = false,
|
||||||
|
this.hideFormats = false,
|
||||||
this.extraBottomActionButton,
|
this.extraBottomActionButton,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ class DesktopPromptInput extends StatefulWidget {
|
|||||||
final ValueNotifier<List<String>> selectedSourcesNotifier;
|
final ValueNotifier<List<String>> selectedSourcesNotifier;
|
||||||
final void Function(List<String>) onUpdateSelectedSources;
|
final void Function(List<String>) onUpdateSelectedSources;
|
||||||
final bool hideDecoration;
|
final bool hideDecoration;
|
||||||
|
final bool hideFormats;
|
||||||
final Widget? extraBottomActionButton;
|
final Widget? extraBottomActionButton;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -139,11 +141,11 @@ class _DesktopPromptInputState extends State<DesktopPromptInput> {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: getTextFieldConstraints(
|
constraints: getTextFieldConstraints(
|
||||||
state.showPredefinedFormats,
|
state.showPredefinedFormats && !widget.hideFormats,
|
||||||
),
|
),
|
||||||
child: inputTextField(),
|
child: inputTextField(),
|
||||||
),
|
),
|
||||||
if (state.showPredefinedFormats)
|
if (state.showPredefinedFormats && !widget.hideFormats)
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
bottom: null,
|
bottom: null,
|
||||||
child: TextFieldTapRegion(
|
child: TextFieldTapRegion(
|
||||||
@ -168,8 +170,9 @@ class _DesktopPromptInputState extends State<DesktopPromptInput> {
|
|||||||
top: null,
|
top: null,
|
||||||
child: TextFieldTapRegion(
|
child: TextFieldTapRegion(
|
||||||
child: _PromptBottomActions(
|
child: _PromptBottomActions(
|
||||||
showPredefinedFormats:
|
showPredefinedFormatBar:
|
||||||
state.showPredefinedFormats,
|
state.showPredefinedFormats,
|
||||||
|
showPredefinedFormatButton: !widget.hideFormats,
|
||||||
onTogglePredefinedFormatSection: () =>
|
onTogglePredefinedFormatSection: () =>
|
||||||
context.read<AIPromptInputBloc>().add(
|
context.read<AIPromptInputBloc>().add(
|
||||||
AIPromptInputEvent
|
AIPromptInputEvent
|
||||||
@ -571,7 +574,8 @@ class PromptInputTextField extends StatelessWidget {
|
|||||||
class _PromptBottomActions extends StatelessWidget {
|
class _PromptBottomActions extends StatelessWidget {
|
||||||
const _PromptBottomActions({
|
const _PromptBottomActions({
|
||||||
required this.sendButtonState,
|
required this.sendButtonState,
|
||||||
required this.showPredefinedFormats,
|
required this.showPredefinedFormatBar,
|
||||||
|
required this.showPredefinedFormatButton,
|
||||||
required this.onTogglePredefinedFormatSection,
|
required this.onTogglePredefinedFormatSection,
|
||||||
required this.onStartMention,
|
required this.onStartMention,
|
||||||
required this.onSendPressed,
|
required this.onSendPressed,
|
||||||
@ -581,7 +585,8 @@ class _PromptBottomActions extends StatelessWidget {
|
|||||||
this.extraBottomActionButton,
|
this.extraBottomActionButton,
|
||||||
});
|
});
|
||||||
|
|
||||||
final bool showPredefinedFormats;
|
final bool showPredefinedFormatBar;
|
||||||
|
final bool showPredefinedFormatButton;
|
||||||
final void Function() onTogglePredefinedFormatSection;
|
final void Function() onTogglePredefinedFormatSection;
|
||||||
final void Function() onStartMention;
|
final void Function() onStartMention;
|
||||||
final SendButtonState sendButtonState;
|
final SendButtonState sendButtonState;
|
||||||
@ -600,10 +605,12 @@ class _PromptBottomActions extends StatelessWidget {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
_predefinedFormatButton(),
|
if (showPredefinedFormatButton) ...[
|
||||||
const HSpace(
|
_predefinedFormatButton(),
|
||||||
DesktopAIChatSizes.inputActionBarButtonSpacing,
|
const HSpace(
|
||||||
),
|
DesktopAIChatSizes.inputActionBarButtonSpacing,
|
||||||
|
),
|
||||||
|
],
|
||||||
SelectModelMenu(
|
SelectModelMenu(
|
||||||
aiModelStateNotifier:
|
aiModelStateNotifier:
|
||||||
context.read<AIPromptInputBloc>().aiModelStateNotifier,
|
context.read<AIPromptInputBloc>().aiModelStateNotifier,
|
||||||
@ -641,7 +648,7 @@ class _PromptBottomActions extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _predefinedFormatButton() {
|
Widget _predefinedFormatButton() {
|
||||||
return PromptInputDesktopToggleFormatButton(
|
return PromptInputDesktopToggleFormatButton(
|
||||||
showFormatBar: showPredefinedFormats,
|
showFormatBar: showPredefinedFormatBar,
|
||||||
onTap: onTogglePredefinedFormatSection,
|
onTap: onTogglePredefinedFormatSection,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,7 +173,6 @@ class _ModelItem extends StatelessWidget {
|
|||||||
model.i18n,
|
model.i18n,
|
||||||
figmaLineHeight: 20,
|
figmaLineHeight: 20,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
color: isSelected ? Theme.of(context).colorScheme.primary : null,
|
|
||||||
),
|
),
|
||||||
if (model.desc.isNotEmpty)
|
if (model.desc.isNotEmpty)
|
||||||
FlowyText(
|
FlowyText(
|
||||||
|
|||||||
@ -490,6 +490,12 @@ class MainContentArea extends StatelessWidget {
|
|||||||
return DesktopPromptInput(
|
return DesktopPromptInput(
|
||||||
isStreaming: false,
|
isStreaming: false,
|
||||||
hideDecoration: true,
|
hideDecoration: true,
|
||||||
|
hideFormats: [
|
||||||
|
AiWriterCommand.fixSpellingAndGrammar,
|
||||||
|
AiWriterCommand.improveWriting,
|
||||||
|
AiWriterCommand.makeLonger,
|
||||||
|
AiWriterCommand.makeShorter,
|
||||||
|
].contains(state.command),
|
||||||
textController: textController,
|
textController: textController,
|
||||||
onSubmitted: (message, format, _) {
|
onSubmitted: (message, format, _) {
|
||||||
cubit.runCommand(state.command, message, format);
|
cubit.runCommand(state.command, message, format);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user