mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 06:20:09 +01:00
feat: additional prompts
This commit is contained in:
parent
8233ab723d
commit
d4bfbd2c1a
2 changed files with 12 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ Configuration is done via environment variables:
|
||||||
- `_PR_AI_MODEL`: Model used
|
- `_PR_AI_MODEL`: Model used
|
||||||
- `_PR_AI_DISABLE`: Setting to any value disables AI integration
|
- `_PR_AI_DISABLE`: Setting to any value disables AI integration
|
||||||
- `_PR_AI_LOCALE`: Locale in which the AI explains the suggestion. Defaults to user system locale
|
- `_PR_AI_LOCALE`: Locale in which the AI explains the suggestion. Defaults to user system locale
|
||||||
|
- `_PR_AI_ADDITIONAL_PROMPT`: Additional prompts to be included. (Yes, you can include role-playing prompts you pervert)
|
||||||
|
- `You are a cute catgirl. Always use cute phrases and expressions to prove your cuteness in the note, including cat imitations like nya~, にゃ~, 喵~.`
|
||||||
|
|
||||||
Compile time variables: Default values for the respective variables above when not set
|
Compile time variables: Default values for the respective variables above when not set
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,15 @@ pub fn ai_suggestion(last_command: &str, error_msg: &str) -> Option<AIResponse>
|
||||||
"".to_string()
|
"".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!(
|
let ai_prompt = format!(
|
||||||
r#"
|
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:
|
`{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}"}}
|
{{"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 res;
|
||||||
let messages = Messages {
|
let messages = Messages {
|
||||||
messages: vec![Input {
|
messages: vec![Input {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue