v6 Phase C: Cookbook diversifiziert + 'Beste Wahl' hervorgehoben

- recipes.py: best-in-class je Use-Case, herstelleruebergreifend (Qwen3-Coder, Gemma 3,
  Mistral Small, DeepSeek-R1, Qwen3-VL) + neue Kategorie 'Nachdenken & Logik'.
- recipes-Endpoint: recommended_id = reichstes Setup das komplett passt.
- cookbook.js + CSS: 'Beste Wahl fuer dein System' (Rahmen + Badge).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-21 14:42:31 +02:00
parent d7a3253740
commit e8685f16f3
4 changed files with 48 additions and 31 deletions
+8 -3
View File
@@ -17,6 +17,7 @@ let currentResults = [];
let currentAnalysis = null;
let activeFilter = "";
let RECIPES = [];
let RECOMMENDED = null;
const fitCls = lvl => lvl === "perfect" ? "ok" : lvl === "marginal" ? "warn" : "bad";
const fitWord = lvl => lvl === "perfect" ? "Passt locker" : lvl === "marginal" ? "Wird knapp" : "Zu groß";
@@ -117,6 +118,7 @@ async function loadRecipes() {
try {
const d = await api("/api/cookbook/recipes");
RECIPES = d.recipes || [];
RECOMMENDED = d.recommended_id || null;
renderRecipes();
} catch (e) {
$("#cb-recipes").innerHTML = `<div class="alert err" style="grid-column:1/-1">Setups nicht ladbar: ${esc(e.message)}</div>`;
@@ -124,8 +126,10 @@ async function loadRecipes() {
}
function renderRecipes() {
$("#cb-recipes").innerHTML = RECIPES.map(r => `
<button class="card-btn" data-recipe="${esc(r.id)}">
$("#cb-recipes").innerHTML = RECIPES.map(r => {
const best = r.id === RECOMMENDED;
return `<button class="card-btn${best ? " cb-best" : ""}" data-recipe="${esc(r.id)}">
${best ? `<div class="cb-best-tag">★ Beste Wahl für dein System</div>` : ""}
<div class="flex justify-between items-center">
<span class="flex items-center gap-2"><span class="text-accent">${icon(r.icon)}</span>
<h3 style="margin:0;font-size:15px">${esc(r.title)}</h3></span>
@@ -133,7 +137,8 @@ function renderRecipes() {
</div>
<p>${esc(r.desc)}</p>
<div class="text-xs text-mut">${r.models.length} Modell${r.models.length > 1 ? "e" : ""} im Setup</div>
</button>`).join("");
</button>`;
}).join("");
$("#cb-recipes").querySelectorAll("[data-recipe]").forEach(b =>
b.addEventListener("click", () => openRecipe(b.getAttribute("data-recipe"))));
}