Lyra Agent hinzugefügt, Multi-Agent Routing, BaseAgent refactoring

This commit is contained in:
Sithies
2026-03-16 22:31:13 +01:00
parent 30d63debd9
commit 6fc1648939
13 changed files with 148 additions and 22 deletions
+13 -2
View File
@@ -16,6 +16,7 @@ use tokio::spawn;
use tracing::{error, info, warn};
use sebas_tian::Sebas;
use lyra::Lyra;
use crate::chat::types::{AgentChatConfig, AuthResult};
// ─── Synology Form-Payload ────────────────────────────────────────────────────
@@ -65,6 +66,8 @@ pub struct AppState {
pub http: Client,
/// Sebas Tian — Mutex weil chat() &mut self braucht
pub sebas: Mutex<Sebas>,
/// Lyra — Companion Agent, eigenes Modell
pub lyra: Mutex<Lyra>,
}
// ─── Handler ──────────────────────────────────────────────────────────────────
@@ -151,7 +154,6 @@ async fn process(state: Arc<AppState>, payload: SynologyIncoming, agent: AgentCh
// 2. Richtigen Agent aufrufen anhand agent_id
let response = match agent.agent_id.as_str() {
"sebas_tian" => {
// Mutex lock — exklusiver Zugriff auf Sebas
let mut sebas = state.sebas.lock().await;
match sebas.chat(&payload.text).await {
Ok(text) => text,
@@ -161,8 +163,17 @@ async fn process(state: Arc<AppState>, payload: SynologyIncoming, agent: AgentCh
}
}
}
"lyra" => {
let mut lyra = state.lyra.lock().await;
match lyra.chat(&payload.text).await {
Ok(text) => text,
Err(e) => {
error!(error = %e, "Lyra Fehler");
"Entschuldigung, es ist ein interner Fehler aufgetreten.".to_string()
}
}
}
unknown => {
// Später: weitere Agenten hier einhängen
warn!(agent_id = %unknown, "Unbekannter Agent");
"Dieser Agent ist noch nicht verfügbar.".to_string()
}
+17 -8
View File
@@ -15,6 +15,7 @@ use tracing::info;
use api::llm::lmstudio::LmStudioProvider;
use sebas_tian::Sebas;
use lyra::Lyra;
use chat::synology::{handle_incoming, AppState};
#[tokio::main]
@@ -30,17 +31,24 @@ async fn main() -> anyhow::Result<()> {
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
// Sebas Tian — Butler Agent
let sebas = Sebas::new(
"crates/sebas-tian/config/soul_core.md",
"crates/sebas-tian/config/soul_personality.md",
llm,
Box::new(LmStudioProvider::new(
"http://localhost:1234",
"dolphin3.0-llama3.1-8b-abliterated",
)),
);
// Lyra — Companion Agent (eigenes Modell)
let lyra = Lyra::new(
"crates/lyra/config/soul_core.md",
"crates/lyra/config/soul_personality.md",
Box::new(LmStudioProvider::new(
"http://localhost:1234",
"dolphin3.0-llama3.1-8b-abliterated", // ← später durch Lyras Modell ersetzen
)),
);
// Shared State aufbauen
@@ -50,6 +58,7 @@ async fn main() -> anyhow::Result<()> {
admin_webhook_url: cfg.chat.admin_webhook_url,
http: Client::new(),
sebas: Mutex::new(sebas),
lyra: Mutex::new(lyra),
});
// Routes registrieren