v1.0.2 open AI support
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:workouttest_util/service/api.dart';
|
||||
import 'package:workouttest_util/util/logging.dart';
|
||||
|
||||
|
||||
class OpenAIApi with Logging {
|
||||
final APIClient _client = APIClient();
|
||||
|
||||
Future<String> getOpenAICompletion(String question) async {
|
||||
String? response;
|
||||
try {
|
||||
final body = await _client.post("openai/completion", question);
|
||||
response = body;
|
||||
} on TimeoutException catch (_) {
|
||||
log("Timeout from OpenAI");
|
||||
} on Exception catch (e) {
|
||||
log(e.toString());
|
||||
}
|
||||
return response ?? "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user