select method

  1. @override
AiSelection select(
  1. List<AIModel> all,
  2. RotationSettings settings
)
override

Implementation

@override
AiSelection select(List<AIModel> all, RotationSettings settings) {
  final pool = _rotationPool(all);
  if (pool.isEmpty) return AiSelection(_defaultOf(all), settings);

  final healthy = pool.firstWhere(
    (m) => m.getStatus() != AIStatus.tokenLimitError,
    orElse: () => pool.first,
  );
  return AiSelection(healthy, settings);
}