mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
feat: additional prompts
This commit is contained in:
parent
8233ab723d
commit
d4bfbd2c1a
2 changed files with 12 additions and 0 deletions
|
|
@ -71,8 +71,15 @@ pub fn ai_suggestion(last_command: &str, error_msg: &str) -> Option<AIResponse>
|
|||
"".to_string()
|
||||
};
|
||||
|
||||
let addtional_prompt = if std::env::var("_PR_AI_ADDITIONAL_PROMPT").is_ok() {
|
||||
std::env::var("_PR_AI_ADDITIONAL_PROMPT").unwrap()
|
||||
} else {
|
||||
"".to_string()
|
||||
};
|
||||
|
||||
let ai_prompt = format!(
|
||||
r#"
|
||||
{addtional_prompt}
|
||||
`{last_command}` returns the following error message: `{error_msg}`. Provide possible commands to fix it. Answer in the following exact JSON template without any extra text:
|
||||
```
|
||||
{{"commands":["command 1","command 2"],"note":"why they may fix the error{set_locale}"}}
|
||||
|
|
@ -80,6 +87,9 @@ pub fn ai_suggestion(last_command: &str, error_msg: &str) -> Option<AIResponse>
|
|||
"#
|
||||
);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
eprintln!("AI module: AI prompt: {}", ai_prompt);
|
||||
|
||||
let res;
|
||||
let messages = Messages {
|
||||
messages: vec![Input {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue