From 4132b953c910a7e42611f4e41d1998d677d4d8e2 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 12:50:59 -0500 Subject: [PATCH] "feat(main): Update main function to use new MlBody and ml.make_request APIs" --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index e9d7bd9..8321c41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,17 +17,17 @@ fn main() { }; if prompt.is_none() { - println!("Sorry nothing to do.. exiting"); return; } let mut ml = MlInterface::new(); let (directions, content) = prompt.unwrap(); - let mind_gen_text = MlBody::new(content, directions); - let res_text = ml.make_request(mind_gen_text).unwrap().text().unwrap(); + let body = MlBody::new(content, directions); + let res_text = ml.make_request(body).unwrap().text().unwrap(); + let response: Result = serde_json::from_str(&res_text); if response.is_err() { panic!("oop something went wrong: {:?}", response.err()); } - println!("{:#?}", response.unwrap()); + println!("{:?}", response.unwrap().response); }