feat(ui): Reiter Engines und überarbeitete Modelle-Seite mit Dialog je Modell (#1068)

Engine::start_info meldet das Startkommando mit Platzhaltern. Die Karten
"Planung ändern" weichen einem Dialog je Modell. Lokal mit Attrappen im
Browser gesehen, auf srv04 nicht geprüft.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg3osejhFSpUz472iQ1
This commit is contained in:
2026-11-16 12:54:29 +01:00
parent a4e791b571
commit cb685b0659
15 changed files with 532 additions and 61 deletions

View File

@ -2,10 +2,10 @@ use std::time::Duration;
use async_trait::async_trait;
use crate::types::EngineInfo;
use crate::types::{
DiscoveredArtifact, Endpoint, Health, InstanceHandle, ProfileSpec, Result, Usage,
};
use crate::types::{EngineInfo, StartInfo};
/// Vertrag zwischen Gateway und Engine (Spezifikation, Abschnitt 4).
///
@ -16,6 +16,11 @@ pub trait Engine: Send + Sync {
/// Art, Modus und Fähigkeiten der Engine.
fn describe(&self) -> EngineInfo;
/// Wie die Engine gestartet wird (nur zur Anzeige, ohne Geheimnisse).
fn start_info(&self) -> StartInfo {
StartInfo::default()
}
/// Sucht Modelle und Quantisierungen. Verändert nichts.
async fn discover(&self) -> Result<Vec<DiscoveredArtifact>>;

View File

@ -27,5 +27,5 @@ pub use ollama::{OllamaConfig, OllamaEngine, OllamaMode};
pub use process::process_exists;
pub use types::{
AdapterError, Capabilities, DiscoveredArtifact, Endpoint, EngineInfo, Health, InstanceHandle,
Mode, ProfileSpec, Protocol, Result, Usage,
Mode, ProfileSpec, Protocol, Result, StartInfo, Usage,
};

View File

@ -19,7 +19,7 @@ use crate::engine::Engine;
use crate::process::{PortPool, http_status, log_tail, rotate_log, sigterm};
use crate::types::{
AdapterError, Capabilities, DiscoveredArtifact, Endpoint, EngineInfo, Health, InstanceHandle,
Mode, ProfileSpec, Protocol, Result, Usage,
Mode, ProfileSpec, Protocol, Result, StartInfo, Usage,
};
/// Konfiguration des llama.cpp-Adapters. Enthält keine Geheimnisse.
@ -251,6 +251,47 @@ impl LlamaCppEngine {
#[async_trait]
impl Engine for LlamaCppEngine {
fn start_info(&self) -> StartInfo {
let c = &self.config;
let mut command = format!(
"{} -m <Modelldatei> --host 127.0.0.1 --port <Port> -ngl {} --alias <Modellname> [-c <Kontext>]",
c.binary.display(),
c.gpu_layers
);
for a in &c.extra_args {
command.push(' ');
command.push_str(a);
}
let mut env = vec![(
"CUDA_VISIBLE_DEVICES".to_string(),
"<GPUs des Modells>".to_string(),
)];
env.extend(c.env.iter().map(|(k, v)| (k.clone(), v.clone())));
StartInfo {
executable: Some(c.binary.clone()),
command,
env,
details: vec![
(
"Modellordner".to_string(),
c.model_roots
.iter()
.map(|p| p.display().to_string())
.collect::<Vec<_>>()
.join(", "),
),
(
"Ports".to_string(),
format!("{} bis {}", c.port_from, c.port_to),
),
(
"Zeitlimit Start".to_string(),
format!("{} s", c.ready_timeout_secs),
),
],
}
}
fn describe(&self) -> EngineInfo {
EngineInfo {
name: "llama.cpp".to_string(),

View File

@ -40,7 +40,7 @@ use crate::llama::{parse_rss_mb, parse_vram_mb};
use crate::process::{PortPool, log_tail, rotate_log, sigterm, terminate_group};
use crate::types::{
AdapterError, Capabilities, DiscoveredArtifact, Endpoint, EngineInfo, Health, InstanceHandle,
Mode, ProfileSpec, Protocol, Result, Usage,
Mode, ProfileSpec, Protocol, Result, StartInfo, Usage,
};
/// Konfiguration des Maya-Adapters. Enthält keine Geheimnisse.
@ -481,6 +481,49 @@ pub(crate) fn parse_pgrp(stat: &str) -> Option<u32> {
#[async_trait]
impl Engine for MayaEngine {
fn start_info(&self) -> StartInfo {
let c = &self.config;
let args = self
.build_args(Path::new("<Kopie der Konfiguration>"), c.port_from)
.join(" ")
.replace(&c.port_from.to_string(), "<Port>");
StartInfo {
executable: Some(c.script.clone()),
command: format!("{} {}", c.python.display(), args),
env: Vec::new(),
details: vec![
(
"Python".to_string(),
format!(
"{} ({})",
c.python.display(),
if c.python.exists() {
"vorhanden"
} else {
"fehlt"
}
),
),
(
"Konfigurationen".to_string(),
c.config_roots
.iter()
.map(|p| p.display().to_string())
.collect::<Vec<_>>()
.join(", "),
),
(
"Ports".to_string(),
format!("{} bis {}", c.port_from, c.port_to),
),
(
"Zeitlimit Start".to_string(),
format!("{} s", c.ready_timeout_secs),
),
],
}
}
fn describe(&self) -> EngineInfo {
EngineInfo {
name: self.name().to_string(),

View File

@ -33,7 +33,7 @@ use crate::engine::Engine;
use crate::process::{PortPool, http_status, log_tail, rotate_log, sigterm, terminate_group};
use crate::types::{
AdapterError, Capabilities, DiscoveredArtifact, Endpoint, EngineInfo, Health, InstanceHandle,
Mode, ProfileSpec, Protocol, Result, Usage,
Mode, ProfileSpec, Protocol, Result, StartInfo, Usage,
};
const MIB: u64 = 1024 * 1024;
@ -413,6 +413,54 @@ impl OllamaEngine {
#[async_trait]
impl Engine for OllamaEngine {
fn start_info(&self) -> StartInfo {
let c = &self.config;
if !self.managed() {
return StartInfo {
executable: None,
command: "(wird nicht gestartet: das Gateway nutzt einen laufenden Ollama-Server)"
.to_string(),
env: Vec::new(),
details: vec![
("Adresse".to_string(), c.base_url.clone()),
(
"Modellordner".to_string(),
c.models_dir.display().to_string(),
),
],
};
}
StartInfo {
executable: Some(c.binary.clone()),
command: format!("{} serve", c.binary.display()),
env: self
.server_env(c.port_from)
.into_iter()
.map(|(k, v)| {
if k == "OLLAMA_HOST" {
(k, "127.0.0.1:<Port>".to_string())
} else {
(k, v)
}
})
.collect(),
details: vec![
(
"Modellordner".to_string(),
c.models_dir.display().to_string(),
),
(
"Ports".to_string(),
format!("{} bis {}", c.port_from, c.port_to),
),
(
"Zeitlimit Start".to_string(),
format!("{} s", c.ready_timeout_secs),
),
],
}
}
fn describe(&self) -> EngineInfo {
EngineInfo {
name: "ollama".to_string(),

View File

@ -30,6 +30,21 @@ pub struct Capabilities {
pub images: bool,
}
/// Wie das Gateway eine Engine startet, zum Anzeigen in der Oberfläche. Enthält
/// keine Geheimnisse und nichts, was das Gateway erst beim Start einsetzt
/// (Port, Modellpfad), nur Platzhalter in spitzen Klammern.
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct StartInfo {
/// Programm, das gestartet wird; die Oberfläche prüft, ob es existiert.
pub executable: Option<PathBuf>,
/// Kommandozeile mit Platzhaltern.
pub command: String,
/// Umgebungsvariablen, die gesetzt werden (Name, Wert).
pub env: Vec<(String, String)>,
/// Weitere Angaben (Beschriftung, Wert), zum Beispiel Modellordner und Ports.
pub details: Vec<(String, String)>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EngineInfo {
pub name: String,