Sebas Tin angelegt und Synology Chat connected
This commit is contained in:
@@ -1,3 +1,70 @@
|
||||
fn main() {
|
||||
println!("Nazarick starting...");
|
||||
// crates/nazarick/src/main.rs
|
||||
//
|
||||
// Nazarick — Einstiegspunkt.
|
||||
// Initialisiert alle Komponenten und startet den HTTP-Server.
|
||||
|
||||
mod chat;
|
||||
mod config;
|
||||
|
||||
use std::sync::Arc;
|
||||
use axum::{routing::post, Router};
|
||||
use reqwest::Client;
|
||||
use tokio::sync::Mutex;
|
||||
use tower_http::trace::TraceLayer;
|
||||
use tracing::info;
|
||||
|
||||
use api::llm::lmstudio::LmStudioProvider;
|
||||
use sebas_tian::Sebas;
|
||||
use chat::synology::{handle_incoming, AppState};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
// Logging initialisieren
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter("nazarick=info,tower_http=debug")
|
||||
.init();
|
||||
|
||||
info!("Nazarick erwacht...");
|
||||
|
||||
// Config laden
|
||||
let cfg = config::load()?;
|
||||
let port = cfg.chat.listen_port;
|
||||
|
||||
// LM Studio Provider initialisieren
|
||||
let llm = Box::new(LmStudioProvider::new(
|
||||
"http://localhost:1234",
|
||||
"dolphin3.0-llama3.1-8b-abliterated",
|
||||
));
|
||||
|
||||
// Sebas Tian initialisieren
|
||||
let sebas = Sebas::new(
|
||||
"crates/sebas-tian/config/soul_core.md",
|
||||
"crates/sebas-tian/config/soul_personality.md",
|
||||
llm,
|
||||
);
|
||||
|
||||
// Shared State aufbauen
|
||||
let state = Arc::new(AppState {
|
||||
agents: cfg.chat.agents,
|
||||
admin_user_id: cfg.chat.admin_user_id,
|
||||
admin_webhook_url: cfg.chat.admin_webhook_url,
|
||||
http: Client::new(),
|
||||
sebas: Mutex::new(sebas),
|
||||
});
|
||||
|
||||
// Routes registrieren
|
||||
let app = Router::new()
|
||||
.route("/chat/synology", post(handle_incoming))
|
||||
.with_state(state)
|
||||
.layer(TraceLayer::new_for_http());
|
||||
|
||||
// Server starten
|
||||
let addr = format!("0.0.0.0:{}", port);
|
||||
let listener = tokio::net::TcpListener::bind(&addr).await?;
|
||||
|
||||
info!("Lausche auf {}", addr);
|
||||
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user