| 595 | |
| 596 | void ServerState::load_voice_presets(LoadedModel & model) const { |
| 597 | for (const auto & [name, preset] : model.config.voice_presets) { |
| 598 | auto [it, inserted] = model.voice_presets.emplace(name, load_runtime_voice_preset(preset)); |
| 599 | if (!inserted) { |
| 600 | throw std::runtime_error("duplicate runtime voice preset for model " + model.config.id + ": " + name); |
| 601 | } |
| 602 | (void) it; |
| 603 | } |
| 604 | if (model.config.default_voice_preset_id.has_value()) { |
| 605 | const auto it = model.voice_presets.find(*model.config.default_voice_preset_id); |
| 606 | if (it == model.voice_presets.end()) { |
| 607 | throw std::runtime_error( |
| 608 | "default_voice_preset for model " + model.config.id + |
| 609 | " was not loaded: " + |
| 610 | *model.config.default_voice_preset_id); |
| 611 | } |
| 612 | model.default_voice_preset = it->second; |
| 613 | } else if (model.config.default_voice_preset.has_value()) { |
| 614 | model.default_voice_preset = load_runtime_voice_preset(*model.config.default_voice_preset); |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | void ServerState::ensure_model_loaded_locked(LoadedModel & model) { |
| 619 | if (model.session != nullptr) { |
nothing calls this directly
no test coverage detected