mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: openai for summarize doesn't work when mutliple selecting (#1904)
This commit is contained in:
@ -37,7 +37,7 @@ abstract class OpenAIRepository {
|
|||||||
Future<Either<OpenAIError, TextCompletionResponse>> getCompletions({
|
Future<Either<OpenAIError, TextCompletionResponse>> getCompletions({
|
||||||
required String prompt,
|
required String prompt,
|
||||||
String? suffix,
|
String? suffix,
|
||||||
int maxTokens = 50,
|
int maxTokens = 500,
|
||||||
double temperature = .3,
|
double temperature = .3,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class HttpOpenAIRepository implements OpenAIRepository {
|
|||||||
Future<Either<OpenAIError, TextCompletionResponse>> getCompletions({
|
Future<Either<OpenAIError, TextCompletionResponse>> getCompletions({
|
||||||
required String prompt,
|
required String prompt,
|
||||||
String? suffix,
|
String? suffix,
|
||||||
int maxTokens = 50,
|
int maxTokens = 500,
|
||||||
double temperature = 0.3,
|
double temperature = 0.3,
|
||||||
}) async {
|
}) async {
|
||||||
final parameters = {
|
final parameters = {
|
||||||
@ -102,12 +102,14 @@ class HttpOpenAIRepository implements OpenAIRepository {
|
|||||||
required String input,
|
required String input,
|
||||||
required String instruction,
|
required String instruction,
|
||||||
double temperature = 0.3,
|
double temperature = 0.3,
|
||||||
|
int n = 1,
|
||||||
}) async {
|
}) async {
|
||||||
final parameters = {
|
final parameters = {
|
||||||
'model': 'text-davinci-edit-001',
|
'model': 'text-davinci-edit-001',
|
||||||
'input': input,
|
'input': input,
|
||||||
'instruction': instruction,
|
'instruction': instruction,
|
||||||
'temperature': temperature,
|
'temperature': temperature,
|
||||||
|
'n': n,
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await client.post(
|
final response = await client.post(
|
||||||
|
@ -10,9 +10,9 @@ enum SmartEditAction {
|
|||||||
String get toInstruction {
|
String get toInstruction {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case SmartEditAction.summarize:
|
case SmartEditAction.summarize:
|
||||||
return 'Summarize';
|
return 'Make it shorter';
|
||||||
case SmartEditAction.fixSpelling:
|
case SmartEditAction.fixSpelling:
|
||||||
return 'Fix the spelling mistakes';
|
return 'Fix all the spelling mistakes';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,7 @@ class _SmartEditInputState extends State<_SmartEditInput> {
|
|||||||
final edits = await openAIRepository.getEdits(
|
final edits = await openAIRepository.getEdits(
|
||||||
input: input,
|
input: input,
|
||||||
instruction: instruction,
|
instruction: instruction,
|
||||||
|
n: input.split('\n').length,
|
||||||
);
|
);
|
||||||
return edits.fold((error) async {
|
return edits.fold((error) async {
|
||||||
return dartz.Left(
|
return dartz.Left(
|
||||||
|
Reference in New Issue
Block a user