assistant panel: Disable send button on config error (#16455)

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-08-19 11:44:56 +02:00 committed by GitHub
parent f651333896
commit e68b2d5ecc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3621,12 +3621,12 @@ impl ContextEditor {
let provider = LanguageModelRegistry::read_global(cx).active_provider();
let has_configuration_error = configuration_error(cx).is_some();
let needs_to_accept_terms = self.show_accept_terms
&& provider
.as_ref()
.map_or(false, |provider| provider.must_accept_terms(cx));
let has_active_error = self.error_message.is_some();
let disabled = needs_to_accept_terms || has_active_error;
let disabled = has_configuration_error || needs_to_accept_terms;
ButtonLike::new("send_button")
.disabled(disabled)