(&mut self, model_ref: String, provider: Option<String>)
| 2776 | } |
| 2777 | |
| 2778 | fn set_active_model_selection(&mut self, model_ref: String, provider: Option<String>) { |
| 2779 | let (model_key, explicit_variant) = |
| 2780 | parse_model_ref_selection(&model_ref, &self.available_models, &self.model_variants); |
| 2781 | let resolved_provider = provider.or_else(|| provider_from_model(&model_key)); |
| 2782 | self.context |
| 2783 | .set_model_selection(model_key.clone(), resolved_provider); |
| 2784 | if let Some(variant) = explicit_variant { |
| 2785 | self.model_variant_selection |
| 2786 | .insert(model_key.clone(), Some(variant.clone())); |
| 2787 | self.context.set_model_variant(Some(variant)); |
| 2788 | return; |
| 2789 | } |
| 2790 | let variant = self |
| 2791 | .model_variant_selection |
| 2792 | .get(&model_key) |
| 2793 | .cloned() |
| 2794 | .flatten(); |
| 2795 | self.context.set_model_variant(variant); |
| 2796 | } |
| 2797 | |
| 2798 | fn sync_current_model_variant(&mut self) { |
| 2799 | let Some(model_ref) = self.context.current_model.read().clone() else { |
no test coverage detected