mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 06:20:09 +01:00
fix: misplaced carriage return
This commit is contained in:
parent
0289192047
commit
81a913f2ec
1 changed files with 13 additions and 16 deletions
|
|
@ -101,37 +101,34 @@ impl Buffer {
|
|||
let buffered = self.buf.join("").trim().to_string();
|
||||
self.buf.clear();
|
||||
if buffered.ends_with("<note>") {
|
||||
let warn = format!("\r{}:", t!("ai-suggestion"))
|
||||
let warn = format!("{}:", t!("ai-suggestion"))
|
||||
.bold()
|
||||
.blue()
|
||||
.to_string();
|
||||
let first = buffered.replace("<note>", &warn);
|
||||
eprintln!("{}", first);
|
||||
eprintln!("\r{}", first);
|
||||
std::io::stdout().flush().unwrap();
|
||||
} else if buffered.ends_with("</note>") {
|
||||
let tag = "</note>";
|
||||
let whitespace = " ".repeat(tag.len());
|
||||
let formatted = format!("\r{}", whitespace);
|
||||
let first = buffered.replace("</note>", &formatted);
|
||||
eprintln!("{}", first);
|
||||
let clear = whitespace.to_string();
|
||||
let first = buffered.replace("</note>", &clear);
|
||||
eprintln!("\r{}", first);
|
||||
self.state = State::Buf;
|
||||
std::io::stdout().flush().unwrap();
|
||||
} else if buffered.ends_with("<think>") {
|
||||
let tag = "<think>";
|
||||
let warn = format!("\r{}:", t!("ai-thinking"))
|
||||
.bold()
|
||||
.blue()
|
||||
.to_string();
|
||||
let warn = format!("{}:", t!("ai-thinking")).bold().blue().to_string();
|
||||
let first = buffered.replace(tag, &warn);
|
||||
self.state = State::Think;
|
||||
eprintln!("{}", first);
|
||||
eprintln!("\r{}", first);
|
||||
std::io::stdout().flush().unwrap();
|
||||
} else if buffered.ends_with("</think>") {
|
||||
let tag = "</think>";
|
||||
let whitespace = " ".repeat(tag.len());
|
||||
let formatted = format!("\r{}", whitespace);
|
||||
let first = buffered.replace(tag, &formatted);
|
||||
eprintln!("{}", first);
|
||||
let clear = whitespace.to_string();
|
||||
let first = buffered.replace(tag, &clear);
|
||||
eprintln!("\r{}", first);
|
||||
std::io::stdout().flush().unwrap();
|
||||
} else if buffered.ends_with("```") {
|
||||
let tag = "```";
|
||||
|
|
@ -179,10 +176,10 @@ impl Buffer {
|
|||
if buffered.ends_with("</think>") {
|
||||
let tag = "</think>";
|
||||
let whitespace = " ".repeat(tag.len());
|
||||
let formatted = format!("\r{}", whitespace);
|
||||
let first = buffered.replace(tag, &formatted);
|
||||
let clear = whitespace.to_string();
|
||||
let first = buffered.replace(tag, &clear);
|
||||
self.state = State::Write;
|
||||
eprintln!("{}", first);
|
||||
eprintln!("\r{}", first);
|
||||
std::io::stdout().flush().unwrap();
|
||||
} else {
|
||||
eprintln!("{}", first);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue