mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
feat: multiple AI suggestion
This commit is contained in:
parent
dc705545ce
commit
6392118cb6
2 changed files with 6 additions and 4 deletions
|
|
@ -29,8 +29,10 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
let note = fill(&suggest.note, termwidth());
|
let note = fill(&suggest.note, termwidth());
|
||||||
|
|
||||||
eprintln!("{}\n{}\n", warn, note);
|
eprintln!("{}\n{}\n", warn, note);
|
||||||
let command = suggest.command;
|
let suggestions = suggest.commands;
|
||||||
print!("{}<_PR_BR>", command);
|
for suggestion in suggestions {
|
||||||
|
print!("{}<_PR_BR>", suggestion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ struct Messages {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct AISuggest {
|
pub struct AISuggest {
|
||||||
pub command: String,
|
pub commands: Vec<String>,
|
||||||
pub note: String,
|
pub note: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ pub fn ai_suggestion(last_command: &str, error_msg: &str) -> Option<AISuggest> {
|
||||||
|
|
||||||
let user_locale = {
|
let user_locale = {
|
||||||
let locale = std::env::var("_PR_AI_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 {
|
if locale.len() < 2 {
|
||||||
"en-US".to_string()
|
"en-US".to_string()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue