diff --git a/src/lib.rs b/src/lib.rs index f4abdbd..23394a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,16 @@ use ratmom::{prelude::*, Request}; async fn ask(prompt: String) -> Result> { + + let mut body = String::new(); + body.push_str(r#"{ + "prompt": ""#); + body.push_str(&prompt); + body.push_str(r#"", + "options": { + "parentMessageId": "8c00bd29-75b0-42c7-9d4f-05a94ac8b2de" + } + }"#); let mut request = Request::builder() .method("POST") .uri("https://chatbot.theb.ai/api/chat-process") @@ -10,13 +20,8 @@ async fn ask(prompt: String) -> Result> { .header("Host", "chatbot.theb.ai") .header("Referer", "https://chatbot.theb.ai") .header("Origin", "https://chatbot.theb.ai") - .body(format!(r#"{ - "prompt": "{prompt}", - "options": { - "parentMessageId": "8c00bd29-75b0-42c7-9d4f-05a94ac8b2de" - } -}"#, prompt = prompt.as_str()))? + .body(body)? .send()?; - return request.text()?; + return Ok(request.text()?); } \ No newline at end of file