Skip to content

Commit

Permalink
Merge pull request #81 from wliu6v/fix-example-app
Browse files Browse the repository at this point in the history
fix #69: missing first word in sse response for example_app
  • Loading branch information
redevrx committed Dec 19, 2023
2 parents 58ec1dc + dff7076 commit 1dc476e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions example_app/openai_app/lib/bloc/openai/openai_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:chat_gpt_sdk/chat_gpt_sdk.dart';
Expand Down Expand Up @@ -135,11 +136,9 @@ class OpenAIBloc extends Cubit<OpenAIState> {
}
return false;
});

///+= message
message?.message =
'${message?.message ?? ""}${it.choices.last.message?.content ?? ""}';
list.add(Message(isBot: true, id: '${it.id}', message: message?.message));
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));
}, onDone: () {
Expand Down

0 comments on commit 1dc476e

Please sign in to comment.