feat: Nachrichtenbereich nach Auftrag v1.1 (A2, #1195); Version 0.1.18-rc2

Lesebreite mittig, Empty State, Antworten ohne Blase, Fragen als schmale Pille, Aktionen in einer
ruhigen Zeile, Modell, Persona und Denkstufe nur auf Abruf hinter Info.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 08:27:59 +01:00
parent 559d45c78f
commit 19f708bd18
5 changed files with 87 additions and 31 deletions

View File

@ -164,7 +164,8 @@ pub(super) async fn page(State(state): State<Arc<AppState>>, headers: HeaderMap)
<strong>Erweiterte Einstellungen</strong>\
<label class=\"feld\">Max. Tokens <input id=\"chat-max\" type=\"number\" min=\"1\" max=\"{MAX_TOKENS_LIMIT}\" value=\"{DEFAULT_MAX_TOKENS}\"></label>{sprache}</div></details></div>\
<p class=\"klein\" id=\"chat-persona-hinweis\" data-kontexte=\"{contexts}\" data-laengen=\"{lengths}\" role=\"status\"></p>\
<div class=\"verlauf\" id=\"chat-verlauf\" aria-live=\"polite\"></div><button type=\"button\" class=\"sm chat-nach-unten\" id=\"chat-nach-unten\" hidden>Zur aktuellen Antwort ↓</button>\
<div class=\"verlauf\" id=\"chat-verlauf\" aria-live=\"polite\"></div>\
<div class=\"chat-leer\" id=\"chat-leer\"><h2>Was möchtest du wissen?</h2><p>Wähle ein Modell und starte ein Gespräch.</p></div><button type=\"button\" class=\"sm chat-nach-unten\" id=\"chat-nach-unten\" hidden>Zur aktuellen Antwort ↓</button>\
{player}\
<form id=\"chat-form\"><textarea id=\"chat-text\" rows=\"3\" required placeholder=\"Nachricht … (Enter sendet, Umschalt+Enter macht eine neue Zeile)\"></textarea>\
<div class=\"zeile chat-eingabe\"><label>Modell <select id=\"chat-modell\">{options}</select></label><label>Denkstufe <select id=\"chat-denkstufe\"><option value=\"\">Engine-Voreinstellung</option><option value=\"none\">aus</option><option value=\"low\">niedrig</option><option value=\"medium\" selected>mittel</option><option value=\"high\">hoch</option></select></label><span class=\"klein\" id=\"chat-status\"></span>\
@ -1226,8 +1227,9 @@ const CHAT_JS: &str = r#"(function () {
knopf.textContent = "Vorlesen";
var vorgelesen = gesamt;
knopf.addEventListener("click", function () { vorlesen(vorgelesen, personaInfo); });
antwort.el.appendChild(knopf);
aktionen(antwort.el).appendChild(knopf);
}
if (gesamt && konfigAntwort) { infoKnopf(antwort.el, konfigAntwort); }
if (abgeschnitten) {
var hinweis = document.createElement("span");
hinweis.className = "meta";
@ -1291,14 +1293,6 @@ const CHAT_JS: &str = r#"(function () {
var version = r.headers.get("x-nexus-persona-version");
if (version && personaId) { personaInfo = { id: personaId, version: Number(version) }; }
konfigAntwort = { modell: modellName, persona: personaName, version: version ? Number(version) : null, denkstufe: denkWahl };
var meta = document.createElement("span");
meta.className = "meta";
meta.textContent = konfigText(konfigAntwort);
antwort.el.appendChild(meta);
var frageMeta = document.createElement("span");
frageMeta.className = "meta";
frageMeta.textContent = meta.textContent;
frageBlase.el.appendChild(frageMeta);
if (!r.ok) {
return r.text().then(function (t) {
var meldung = "Fehler " + r.status;
@ -1720,6 +1714,35 @@ const CHAT_JS: &str = r#"(function () {
});
zeichneSync();
}
// Aktionen (Kopieren, Vorlesen, Wiederholen, Info) stehen in einer ruhigen Zeile unter der Antwort (#1195, A2).
function aktionen(el) {
var z = el.querySelector(":scope > .aktionen");
if (!z) {
z = document.createElement("div");
z.className = "aktionen";
el.appendChild(z);
}
return z;
}
// Modell, Persona und Denkstufe einer Antwort nur auf Abruf (Auftrag v1.1, Abschnitt 6).
function infoKnopf(el, k) {
var b = document.createElement("button");
b.type = "button";
b.className = "sm aktion info";
b.textContent = "Info";
b.setAttribute("aria-expanded", "false");
b.setAttribute("aria-label", "Modell und Persona dieser Antwort");
b.addEventListener("click", function () {
var z = el.querySelector(":scope > .meta.konfig");
if (z) { z.remove(); b.setAttribute("aria-expanded", "false"); return; }
z = document.createElement("span");
z.className = "meta konfig";
z.textContent = konfigText(k);
el.appendChild(z);
b.setAttribute("aria-expanded", "true");
});
aktionen(el).appendChild(b);
}
// Kopieren und Wiederholen unter jeder Antwort (Styleguide 15).
function kopierKnopf(el, text) {
var k = document.createElement("button");
@ -1733,7 +1756,7 @@ const CHAT_JS: &str = r#"(function () {
setTimeout(function () { k.textContent = "Kopieren"; }, 1500);
}, function () { k.textContent = "Nicht möglich"; });
});
el.appendChild(k);
aktionen(el).appendChild(k);
}
function wiederholenKnopf(el, userIdx) {
var w = document.createElement("button");
@ -1741,7 +1764,7 @@ const CHAT_JS: &str = r#"(function () {
w.className = "sm aktion wiederholen";
w.textContent = "Wiederholen";
w.addEventListener("click", function () { wiederholen(userIdx); });
el.appendChild(w);
aktionen(el).appendChild(w);
}
// Nur die letzte Antwort darf wiederholt werden; alte Knöpfe fallen weg.
function wiederholenEntfernen() {
@ -1763,12 +1786,6 @@ const CHAT_JS: &str = r#"(function () {
messages.forEach(function (m, i) {
var b = blase(m.role === "user" ? "user" : "assistant", m.content);
if (m.role !== "assistant") { return; }
if (konfigs[i]) {
var z = document.createElement("span");
z.className = "meta";
z.textContent = konfigText(konfigs[i]);
b.el.appendChild(z);
}
kopierKnopf(b.el, m.content);
if (i === messages.length - 1 && i > 0 && messages[i - 1].role === "user") { wiederholenKnopf(b.el, i - 1); }
// Vorlesen auch an Antworten eines geöffneten Chats (Vorlage v1.2: unter jeder Antwort), wenn eine Sprachausgabe gewählt werden kann.
@ -1778,8 +1795,9 @@ const CHAT_JS: &str = r#"(function () {
vk.className = "sm";
vk.textContent = "Vorlesen";
vk.addEventListener("click", function () { vorlesen(m.content, null); });
b.el.appendChild(vk);
aktionen(b.el).appendChild(vk);
}
if (konfigs[i]) { infoKnopf(b.el, konfigs[i]); }
});
}