Introduce the ability to cycle between alternative inline assists (#18098)

Release Notes:

- Added a new `assistant.inline_alternatives` setting to configure
additional models that will be used to perform inline assists in
parallel.

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Roy <roy@anthropic.com>
Co-authored-by: Adam <wolffiex@anthropic.com>
This commit is contained in:
Antonio Scandurra 2024-09-19 17:50:00 -06:00 committed by GitHub
parent ae34872f73
commit 15b4130fa5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 642 additions and 178 deletions

View file

@ -59,6 +59,7 @@ pub struct AssistantSettings {
pub default_width: Pixels,
pub default_height: Pixels,
pub default_model: LanguageModelSelection,
pub inline_alternatives: Vec<LanguageModelSelection>,
pub using_outdated_settings_version: bool,
}
@ -236,6 +237,7 @@ impl AssistantSettingsContent {
})
}
}),
inline_alternatives: None,
},
VersionedAssistantSettingsContent::V2(settings) => settings.clone(),
},
@ -254,6 +256,7 @@ impl AssistantSettingsContent {
.id()
.to_string(),
}),
inline_alternatives: None,
},
}
}
@ -369,6 +372,7 @@ impl Default for VersionedAssistantSettingsContent {
default_width: None,
default_height: None,
default_model: None,
inline_alternatives: None,
})
}
}
@ -397,6 +401,8 @@ pub struct AssistantSettingsContentV2 {
default_height: Option<f32>,
/// The default model to use when creating new contexts.
default_model: Option<LanguageModelSelection>,
/// Additional models with which to generate alternatives when performing inline assists.
inline_alternatives: Option<Vec<LanguageModelSelection>>,
}
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
@ -517,10 +523,8 @@ impl Settings for AssistantSettings {
&mut settings.default_height,
value.default_height.map(Into::into),
);
merge(
&mut settings.default_model,
value.default_model.map(Into::into),
);
merge(&mut settings.default_model, value.default_model);
merge(&mut settings.inline_alternatives, value.inline_alternatives);
// merge(&mut settings.infer_context, value.infer_context); TODO re-enable this once we ship context inference
}
@ -574,6 +578,7 @@ mod tests {
provider: "test-provider".into(),
model: "gpt-99".into(),
}),
inline_alternatives: None,
enabled: None,
button: None,
dock: None,