mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 22:40:09 +01:00
feat: experimental AI support
This commit is contained in:
parent
070343a5e2
commit
5d7624563d
6 changed files with 1312 additions and 0 deletions
|
|
@ -56,6 +56,21 @@ pub fn suggest_command(shell: &str, last_command: &str, error_msg: &str) -> Opti
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "request-ai")]{
|
||||
use crate::requests::ai_suggestion;
|
||||
let suggest = ai_suggestion(last_command, error_msg);
|
||||
if let Some(suggest) = suggest {
|
||||
eprintln!("{}: {}\n", t!("ai-suggestion").bold().blue(), suggest.note);
|
||||
let command = suggest.command;
|
||||
if command != "None" {
|
||||
if PRIVILEGE_LIST.contains(&split_command[0].as_str()) {
|
||||
return Some(format!("{} {}", split_command[0], command));
|
||||
}
|
||||
return Some(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue