retryLastMessage method

void retryLastMessage()

Implementation

void retryLastMessage() {
  if (_messages.isNotEmpty) {
    final lastUserMessage = _messages.lastWhere(
      (m) => m.role == MessageRole.user,
      orElse: () => throw Exception('No user message found'),
    );
    sendMessage(lastUserMessage.content);
  }
}