diff options
| author | sigoden <sigoden@gmail.com> | 2024-07-30 07:45:29 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-30 07:45:29 +0800 |
| commit | cc74be5d2163fbb1e9d57f85d5546857c6602446 (patch) | |
| tree | 9897a88950ad6fc65dbd63f0cb9bbc9e7290d950 /src/config/role.rs | |
| parent | 4c18e91165269970747bd2734b9b5db013ade2c2 (diff) | |
| download | aichat-cc74be5d2163fbb1e9d57f85d5546857c6602446.tar.gz | |
refactor: several improvements (#765)
Diffstat (limited to 'src/config/role.rs')
| -rw-r--r-- | src/config/role.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/config/role.rs b/src/config/role.rs index 3fc7696..31e894b 100644 --- a/src/config/role.rs +++ b/src/config/role.rs @@ -1,9 +1,6 @@ use super::*; -use crate::{ - client::{Message, MessageContent, MessageRole, Model}, - utils::{detect_os, detect_shell}, -}; +use crate::client::{Message, MessageContent, MessageRole, Model}; use anyhow::{Context, Result}; use serde::{Deserialize, Serialize}; @@ -315,17 +312,17 @@ fn parse_structure_prompt(prompt: &str) -> (&str, Vec<(&str, &str)>) { } fn shell_prompt() -> String { - let os = detect_os(); - let shell = detect_shell(); - let shell = shell.name.as_str(); + let os = OS.as_str(); + let shell = SHELL.name.as_str(); let combinator = if shell == "powershell" { - "\nIf multiple steps required try to combine them together using ';'.\nIf it already combined with '&&' try to replace it with ';'.".to_string() + "If multiple steps required try to combine them together using ';'.\nIf it already combined with '&&' try to replace it with ';'.".to_string() } else { - "\nIf multiple steps required try to combine them together using '&&'.".to_string() + "If multiple steps required try to combine them together using '&&'.".to_string() }; format!( r#"Provide only {shell} commands for {os} without any description. -Ensure the output is a valid {shell} command. {combinator} +Ensure the output is a valid {shell} command. +{combinator} If there is a lack of details, provide most logical solution. Output plain text only, without any markdown formatting."# ) |
