mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: AI - improve writing (#2257)
* feat: AI - Improve writing * fix: new line in result * formatted code
This commit is contained in:
parent
9e3ad1a6be
commit
f9095cfc64
@ -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",
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user