chatEventFromJson static method

ChatEvent chatEventFromJson(
  1. Map<String, dynamic> json
)

Implementation

static ChatEvent chatEventFromJson(Map<String, dynamic> json) {
  if (json['type'] == 'request') {
    return RequestChatEvent(GroqParser.groqMessageFromJson(json['message']));
  }
  return ResponseChatEvent(
    GroqParser.groqResponseFromJson(json['message']),
    GroqParser.groqUsageFromJson(json['usage']),
  );
}