From cd26d76baa46c28b4bcf650a43e519e04e3dcee0 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Sat, 18 Mar 2023 16:37:50 +0100 Subject: [PATCH] Implement api-fetching --- src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.rs b/src/main.rs index e7a11a9..6712f98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,18 @@ +use elevenlabs_rs::elevenlabs_api::ElevenLabsAPI; +use openai_rs::context::Context; + +fn get_file(name: &str) -> anyhow::Result { + Ok(std::fs::read_to_string(std::path::Path::new(name))?.trim().to_string()) +} + +fn get_openai() -> anyhow::Result { + Ok(Context::new(get_file("openai.key")?)) +} + +fn get_elevenlabs() -> anyhow::Result { + Ok(ElevenLabsAPI::new(get_file("elevenlabs.key")?)) +} + fn main() { println!("Hello, world!"); }