2023-09-16 20:07:00 +01:00
|
|
|
mod algos;
|
2023-09-16 16:13:57 +01:00
|
|
|
mod config;
|
2023-09-07 18:02:36 +01:00
|
|
|
mod processes;
|
|
|
|
mod services;
|
2023-08-18 20:11:49 +01:00
|
|
|
|
2023-08-31 08:42:56 +01:00
|
|
|
use anyhow::Result;
|
|
|
|
|
2023-09-16 16:13:57 +01:00
|
|
|
use crate::config::Config;
|
2023-09-16 16:21:18 +01:00
|
|
|
use crate::processes::FeedServer;
|
|
|
|
use crate::processes::PostIndexer;
|
|
|
|
use crate::processes::ProfileClassifier;
|
|
|
|
use crate::services::Bluesky;
|
|
|
|
use crate::services::Database;
|
2023-09-16 20:07:00 +01:00
|
|
|
use crate::services::AI;
|
2023-08-18 20:11:49 +01:00
|
|
|
|
|
|
|
#[tokio::main]
|
2023-08-31 08:42:56 +01:00
|
|
|
async fn main() -> Result<()> {
|
2023-09-07 18:20:38 +01:00
|
|
|
let config = Config::load()?;
|
|
|
|
|
|
|
|
let ai = AI::new(&config.chat_gpt_api_key, "https://api.openai.com");
|
2023-09-07 18:02:36 +01:00
|
|
|
let bluesky = Bluesky::new("https://bsky.social");
|
2023-09-07 18:20:38 +01:00
|
|
|
let database = Database::connect(&config.database_url).await?;
|
2023-08-31 08:42:56 +01:00
|
|
|
|
2023-09-16 16:16:01 +01:00
|
|
|
let post_indexer = PostIndexer::new(&database, &bluesky);
|
2023-09-07 18:02:36 +01:00
|
|
|
let profile_classifier = ProfileClassifier::new(&database, &ai, &bluesky);
|
2023-09-16 16:13:57 +01:00
|
|
|
let feed_server = FeedServer::new(&database, &config);
|
2023-09-06 07:26:03 +01:00
|
|
|
|
2023-09-16 16:13:57 +01:00
|
|
|
tokio::try_join!(
|
2023-09-16 16:16:01 +01:00
|
|
|
post_indexer.start(),
|
2023-09-16 16:13:57 +01:00
|
|
|
profile_classifier.start(),
|
|
|
|
feed_server.serve(),
|
|
|
|
)?;
|
2023-08-18 20:11:49 +01:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|