fix: cli specify role is not applied when conversation_first set true (#57)

close #56
pull/58/head
sigoden 1 year ago committed by GitHub
parent 0044399509
commit 4161eaa6c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -82,13 +82,17 @@ impl Config {
let mut config: Config = serde_yaml::from_str(&content)
.with_context(|| format!("Invalid config at {}", config_path.display()))?;
config.load_roles()?;
if config.conversation_first {
config.start_conversation()?;
}
Ok(config)
}
pub fn on_repl(&mut self) -> Result<()> {
if self.conversation_first {
self.start_conversation()?;
}
Ok(())
}
pub fn find_role(&self, name: &str) -> Option<Role> {
self.roles.iter().find(|v| v.name == name).cloned()
}

@ -98,6 +98,7 @@ fn start_directive(
fn start_interactive(client: ChatGptClient, config: SharedConfig) -> Result<()> {
cl100k_base_singleton();
config.lock().on_repl()?;
let mut repl = Repl::init(config.clone())?;
repl.run(client, config)
}

Loading…
Cancel
Save