From b3e687943811fd48589d7030122c33c7e9867ec9 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 30 Oct 2023 10:36:08 +0800 Subject: feat: deprecate prompt, remove `--prompt` and `.prompt` (#176) --- src/config/mod.rs | 15 --------------- src/config/role.rs | 13 ------------- 2 files changed, 28 deletions(-) (limited to 'src/config') diff --git a/src/config/mod.rs b/src/config/mod.rs index 4dcc2c9..0af432c 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -192,12 +192,6 @@ impl Config { None => { format!("# CHAT:[{timestamp}]\n{input}\n--------\n{output}\n--------\n\n",) } - Some(v) if v.is_temp() => { - format!( - "# CHAT:[{timestamp}]\n{}\n{input}\n--------\n{output}\n--------\n\n", - v.prompt - ) - } Some(v) => { format!( "# CHAT:[{timestamp}] ({})\n{input}\n--------\n{output}\n--------\n\n", @@ -262,15 +256,6 @@ impl Config { Ok(()) } - pub fn add_prompt(&mut self, prompt: &str) -> Result<()> { - let role = Role::new(prompt, self.temperature); - if let Some(session) = self.session.as_mut() { - session.update_role(Some(role.clone()))?; - } - self.role = Some(role); - Ok(()) - } - pub fn get_temperature(&self) -> Option { self.role .as_ref() diff --git a/src/config/role.rs b/src/config/role.rs index fee989e..87aca5e 100644 --- a/src/config/role.rs +++ b/src/config/role.rs @@ -3,7 +3,6 @@ use super::message::{Message, MessageRole}; use anyhow::{Context, Result}; use serde::{Deserialize, Serialize}; -const TEMP_ROLE_NAME: &str = "temp"; const INPUT_PLACEHOLDER: &str = "__INPUT__"; #[derive(Debug, Clone, Deserialize, Serialize)] @@ -17,18 +16,6 @@ pub struct Role { } impl Role { - pub fn new(prompt: &str, temperature: Option) -> Self { - Self { - name: TEMP_ROLE_NAME.into(), - prompt: prompt.into(), - temperature, - } - } - - pub fn is_temp(&self) -> bool { - self.name == TEMP_ROLE_NAME - } - pub fn info(&self) -> Result { let output = serde_yaml::to_string(&self) .with_context(|| format!("Unable to show info about role {}", &self.name))?; -- cgit v1.2.3