inital commit

This commit is contained in:
0xMRTT 2023-06-17 15:06:45 +02:00
commit b1613686d7
Signed by: 0xMRTT
GPG Key ID: 910B287304120902
4 changed files with 1492 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1451
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

14
Cargo.toml Normal file
View File

@ -0,0 +1,14 @@
[package]
name = "baichat-rs"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ratmom = "0.1.0"
reqwest = { version = "0.11.18", features = ["json"] }
reqwest-eventsource = "0.4.0"
serde = "1.0.164"
serde_json = "1.0.97"
tokio = { version = "1", features = ["full"] }

26
src/main.rs Normal file
View File

@ -0,0 +1,26 @@
use ratmom::{prelude::*, Request};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut request = Request::builder()
.method("POST")
.uri("https://chatbot.theb.ai/api/chat-process")
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0")
.header("Accept-Language", "en-US,en;q=0.5")
.header("Content-Type", "application/json")
.header("Host", "chatbot.theb.ai")
.header("Referer", "https://chatbot.theb.ai")
.header("Origin", "https://chatbot.theb.ai")
.body(r#"{
"prompt": "Hello",
"options": {
"parentMessageId": "8c00bd29-75b0-42c7-9d4f-05a94ac8b2de"
}
}"#)
.unwrap();
println!("{}", request);
Ok(())
}