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

@ -69,6 +69,8 @@ actions!(
ConfirmCommand,
NewContext,
ToggleModelSelector,
CycleNextInlineAssist,
CyclePreviousInlineAssist
]
);
@ -359,8 +361,19 @@ fn update_active_language_model_from_settings(cx: &mut AppContext) {
let settings = AssistantSettings::get_global(cx);
let provider_name = LanguageModelProviderId::from(settings.default_model.provider.clone());
let model_id = LanguageModelId::from(settings.default_model.model.clone());
let inline_alternatives = settings
.inline_alternatives
.iter()
.map(|alternative| {
(
LanguageModelProviderId::from(alternative.provider.clone()),
LanguageModelId::from(alternative.model.clone()),
)
})
.collect::<Vec<_>>();
LanguageModelRegistry::global(cx).update(cx, |registry, cx| {
registry.select_active_model(&provider_name, &model_id, cx);
registry.select_inline_alternative_models(inline_alternatives, cx);
});
}