Skip to content

Commit

Permalink
update flutter version
Browse files Browse the repository at this point in the history
  • Loading branch information
redevrx committed Dec 19, 2023
1 parent fc8fc13 commit de9f0f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions example_app/openai_app/lib/bloc/openai/openai_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:chat_gpt_sdk/chat_gpt_sdk.dart';
Expand Down Expand Up @@ -76,7 +75,8 @@ class OpenAIBloc extends Cubit<OpenAIState> {
void initOpenAISdk() async {
_openAI = OpenAI.instance.build(
token: getToken(),
apiUrl: 'https://api.openai.com/v1/', // you can replace with your api url
apiUrl:
'https://api.openai.com/v1/', // you can replace with your api url
enableLog: true,
baseOption: HttpSetup(
receiveTimeout: const Duration(seconds: 30),
Expand Down Expand Up @@ -136,8 +136,10 @@ class OpenAIBloc extends Cubit<OpenAIState> {
}
return false;
});

///+= message
String msg = '${message?.message ?? ""}${it.choices.last.message?.content ?? ""}';
String msg =
'${message?.message ?? ""}${it.choices.last.message?.content ?? ""}';
list.add(Message(isBot: true, id: '${it.id}', message: msg));
emit(ChatCompletionState(
isBot: true, messages: list, showStopButton: true));
Expand Down
3 changes: 2 additions & 1 deletion lib/src/client/openai_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import 'package:chat_gpt_sdk/src/model/error/openai_error.dart';
import 'package:dio/dio.dart';

class OpenAIClient extends OpenAIWrapper {
OpenAIClient({required Dio dio, required String apiUrl, bool isLogging = false}) {
OpenAIClient(
{required Dio dio, required String apiUrl, bool isLogging = false}) {
_dio = dio;
_apiUrl = apiUrl;
log = Logger.instance.builder(isLogging: isLogging);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/openai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class OpenAI implements IOpenAI {
dio.interceptors.add(InterceptorWrapper());

final _apiUrl = (apiUrl?.isNotEmpty ?? false) ? apiUrl! : kURL;
_client = OpenAIClient(dio: dio, apiUrl: _apiUrl , isLogging: enableLog);
_client = OpenAIClient(dio: dio, apiUrl: _apiUrl, isLogging: enableLog);

return instance;
}
Expand Down

0 comments on commit de9f0f5

Please sign in to comment.