Lyra Agent hinzugefügt, Multi-Agent Routing, BaseAgent refactoring
This commit is contained in:
@@ -6,6 +6,7 @@ edition = "2024"
|
||||
[dependencies]
|
||||
# Agenten
|
||||
sebas-tian = { path = "../sebas-tian" }
|
||||
lyra = { path = "../lyra" }
|
||||
|
||||
# LLM Provider
|
||||
api = { path = "../api" }
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user