update text for project search if not authenticated

This commit is contained in:
KCaverly 2023-10-21 10:28:54 -04:00
parent 106115676d
commit 4835c77840

View file

@ -351,33 +351,32 @@ impl View for ProjectSearchView {
SemanticIndexStatus::NotAuthenticated => { SemanticIndexStatus::NotAuthenticated => {
major_text = Cow::Borrowed("Not Authenticated"); major_text = Cow::Borrowed("Not Authenticated");
show_minor_text = false; show_minor_text = false;
Some( Some(vec![
"API Key Missing: Please set 'OPENAI_API_KEY' in Environment Variables.\nIf this variable was set using the Assistant Panel, please restart Zed to Authenticate." "API Key Missing: Please set 'OPENAI_API_KEY' in Environment Variables."
.to_string(), .to_string(), "If you authenticated using the Assistant Panel, please restart Zed to Authenticate.".to_string()])
)
} }
SemanticIndexStatus::Indexed => Some("Indexing complete".to_string()), SemanticIndexStatus::Indexed => Some(vec!["Indexing complete".to_string()]),
SemanticIndexStatus::Indexing { SemanticIndexStatus::Indexing {
remaining_files, remaining_files,
rate_limit_expiry, rate_limit_expiry,
} => { } => {
if remaining_files == 0 { if remaining_files == 0 {
Some(format!("Indexing...")) Some(vec![format!("Indexing...")])
} else { } else {
if let Some(rate_limit_expiry) = rate_limit_expiry { if let Some(rate_limit_expiry) = rate_limit_expiry {
let remaining_seconds = let remaining_seconds =
rate_limit_expiry.duration_since(Instant::now()); rate_limit_expiry.duration_since(Instant::now());
if remaining_seconds > Duration::from_secs(0) { if remaining_seconds > Duration::from_secs(0) {
Some(format!( Some(vec![format!(
"Remaining files to index (rate limit resets in {}s): {}", "Remaining files to index (rate limit resets in {}s): {}",
remaining_seconds.as_secs(), remaining_seconds.as_secs(),
remaining_files remaining_files
)) )])
} else { } else {
Some(format!("Remaining files to index: {}", remaining_files)) Some(vec![format!("Remaining files to index: {}", remaining_files)])
} }
} else { } else {
Some(format!("Remaining files to index: {}", remaining_files)) Some(vec![format!("Remaining files to index: {}", remaining_files)])
} }
} }
} }
@ -394,9 +393,11 @@ impl View for ProjectSearchView {
} else { } else {
match current_mode { match current_mode {
SearchMode::Semantic => { SearchMode::Semantic => {
let mut minor_text = Vec::new(); let mut minor_text: Vec<String> = Vec::new();
minor_text.push("".into()); minor_text.push("".into());
minor_text.extend(semantic_status); if let Some(semantic_status) = semantic_status {
minor_text.extend(semantic_status);
}
if show_minor_text { if show_minor_text {
minor_text minor_text
.push("Simply explain the code you are looking to find.".into()); .push("Simply explain the code you are looking to find.".into());