getActiveModel static method

Future<AIModel?> getActiveModel()

Implementation

static Future<AIModel?> getActiveModel() async {
  final models = await loadAllModels();
  if (models.isEmpty) return null;

  final settings = await getRotationSettings();
  final selection = strategyFor(settings.mode).select(models, settings);

  // persist any settings change (e.g. round-robin index)
  if (selection.settings.roundRobinIndex != settings.roundRobinIndex) {
    await _saveRotationSettings(selection.settings);
  }
  return selection.model;
}