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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
feat: AI - improve writing (#2257)
alceilf9095cfc6438
diff --git a/frontend/appflowy_flutter/assets/translations/en.json b/frontend/appflowy_flutter/assets/translations/en.jsonindex ce5b2ef9e4..444d1e87af 100644--- a/frontend/appflowy_flutter/assets/translations/en.json+++ b/frontend/appflowy_flutter/assets/translations/en.json@@ -363,6 +363,7 @@"smartEditFixSpelling": "Fix spelling","warning": "⚠️ AI responses can be inaccurate or misleading.","smartEditSummarize": "Summarize",+ "smartEditImproveWriting":"Improve Writing","smartEditCouldNotFetchResult": "Could not fetch result from OpenAI","smartEditCouldNotFetchKey": "Could not fetch OpenAI key","smartEditDisabled": "Connect OpenAI in Settings",diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_action.dartindex 053aaaa739..2e4a05b87b 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_action.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_action.dart@@ -5,7 +5,8 @@ import 'package:easy_localization/easy_localization.dart';enum SmartEditAction {summarize,- fixSpelling;+ fixSpelling,+ improveWriting;String get toInstruction {switch (this) {@@ -13,6 +14,8 @@ enum SmartEditAction {return 'Tl;dr';case SmartEditAction.fixSpelling:return 'Correct this to standard English:';+ case SmartEditAction.improveWriting:+ return 'Rewrite this in your own words:';}}@@ -22,6 +25,8 @@ enum SmartEditAction {return '$input\n\nTl;dr';case SmartEditAction.fixSpelling:return 'Correct this to standard English:\n\n$input';+ case SmartEditAction.improveWriting:+ return 'Rewrite this:\n\n$input';}}@@ -31,6 +36,8 @@ enum SmartEditAction {return SmartEditAction.summarize;case 1:return SmartEditAction.fixSpelling;+ case 2:+ return SmartEditAction.improveWriting;}return SmartEditAction.fixSpelling;}@@ -41,6 +48,8 @@ enum SmartEditAction {return LocaleKeys.document_plugins_smartEditSummarize.tr();case SmartEditAction.fixSpelling:return LocaleKeys.document_plugins_smartEditFixSpelling.tr();+ case SmartEditAction.improveWriting:+ return LocaleKeys.document_plugins_smartEditImproveWriting.tr();}}}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_node_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_node_widget.dartindex 151ccc60d2..2c157f6ddc 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_node_widget.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_node_widget.dart@@ -356,7 +356,9 @@ class _SmartEditInputState extends State<_SmartEditInput> {},onProcess: (response) async {setState(() {- this.result += response.choices.first.text;+ if (response.choices.first.text != '\n') {+ this.result += response.choices.first.text;+ }});},onEnd: () async {