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
fix: openai for summarize doesn't work when mutliple selecting (#1904)
Lucas.Xua1a56758750f
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/service/openai_client.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/service/openai_client.dartindex f8b3b050fb..3bd41e2d52 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/service/openai_client.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/service/openai_client.dart@@ -37,7 +37,7 @@ abstract class OpenAIRepository {Future<Either<OpenAIError, TextCompletionResponse>> getCompletions({required String prompt,String? suffix,- int maxTokens = 50,+ int maxTokens = 500,double temperature = .3,});@@ -72,7 +72,7 @@ class HttpOpenAIRepository implements OpenAIRepository {Future<Either<OpenAIError, TextCompletionResponse>> getCompletions({required String prompt,String? suffix,- int maxTokens = 50,+ int maxTokens = 500,double temperature = 0.3,}) async {final parameters = {@@ -102,12 +102,14 @@ class HttpOpenAIRepository implements OpenAIRepository {required String input,required String instruction,double temperature = 0.3,+ int n = 1,}) async {final parameters = {'model': 'text-davinci-edit-001','input': input,'instruction': instruction,'temperature': temperature,+ 'n': n,};final response = await client.post(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 a7c2ef2626..5ceb4d7ea6 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@@ -10,9 +10,9 @@ enum SmartEditAction {String get toInstruction {switch (this) {case SmartEditAction.summarize:- return 'Summarize';+ return 'Make it shorter';case SmartEditAction.fixSpelling:- return 'Fix the spelling mistakes';+ return 'Fix all the spelling mistakes';}}}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 2ce7267a7e..d98595e0da 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@@ -254,6 +254,7 @@ class _SmartEditInputState extends State<_SmartEditInput> {final edits = await openAIRepository.getEdits(input: input,instruction: instruction,+ n: input.split('\n').length,);return edits.fold((error) async {return dartz.Left(