From 7e29f642a99682ea7bb074eb4e7aa7d34d523515 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 19 Oct 2024 18:25:40 +0800 Subject: feat: support openai o1 models (#935) --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index ec61370..a7cc9f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,7 +174,7 @@ async fn start_directive( let client = input.create_client()?; let extract_code = !*IS_STDOUT_TERMINAL && code_mode; config.write().before_chat_completion(&input)?; - let (output, tool_results) = if !config.read().stream || extract_code { + let (output, tool_results) = if !input.stream() || extract_code { let task = client.chat_completions(input.clone()); let ret = run_with_spinner(task, "Generating").await; match ret { @@ -288,7 +288,7 @@ async fn shell_execute(config: &GlobalConfig, shell: &Shell, mut input: Input) - let role = config.read().retrieve_role(EXPLAIN_SHELL_ROLE)?; let input = Input::from_str(config, &eval_str, Some(role)); let abort = create_abort_signal(); - if config.read().stream { + if input.stream() { call_chat_completions_streaming(&input, client.as_ref(), config, abort) .await?; } else { -- cgit v1.2.3