Implement api-fetching

This commit is contained in:
Gabriel Tofvesson 2023-03-18 16:37:50 +01:00
parent 8f252c7ed4
commit cd26d76baa
No known key found for this signature in database
GPG Key ID: 6F1345DF28EDA13E

View File

@ -1,3 +1,18 @@
use elevenlabs_rs::elevenlabs_api::ElevenLabsAPI;
use openai_rs::context::Context;
fn get_file(name: &str) -> anyhow::Result<String> {
Ok(std::fs::read_to_string(std::path::Path::new(name))?.trim().to_string())
}
fn get_openai() -> anyhow::Result<Context> {
Ok(Context::new(get_file("openai.key")?))
}
fn get_elevenlabs() -> anyhow::Result<ElevenLabsAPI> {
Ok(ElevenLabsAPI::new(get_file("elevenlabs.key")?))
}
fn main() {
println!("Hello, world!");
}