summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-03-10 08:01:54 +0800
committerGitHub <noreply@github.com>2024-03-10 08:01:54 +0800
commitaed243c3aa0dd6d6c7dcba088304170f9d5cb696 (patch)
treebe1ceff108f766b33d9e185ca42acab312180101 /src/main.rs
parent8f144989695e089fe3b3e7f4e97ac2b862574bd3 (diff)
downloadaichat-aed243c3aa0dd6d6c7dcba088304170f9d5cb696.tar.gz
feat: allow use of temporary role in a session (#348)
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index c967611..589676e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -114,7 +114,11 @@ fn start_directive(
if let Some(session) = &config.read().session {
session.guard_save()?;
}
- let input = Input::new(text, include.unwrap_or_default())?;
+ let input = Input::new(
+ text,
+ include.unwrap_or_default(),
+ config.read().input_context(),
+ )?;
let mut client = init_client(config)?;
ensure_model_capabilities(client.as_mut(), input.required_capabilities())?;
config.read().maybe_print_send_tokens(&input);
@@ -148,7 +152,7 @@ fn start_interactive(config: &GlobalConfig) -> Result<()> {
}
fn execute(config: &GlobalConfig, text: &str) -> Result<()> {
- let input = Input::from_str(text);
+ let input = Input::from_str(text, config.read().input_context());
let client = init_client(config)?;
config.read().maybe_print_send_tokens(&input);
let mut eval_str = client.send_message(input.clone())?;
@@ -192,7 +196,7 @@ fn execute(config: &GlobalConfig, text: &str) -> Result<()> {
if !describe {
config.write().set_describe_command_role()?;
}
- let input = Input::from_str(&eval_str);
+ let input = Input::from_str(&eval_str, config.read().input_context());
let abort = create_abort_signal();
render_stream(&input, client.as_ref(), config, abort)?;
describe = true;