I'm currently trying chat_gpt_sdk on Flutter (dart) https://pub.dev/packages/chat_gpt_sdk
When i start a conversation , api return me a message. but that's all. I cannot continue to talk, I need to find a way to retrieve history from last responses ans requests.
I Use this code to initialize text
final request = CompleteText(
prompt: "My input message", maxTokens: 100, model: kTranslateModelV3
);
Attempt the request with the onCompleteText method
final response = await chatGPT!.onCompleteText(request: request);
I make some search on few forums and the OpenAI Discord but no reponse And few stackoverflow posts are posted about this problems but its very recent message without any clear response.
I found the solution
Get the history from a list of message
String history = messages.reversed.map((e) => e.text).join('@');
String history = messages.reversed.map((e) => e.text).join('@');
final msg = history + lastMessage + "@";
And just after I concatenate the history with the last message sent and no forget a stop symbol like @