diff options
| author | sigoden <sigoden@gmail.com> | 2024-03-02 15:44:08 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-02 15:44:08 +0800 |
| commit | bc3cbce2f4e9d7cd543ce39a6630f0c451f35d12 (patch) | |
| tree | c58bd3e37ec5973c8c2f374df4d188e61adb1171 /src/config/role.rs | |
| parent | bbb13d8227913ff971efff5466d1caa0061d4990 (diff) | |
| download | aichat-bc3cbce2f4e9d7cd543ce39a6630f0c451f35d12.tar.gz | |
refactor: enhanced shell support (#326)
Diffstat (limited to 'src/config/role.rs')
| -rw-r--r-- | src/config/role.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/config/role.rs b/src/config/role.rs index f963874..a63877b 100644 --- a/src/config/role.rs +++ b/src/config/role.rs @@ -23,18 +23,18 @@ pub struct Role { impl Role { pub fn for_execute() -> Self { let os = detect_os(); - let shell = detect_shell(); - let shell = match shell.rsplit_once('/') { - Some((_, v)) => v, - None => &shell, + let (shell, _, _) = detect_shell(); + let combine = match shell.as_str() { + "nushell" | "powershell" => ";", + _ => "&&", }; Self { name: "__for_execute__".into(), prompt: format!( r#"Provide only {shell} commands for {os} without any description. If there is a lack of details, provide most logical solution. -Ensure the output is a valid shell command. -If multiple steps required try to combine them together using &&. +Ensure the output is a valid {shell} command. +If multiple steps required try to combine them together using {combine}. Provide only plain text without Markdown formatting. Do not provide markdown formatting such as ```"# ), |
