feat(ui): Engines nach Art ordnen und beschriften (Chat, Sprachausgabe) (#1091)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg3Td16J38kAyDLzb39
This commit is contained in:
@ -20,6 +20,18 @@ fn mode_text(mode: Mode) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// Art einer Engine für Reihenfolge und Beschriftung auf der Seite „Engines“. Keine Reiter: Es gibt
|
||||
/// wenige Engines, und die Tabelle oben zeigt alle auf einen Blick.
|
||||
fn art(c: &nexus_adapter::Capabilities) -> (u8, &'static str) {
|
||||
if c.chat {
|
||||
(0, "Chat")
|
||||
} else if c.speech {
|
||||
(1, "Sprachausgabe")
|
||||
} else {
|
||||
(2, "Sonstige")
|
||||
}
|
||||
}
|
||||
|
||||
/// Ergebnis der Suche einer Engine als Tabelle mit „Registrieren“ je Fund.
|
||||
fn found_block(
|
||||
viewer: &Viewer,
|
||||
@ -130,11 +142,13 @@ pub(super) async fn engines_page(
|
||||
let rows = super::verwaltung::model_engine_names(&state);
|
||||
let mut summary = String::new();
|
||||
let mut searches = String::new();
|
||||
let cards: String = state
|
||||
.runtime
|
||||
.engine_overview()
|
||||
let mut overview = state.runtime.engine_overview();
|
||||
// Chat-Engines zuerst, dann Sprachausgabe, dann der Rest; innerhalb davon nach Namen.
|
||||
overview.sort_by_key(|(name, info, _)| (art(&info.capabilities).0, name.clone()));
|
||||
let cards: String = overview
|
||||
.into_iter()
|
||||
.map(|(name, info, start)| {
|
||||
let kind = art(&info.capabilities).1;
|
||||
let models: Vec<&String> = rows
|
||||
.iter()
|
||||
.filter(|(_, engine)| engine.as_deref() == Some(name.as_str()))
|
||||
@ -151,7 +165,7 @@ pub(super) async fn engines_page(
|
||||
&& state.runtime.engine_ui_port(&name).is_some() {
|
||||
format!(" <a href=\"/ui/engine/{}/\">Engine-Oberfläche</a>", name.bytes().map(|b| if b.is_ascii_alphanumeric() || b"-._~".contains(&b) { (b as char).to_string() } else { format!("%{b:02X}") }).collect::<String>())
|
||||
} else { String::new() };
|
||||
summary.push_str(&format!("<tr><th>{}</th><td>{health} · Fehler seit Start: {errors}{surface}</td><td>{}</td></tr>", esc(&name),
|
||||
summary.push_str(&format!("<tr><th>{}<br><span class=\"muted klein\">{kind}</span></th><td>{health} · Fehler seit Start: {errors}{surface}</td><td>{}</td></tr>", esc(&name),
|
||||
if links.is_empty() { "Keine Modelle registriert.".into() } else { links }));
|
||||
let installed = match &start.executable {
|
||||
Some(path) if path.exists() => {
|
||||
@ -203,7 +217,7 @@ pub(super) async fn engines_page(
|
||||
}
|
||||
format!(
|
||||
"<section class=\"card engine\"><div class=\"zeile\"><h2>{name}</h2>\
|
||||
<span class=\"chip accent\">{mode}</span>{installed}\
|
||||
<span class=\"chip accent\">{mode}</span><span class=\"chip\">{kind}</span>{installed}\
|
||||
<span class=\"rechts muted\">{n} Modelle registriert</span></div>\
|
||||
<div class=\"chips\">{caps}</div>{start_details}</section>",
|
||||
name = esc(&name), mode = mode_text(info.mode), n = models.len(), caps = super::faehigkeiten::engine_faehigkeiten(&info.capabilities),
|
||||
|
||||
Reference in New Issue
Block a user