Unifies streaming code
This commit is contained in:
@@ -39,6 +39,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
full_message += &response.message.content;
|
||||
print!("{}", response.message.content);
|
||||
std::io::stdout().flush()?;
|
||||
if response.done {
|
||||
break;
|
||||
}
|
||||
}
|
||||
println!();
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
Ok(token) => {
|
||||
print!("{}", token.response);
|
||||
std::io::stdout().flush()?;
|
||||
if token.done {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Err(e) => println!("Error: {}", e),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user