feat: multiple AI suggestion

This commit is contained in:
iff 2024-12-12 16:17:04 +01:00
parent dc705545ce
commit 6392118cb6
2 changed files with 6 additions and 4 deletions

View file

@ -29,8 +29,10 @@ fn main() -> Result<(), std::io::Error> {
let note = fill(&suggest.note, termwidth());
eprintln!("{}\n{}\n", warn, note);
let command = suggest.command;
print!("{}<_PR_BR>", command);
let suggestions = suggest.commands;
for suggestion in suggestions {
print!("{}<_PR_BR>", suggestion);
}
}
Ok(())
}

View file

@ -24,7 +24,7 @@ struct Messages {
#[derive(Serialize, Deserialize)]
pub struct AISuggest {
pub command: String,
pub commands: Vec<String>,
pub note: String,
}
@ -52,7 +52,7 @@ pub fn ai_suggestion(last_command: &str, error_msg: &str) -> Option<AISuggest> {
let user_locale = {
let locale = std::env::var("_PR_AI_LOCALE")
.unwrap_or_else(|_| get_locale().unwrap_or("en".to_string()));
.unwrap_or_else(|_| get_locale().unwrap_or("en-us".to_string()));
if locale.len() < 2 {
"en-US".to_string()
} else {