fromMap static method

OpenAiCompatibleAI fromMap(
  1. Map map
)

Implementation

static OpenAiCompatibleAI fromMap(Map map) {
  final type = AiModelType.fromMap(map['modelType']);
  final base = type == AiModelType.xai
      ? OpenAiCompatibleAI.xai()
      : OpenAiCompatibleAI.openAi();
  return OpenAiCompatibleAI(
    modelType: type,
    name: map['name'] ?? base.name,
    baseUrl: map['baseUrl'] ?? base.baseUrl,
    chatModel: map['chatModel'] ?? base.chatModel,
  )
    ..id = map['id']
    ..defaultModel = map['defaultModel'] ?? false
    ..inRotation = map['inRotation'] ?? true
    ..rotationOrder = map['rotationOrder'] ?? 0
    ..apiKey = map['apiKey']
    ..lastStatusCheckedTime = map['lastStatusCheckedTime'] == null
        ? null
        : DateTime.parse(map['lastStatusCheckedTime'])
    ..lastStatus = AIStatus.fromMap(map['lastStatus']);
}