mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-11 22:10: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();
|
let buffered = self.buf.join("").trim().to_string();
|
||||||
self.buf.clear();
|
self.buf.clear();
|
||||||
if buffered.ends_with("<note>") {
|
if buffered.ends_with("<note>") {
|
||||||
let warn = format!("\r{}:", t!("ai-suggestion"))
|
let warn = format!("{}:", t!("ai-suggestion"))
|
||||||
.bold()
|
.bold()
|
||||||
.blue()
|
.blue()
|
||||||
.to_string();
|
.to_string();
|
||||||
let first = buffered.replace("<note>", &warn);
|
let first = buffered.replace("<note>", &warn);
|
||||||
eprintln!("{}", first);
|
eprintln!("\r{}", first);
|
||||||
std::io::stdout().flush().unwrap();
|
std::io::stdout().flush().unwrap();
|
||||||
} else if buffered.ends_with("</note>") {
|
} else if buffered.ends_with("</note>") {
|
||||||
let tag = "</note>";
|
let tag = "</note>";
|
||||||
let whitespace = " ".repeat(tag.len());
|
let whitespace = " ".repeat(tag.len());
|
||||||
let formatted = format!("\r{}", whitespace);
|
let clear = whitespace.to_string();
|
||||||
let first = buffered.replace("</note>", &formatted);
|
let first = buffered.replace("</note>", &clear);
|
||||||
eprintln!("{}", first);
|
eprintln!("\r{}", first);
|
||||||
self.state = State::Buf;
|
self.state = State::Buf;
|
||||||
std::io::stdout().flush().unwrap();
|
std::io::stdout().flush().unwrap();
|
||||||
} else if buffered.ends_with("<think>") {
|
} else if buffered.ends_with("<think>") {
|
||||||
let tag = "<think>";
|
let tag = "<think>";
|
||||||
let warn = format!("\r{}:", t!("ai-thinking"))
|
let warn = format!("{}:", t!("ai-thinking")).bold().blue().to_string();
|
||||||
.bold()
|
|
||||||
.blue()
|
|
||||||
.to_string();
|
|
||||||
let first = buffered.replace(tag, &warn);
|
let first = buffered.replace(tag, &warn);
|
||||||
self.state = State::Think;
|
self.state = State::Think;
|
||||||
eprintln!("{}", first);
|
eprintln!("\r{}", first);
|
||||||
std::io::stdout().flush().unwrap();
|
std::io::stdout().flush().unwrap();
|
||||||
} else if buffered.ends_with("</think>") {
|
} else if buffered.ends_with("</think>") {
|
||||||
let tag = "</think>";
|
let tag = "</think>";
|
||||||
let whitespace = " ".repeat(tag.len());
|
let whitespace = " ".repeat(tag.len());
|
||||||
let formatted = format!("\r{}", whitespace);
|
let clear = whitespace.to_string();
|
||||||
let first = buffered.replace(tag, &formatted);
|
let first = buffered.replace(tag, &clear);
|
||||||
eprintln!("{}", first);
|
eprintln!("\r{}", first);
|
||||||
std::io::stdout().flush().unwrap();
|
std::io::stdout().flush().unwrap();
|
||||||
} else if buffered.ends_with("```") {
|
} else if buffered.ends_with("```") {
|
||||||
let tag = "```";
|
let tag = "```";
|
||||||
|
|
@ -179,10 +176,10 @@ impl Buffer {
|
||||||
if buffered.ends_with("</think>") {
|
if buffered.ends_with("</think>") {
|
||||||
let tag = "</think>";
|
let tag = "</think>";
|
||||||
let whitespace = " ".repeat(tag.len());
|
let whitespace = " ".repeat(tag.len());
|
||||||
let formatted = format!("\r{}", whitespace);
|
let clear = whitespace.to_string();
|
||||||
let first = buffered.replace(tag, &formatted);
|
let first = buffered.replace(tag, &clear);
|
||||||
self.state = State::Write;
|
self.state = State::Write;
|
||||||
eprintln!("{}", first);
|
eprintln!("\r{}", first);
|
||||||
std::io::stdout().flush().unwrap();
|
std::io::stdout().flush().unwrap();
|
||||||
} else {
|
} else {
|
||||||
eprintln!("{}", first);
|
eprintln!("{}", first);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue