refactor: adjust indicator text and render strategy

This commit is contained in:
sigoden 2024-04-14 22:23:01 +00:00
parent 38e594505b
commit 16e9c647d4
2 changed files with 4 additions and 3 deletions

View File

@ -117,14 +117,15 @@ fn start_directive(
let mut client = init_client(config)?;
ensure_model_capabilities(client.as_mut(), input.required_capabilities())?;
config.read().maybe_print_send_tokens(&input);
let output = if !stdout().is_terminal() || no_stream {
let is_terminal_stdout = stdout().is_terminal();
let output = if !is_terminal_stdout || no_stream {
let output = client.send_message(input.clone())?;
let output = if code_mode && output.trim_start().starts_with("```") {
extract_block(&output)
} else {
output.clone()
};
if no_stream {
if is_terminal_stdout {
let render_options = config.read().get_render_options()?;
let mut markdown_render = MarkdownRender::init(render_options)?;
println!("{}", markdown_render.render(&output).trim());

View File

@ -65,7 +65,7 @@ fn markdown_stream_inner(
let columns = terminal::size()?.0;
let mut spinner = Spinner::new(" Generating");
let mut spinner = Spinner::new(" Thinking");
'outer: loop {
if abort.aborted() {