allMessagesContent property

List<String> get allMessagesContent

Returns a list of all messages content in the conversation It is a list of strings and switches from request to response Example:

final conversation = chat.allMessagesContent;
print(conversation.first); //prints the first message in the conversation
print(conversation[1]); //prints the first response in the conversation

Implementation

List<String> get allMessagesContent {
  List<String> messages = [];
  for (final item in _conversationItems) {
    messages.add(item.request.content);
    if (item.response != null) {
      messages.add(item.response!.choices.first.message);
    }
  }
  return messages;
}