cloud_llm_client: Make default_model and default_fast_model optional (#38288)

This PR makes the `default_model` and `default_fast_model` fields
optional on the `ListModelsResponse`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2025-09-16 22:24:03 +00:00
committed by GitHub
parent ee399ebccf
commit 74e5b848ff
2 changed files with 14 additions and 4 deletions
@@ -321,8 +321,8 @@ pub struct LanguageModel {
#[derive(Debug, Serialize, Deserialize)]
pub struct ListModelsResponse {
pub models: Vec<LanguageModel>,
pub default_model: LanguageModelId,
pub default_fast_model: LanguageModelId,
pub default_model: Option<LanguageModelId>,
pub default_fast_model: Option<LanguageModelId>,
pub recommended_models: Vec<LanguageModelId>,
}
+12 -2
View File
@@ -215,11 +215,21 @@ impl State {
self.default_model = models
.iter()
.find(|model| model.id == response.default_model)
.find(|model| {
response
.default_model
.as_ref()
.is_some_and(|default_model_id| &model.id == default_model_id)
})
.cloned();
self.default_fast_model = models
.iter()
.find(|model| model.id == response.default_fast_model)
.find(|model| {
response
.default_fast_model
.as_ref()
.is_some_and(|default_fast_model_id| &model.id == default_fast_model_id)
})
.cloned();
self.recommended_models = response
.recommended_models