1use std::path::PathBuf;
2
3use chatgpt::chatbot::Chatbot;
4use chatgpt::config::Config;
5use futures::StreamExt;
6
7#[tokio::main]
8async fn main() {
9 std::env::set_var("RUST_LOG", "info");
10 pretty_env_logger::init();
11 let config_file = PathBuf::from(std::env::var("HOME").unwrap()).join(".config/chatgpt/config.json");
12 let config = Config::from_file(&config_file);
13 let mut bot = Chatbot::new(config).await;
14 let mut response = bot.ask_stream("Explain quantum physics.").await;
15 while let Some(Ok(response)) = response.next().await {
16 println!("{response}");
17 }
18}