diff options
| author | sigoden <sigoden@gmail.com> | 2024-04-12 06:12:08 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-12 06:12:08 +0800 |
| commit | 568e9a06db7189a28f9346802356b3fd4bdf921b (patch) | |
| tree | 99c5785d614ff506dccf6deac6b8a07139fa1bb7 /src/config/role.rs | |
| parent | 9f19539c2ca6033062612b9164f0141e0871c44c (diff) | |
| download | aichat-568e9a06db7189a28f9346802356b3fd4bdf921b.tar.gz | |
refactor: hide sytem roles from repl tab-completion (#407)
Diffstat (limited to 'src/config/role.rs')
| -rw-r--r-- | src/config/role.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/config/role.rs b/src/config/role.rs index 57da38c..9042da3 100644 --- a/src/config/role.rs +++ b/src/config/role.rs @@ -46,8 +46,7 @@ impl Role { r#"Provide only {shell} commands for {os} without any description. Ensure the output is a valid {shell} command. {combine} If there is a lack of details, provide most logical solution. -Provide only plain text without Markdown formatting. -Do not provide markdown formatting such as ```"# +Output plain text only, without any markdown formatting."# ), temperature: None, } @@ -68,17 +67,20 @@ APPLY MARKDOWN formatting when possible."# pub fn for_code() -> Self { Self { name: Self::CODE.into(), - prompt: r#"Provide only code as output without any description. -Provide only code in plain text format without Markdown formatting. -Do not include symbols such as ``` or ```python. -If there is a lack of details, provide most logical solution. -You are not allowed to ask for more details. -For example if the prompt is "Hello world Python", you should return "print('Hello world')"."# + prompt: r#"Provide only code, without comments or explanations. +If there is a lack of details, provide most logical solution, without requesting further clarification."# .into(), temperature: None, } } + pub fn is_system(&self) -> bool { + matches!( + self.name.as_str(), + Self::EXECUTE | Self::DESCRIBE_COMMAND | Self::CODE + ) + } + pub fn export(&self) -> Result<String> { let output = serde_yaml::to_string(&self) .with_context(|| format!("Unable to show info about role {}", &self.name))?; |
