feat: add cover migration for document (#1929)

* feat: add cover migration for document

* fix: should not delete the cover when selecting all

* fix: chinese characters for openai
This commit is contained in:
Lucas.Xu
2023-03-07 09:33:59 +08:00
committed by GitHub
parent 675c833f07
commit 7ff4cecd09
4 changed files with 81 additions and 35 deletions

View File

@ -91,7 +91,13 @@ class HttpOpenAIRepository implements OpenAIRepository {
);
if (response.statusCode == 200) {
return Right(TextCompletionResponse.fromJson(json.decode(response.body)));
return Right(
TextCompletionResponse.fromJson(
json.decode(
utf8.decode(response.bodyBytes),
),
),
);
} else {
return Left(OpenAIError.fromJson(json.decode(response.body)['error']));
}
@ -119,7 +125,13 @@ class HttpOpenAIRepository implements OpenAIRepository {
);
if (response.statusCode == 200) {
return Right(TextEditResponse.fromJson(json.decode(response.body)));
return Right(
TextEditResponse.fromJson(
json.decode(
utf8.decode(response.bodyBytes),
),
),
);
} else {
return Left(OpenAIError.fromJson(json.decode(response.body)['error']));
}