Customise a model from the portal: a file, a model, a button

A page for anyone in a project, built for the one who knows least: an
Excel, CSV or JSONL file of questions and answers, previewed; a model; a
name; who may use it; and a button. The weights to train on are found
from where the model's came (a GGUF repository's base model), the card's
memory from their size, the node as the one with the most free. When it
is done the adapter is published by itself (a llama.cpp model's replicas
replaced to load it) and is a model of its own in the chat and the API.

The project's by default; its members share it wider (confirmed, and
never wider than the knowledge bases its pairs came from) or delete it.
One trains at a time per project. ctl train start needs only --model and
--data now, and --publish publishes when done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-11-19 11:31:12 +01:00
1 parent fcda4d3f85
commit a53b2f4be9
33 files changed
+2199 -134

No files matched your search

+1
View File
@@ -109,6 +109,7 @@ type AccountPages struct {
licencePrefs LicencePrefs
images func() bool
meshes func() bool
train func() bool
guardLibrary func() guard.Config
// guardFor names the guardrail policies in force for someone, and
// whether they keep nothing; nil when there are none.
+2 -1
View File
@@ -14,5 +14,6 @@
"nav.mcp": "MCP servers",
"nav.settings": "Settings",
"nav.images": "Pictures",
"nav.meshes": "3D"
"nav.meshes": "3D",
"nav.train": "Customise a model"
}
+55
View File
@@ -0,0 +1,55 @@
{
"train.title": "Customise a model",
"train.intro": "Teach a model how to answer from your own examples: an Excel file with a column of questions and a column of answers. When training is done the new model appears under its own name in the chat and the API; it runs on the card its base model runs on, with no card of its own.",
"train.not_knowledge": "A model learns <strong>tone and the shape of answers</strong> from examples; it does not reliably learn the facts in your documents. For answers from your documents, use a knowledge base: the chat answers from them and shows where.",
"train.no_project": "Customising a model needs a project: training is done for a project, which pays for it. Ask an administrator to add you to one.",
"train.no_models": "There is no model that can be customised just now.",
"train.step.file": "1. Examples",
"train.file_hint": "Excel (.xlsx), CSV or JSONL. Columns headed Question and Answer are read; with no header the first column is the question and the second the answer. At least 50 examples, better a few hundred.",
"train.question": "Question",
"train.answer": "Answer",
"train.step.model": "2. Model",
"train.base": "Model to start from",
"train.name": "The new model's name",
"train.name_hint": "what it is chosen by in the chat: letters, digits, - and _",
"train.step.who": "3. Who may use it",
"train.project": "Project",
"train.share": "Who may use it",
"train.share.me": "Only me",
"train.share.project": "This project",
"train.share.team": "My team",
"train.share.org": "My organization",
"train.share.all": "Everyone",
"train.share.other": "Somewhere else",
"train.confirm": "This file holds nothing this group must not see.",
"train.go": "Start training",
"train.jobs": "Trainings",
"train.col.name": "Model",
"train.col.state": "State",
"train.col.share": "Who may use it",
"train.no_jobs": "No trainings yet.",
"train.after": "One training runs at a time in a project. It runs on a GPU with enough memory free; small models take minutes, large ones longer. You can leave the page: training goes on.",
"train.js.found": "{n} questions and answers found.",
"train.js.skipped": "{n} rows were skipped, with no question or no answer.",
"train.js.few": "That is few: at least 50 examples are advised.",
"train.js.no_file": "Choose the file of questions and answers first.",
"train.js.no_name": "Give the new model a name.",
"train.js.need_confirm": "To share with a wider group, confirm that the file holds nothing it must not see.",
"train.js.started": "Training is queued; it is listed below.",
"train.js.failed": "Could not start: {why}",
"train.js.queued": "Queued",
"train.js.waiting": "Queued: waiting for a GPU with enough memory free",
"train.js.preparing": "Preparing (fetching the base model)",
"train.js.running": "Training: {p}% ({m} min)",
"train.js.publishing": "Trained, publishing…",
"train.js.ready": "Ready: choose {name} in the chat",
"train.js.restarting": "Ready; {name} appears in the chat within a few minutes",
"train.js.not_published": "Trained, but not published: {why}",
"train.js.job_failed": "Failed: {why}",
"train.js.cancelled": "Stopped",
"train.js.delete": "Delete",
"train.js.delete_ask": "Delete {name}? It goes from the chat and the API.",
"train.js.share_ask": "It will be shared with a wider group. Do you confirm the training data holds nothing that group must not see?",
"train.js.try": "Try it in the chat",
"train.js.by": "started by {who}"
}
+2 -1
View File
@@ -14,5 +14,6 @@
"nav.mcp": "MCP sunucuları",
"nav.settings": "Ayarlar",
"nav.images": "Görseller",
"nav.meshes": "3D"
"nav.meshes": "3D",
"nav.train": "Modeli özelleştir"
}
+55
View File
@@ -0,0 +1,55 @@
{
"train.title": "Modeli özelleştir",
"train.intro": "Bir modele kendi örneklerinizle nasıl cevap vereceğini öğretin: bir Excel dosyasında bir sütun soru, bir sütun cevap. Eğitim bitince yeni model sohbette ve API'de kendi adıyla çıkar; temel modelin çalıştığı kartta çalışır, ayrı bir kart gerekmez.",
"train.not_knowledge": "Model örneklerden <strong>üslubu ve cevap biçimini</strong> öğrenir; belgelerinizdeki bilgileri güvenilir biçimde ezberlemez. Modelin belgelerinize göre cevap vermesini istiyorsanız bilgi tabanını kullanın: sohbette belgelerden cevaplar, kaynağını da gösterir.",
"train.no_project": "Model özelleştirmek için bir projeye üye olmalısınız: eğitim bir proje adına yapılır ve maliyeti projeye yazılır. Yöneticinizden sizi bir projeye eklemesini isteyin.",
"train.no_models": "Şu anda özelleştirilebilecek bir model yok.",
"train.step.file": "1. Örnekler",
"train.file_hint": "Excel (.xlsx), CSV ya da JSONL. Başlıkları Soru ve Cevap olan sütunlar okunur; başlık yoksa ilk sütun soru, ikincisi cevaptır. En az 50, tercihen birkaç yüz örnek.",
"train.question": "Soru",
"train.answer": "Cevap",
"train.step.model": "2. Model",
"train.base": "Temel alınacak model",
"train.name": "Yeni modelin adı",
"train.name_hint": "sohbette bu adla seçilir: harf, rakam, - ve _",
"train.step.who": "3. Kimler kullanabilir",
"train.project": "Proje",
"train.share": "Kullanabilecekler",
"train.share.me": "Yalnız ben",
"train.share.project": "Bu proje",
"train.share.team": "Takımım",
"train.share.org": "Kuruluşum",
"train.share.all": "Herkes",
"train.share.other": "Başka bir yer",
"train.confirm": "Bu dosyada bu gruptan saklanması gereken bilgi yok.",
"train.go": "Eğitimi başlat",
"train.jobs": "Eğitimler",
"train.col.name": "Model",
"train.col.state": "Durum",
"train.col.share": "Kullanabilecekler",
"train.no_jobs": "Henüz bir eğitim yok.",
"train.after": "Bir projede aynı anda bir eğitim çalışır. Eğitim, boş belleği yeterli bir GPU'da yapılır; küçük modeller dakikalar, büyükler daha uzun sürer. Sayfadan ayrılabilirsiniz, eğitim sürer.",
"train.js.found": "{n} soru-cevap bulundu.",
"train.js.skipped": "{n} satırda soru ya da cevap boş olduğu için atlandı.",
"train.js.few": "Bu az: en az 50 örnek önerilir.",
"train.js.no_file": "Önce soru-cevap dosyasını seçin.",
"train.js.no_name": "Yeni modele bir ad verin.",
"train.js.need_confirm": "Daha geniş bir grupla paylaşmak için dosyada saklanması gereken bilgi olmadığını onaylayın.",
"train.js.started": "Eğitim sıraya alındı; durumu aşağıda.",
"train.js.failed": "Başlatılamadı: {why}",
"train.js.queued": "Sırada",
"train.js.waiting": "Sırada: boş belleği yeterli bir GPU bekleniyor",
"train.js.preparing": "Hazırlanıyor (temel model indiriliyor)",
"train.js.running": "Eğitiliyor: %{p} ({m} dk)",
"train.js.publishing": "Eğitildi, yayınlanıyor…",
"train.js.ready": "Hazır: sohbette {name} adıyla seçin",
"train.js.restarting": "Hazır, birkaç dakika içinde sohbette {name} adıyla çıkacak",
"train.js.not_published": "Eğitildi ama yayınlanamadı: {why}",
"train.js.job_failed": "Başarısız: {why}",
"train.js.cancelled": "Durduruldu",
"train.js.delete": "Sil",
"train.js.delete_ask": "{name} silinsin mi? Model sohbetten ve API'den kalkar.",
"train.js.share_ask": "Daha geniş bir grupla paylaşılacak. Eğitim verisinde bu gruptan saklanması gereken bilgi olmadığını onaylıyor musunuz?",
"train.js.try": "Sohbette dene",
"train.js.by": "{who} başlattı"
}
+3
View File
@@ -40,6 +40,8 @@ type Nav struct {
// Images offers the pictures page, while some model makes them; Meshes
// the 3D page.
Images, Meshes bool
// Train offers the page that customises a model, while some model can be.
Train bool
}
type navKey struct{}
@@ -58,6 +60,7 @@ func (p *AccountPages) navFor(r *http.Request, user store.User, current string)
CSRF: csrfFor(r),
Images: p.images != nil && p.images(),
Meshes: p.meshes != nil && p.meshes(),
Train: p.train != nil && p.train(),
}
// Only when there is an organization to show: a link that leads to "there
// are none" on every page is noise.
+3
View File
@@ -37,6 +37,9 @@
{{- if .Meshes}}
<a href="/3d"{{if eq .Current "meshes"}} aria-current="page"{{end}}>{{t "nav.meshes"}}</a>
{{- end}}
{{- if .Train}}
<a href="/train"{{if eq .Current "train"}} aria-current="page"{{end}}>{{t "nav.train"}}</a>
{{- end}}
<a href="/profile"{{if eq .Current "keys"}} aria-current="page"{{end}}>{{t "nav.account"}}</a>
<a href="/docs"{{if eq .Current "docs"}} aria-current="page"{{end}}>{{t "nav.docs"}}</a>
<form method="post" action="/logout" class="inline">
+287
View File
@@ -0,0 +1,287 @@
{{define "train"}}<!doctype html>
<html lang="{{lang}}"><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>{{t "train.title"}} · llmgw</title><link rel="stylesheet" href="{{stylesheet}}">
<script defer src="{{asset "pages.js"}}"></script>
<meta name="csrf" content="{{.CSRF}}">
<style>
.train-steps { display: grid; gap: .9rem; max-width: 44rem; }
.train-steps .step { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: .8rem 1rem; background: var(--card); }
.train-steps .step h2 { font-size: 1rem; margin: 0 0 .4rem; }
.train-steps select, .train-steps input[type=text] { width: 100%; max-width: 28rem; }
.train-sample { margin-top: .5rem; }
.train-sample td { vertical-align: top; }
.train-confirm { font-weight: 400; }
.train-bar { height: .5rem; background: var(--line, #ddd); border-radius: 3px; overflow: hidden; margin-top: .25rem; max-width: 14rem; }
.train-bar > span { display: block; height: 100%; background: var(--accent); }
#jobs td { vertical-align: top; }
</style>
</head><body><div class="wrap">
<header>
<h1>{{t "train.title"}}</h1>
<p class="sub">{{.User.Email}}</p>
{{template "nav" .Nav}}
</header>
<p>{{t "train.intro"}}</p>
<p class="note">{{th "train.not_knowledge"}}</p>
{{if not .Projects}}
<p class="empty">{{t "train.no_project"}}</p>
{{else if not .Models}}
<p class="empty">{{t "train.no_models"}}</p>
{{else}}
<form id="start" class="train-steps">
<div class="step">
<h2>{{t "train.step.file"}}</h2>
<p class="note">{{t "train.file_hint"}}</p>
<input type="file" id="file" accept=".xlsx,.xlsm,.csv,.tsv,.txt,.jsonl,.ndjson,.json">
<p id="found" class="note" aria-live="polite"></p>
<table id="sample" class="compact train-sample" hidden>
<thead><tr><th>{{t "train.question"}}</th><th>{{t "train.answer"}}</th></tr></thead><tbody></tbody>
</table>
</div>
<div class="step">
<h2>{{t "train.step.model"}}</h2>
<label>{{t "train.base"}}
<select id="model">{{range .Models}}<option>{{.}}</option>{{end}}</select></label>
<label>{{t "train.name"}} <span class="opt">{{t "train.name_hint"}}</span>
<input type="text" id="name" maxlength="100" pattern="[A-Za-z0-9][A-Za-z0-9._\-]*" required></label>
</div>
<div class="step">
<h2>{{t "train.step.who"}}</h2>
{{if gt (len .Projects) 1}}
<label>{{t "train.project"}}
<select id="project">{{range .Projects}}<option value="{{.Value}}">{{.Label}}</option>{{end}}</select></label>
{{else}}{{with index .Projects 0}}<input type="hidden" id="project" value="{{.Value}}">
<p class="note">{{t "train.project"}}: {{.Label}}</p>{{end}}{{end}}
<label>{{t "train.share"}}
<select id="share">
<option value="me">{{t "train.share.me"}}</option>
<option value="project" selected>{{t "train.share.project"}}</option>
<option value="team">{{t "train.share.team"}}</option>
<option value="org">{{t "train.share.org"}}</option>
<option value="all">{{t "train.share.all"}}</option>
</select></label>
<label class="train-confirm" id="confirm-row" hidden><input type="checkbox" id="agree"> {{t "train.confirm"}}</label>
</div>
<div><button type="submit" id="go">{{t "train.go"}}</button></div>
<p id="status" class="note" aria-live="polite"></p>
</form>
{{end}}
<h2>{{t "train.jobs"}}</h2>
<table id="jobs" class="compact">
<thead><tr><th>{{t "train.col.name"}}</th><th>{{t "train.col.state"}}</th><th>{{t "train.col.share"}}</th><th></th></tr></thead>
<tbody></tbody>
</table>
<p id="nojobs" class="empty" hidden>{{t "train.no_jobs"}}</p>
<p class="note">{{t "train.after"}}</p>
<footer><span>llmgw {{.Version}}</span><span>{{stamp .Now}}</span>{{template "langs"}}</footer>
</div>
<script>
const say = {
found: {{t "train.js.found"}},
skipped: {{t "train.js.skipped"}},
few: {{t "train.js.few"}},
noFile: {{t "train.js.no_file"}},
noName: {{t "train.js.no_name"}},
needConfirm: {{t "train.js.need_confirm"}},
started: {{t "train.js.started"}},
failed: {{t "train.js.failed"}},
queued: {{t "train.js.queued"}},
waiting: {{t "train.js.waiting"}},
preparing: {{t "train.js.preparing"}},
running: {{t "train.js.running"}},
publishing: {{t "train.js.publishing"}},
ready: {{t "train.js.ready"}},
restarting: {{t "train.js.restarting"}},
notPublished: {{t "train.js.not_published"}},
jobFailed: {{t "train.js.job_failed"}},
cancelled: {{t "train.js.cancelled"}},
del: {{t "train.js.delete"}},
delAsk: {{t "train.js.delete_ask"}},
shareAsk: {{t "train.js.share_ask"}},
tryIt: {{t "train.js.try"}},
by: {{t "train.js.by"}},
shares: { me: {{t "train.share.me"}}, project: {{t "train.share.project"}}, team: {{t "train.share.team"}},
org: {{t "train.share.org"}}, all: {{t "train.share.all"}}, other: {{t "train.share.other"}} },
};
function fill(s, vals) { return s.replace(/\{(\w+)\}/g, (m, k) => (k in vals ? String(vals[k]) : m)); }
(function () {
const csrf = document.querySelector('meta[name="csrf"]').content;
const $ = (id) => document.getElementById(id);
const wide = (s) => s === "team" || s === "org" || s === "all";
async function post(url, data) {
const resp = await fetch(url, { method: "POST", headers: { "X-CSRF-Token": csrf }, body: data });
const j = await resp.json().catch(() => ({}));
if (!resp.ok) throw new Error(j.error || String(resp.status));
return j;
}
const form = $("start");
if (form) {
const file = $("file"), found = $("found"), sample = $("sample"), status = $("status"), go = $("go");
let pairs = 0;
file.addEventListener("change", async () => {
const f = file.files[0];
pairs = 0;
sample.hidden = true;
found.classList.remove("bad");
if (!f) { found.textContent = ""; return; }
if (!$("name").value) {
$("name").value = f.name.replace(/\.[^.]*$/, "").toLowerCase()
.replace(/[çğıöşü]/g, (c) => ({ "ç": "c", "ğ": "g", "ı": "i", "ö": "o", "ş": "s", "ü": "u" })[c])
.replace(/[^a-z0-9._-]+/g, "-").replace(/^[^a-z0-9]+|-+$/g, "").slice(0, 100);
}
const fd = new FormData();
fd.append("file", f);
try {
const j = await post("/train/preview", fd);
pairs = j.pairs;
let line = fill(say.found, { n: j.pairs });
if (j.skipped) line += " " + fill(say.skipped, { n: j.skipped });
if (j.pairs < 50) line += " " + say.few;
found.textContent = line;
const body = sample.tBodies[0];
body.replaceChildren();
for (const p of j.sample) {
const tr = body.insertRow();
tr.insertCell().textContent = p.q;
tr.insertCell().textContent = p.a;
}
sample.hidden = false;
} catch (err) {
found.textContent = err.message;
found.classList.add("bad");
}
});
const share = $("share"), confirmRow = $("confirm-row");
share.addEventListener("change", () => { confirmRow.hidden = !wide(share.value); });
form.addEventListener("submit", async (e) => {
e.preventDefault();
status.classList.remove("bad");
if (!file.files[0] || !pairs) { status.textContent = say.noFile; return; }
if (!$("name").value.trim()) { status.textContent = say.noName; return; }
if (wide(share.value) && !$("agree").checked) { status.textContent = say.needConfirm; return; }
const fd = new FormData();
fd.append("file", file.files[0]);
fd.append("name", $("name").value.trim());
fd.append("model", $("model").value);
fd.append("project", $("project").value);
fd.append("share", share.value);
if ($("agree").checked) fd.append("confirm", "yes");
go.disabled = true;
try {
await post("/train/start", fd);
status.textContent = say.started;
form.reset();
found.textContent = "";
sample.hidden = true;
confirmRow.hidden = true;
pairs = 0;
refresh();
} catch (err) {
status.textContent = fill(say.failed, { why: err.message });
status.classList.add("bad");
} finally {
go.disabled = false;
}
});
}
function describe(j) {
switch (j.state) {
case "queued": return j.message && j.message.startsWith("waiting") ? say.waiting : say.queued;
case "starting": case "preparing": return say.preparing;
case "running": return fill(say.running, { p: j.steps ? Math.floor(100 * j.step / j.steps) : 0, m: j.minutes });
case "done":
if (j.published) return j.message && j.message.includes("restarting") ? fill(say.restarting, { name: j.name }) : fill(say.ready, { name: j.name });
if (j.message && j.message.startsWith("trained, but")) return fill(say.notPublished, { why: j.message });
return say.publishing;
case "failed": return fill(say.jobFailed, { why: j.message || "" });
case "cancelled": return say.cancelled;
}
return j.state;
}
const over = (j) => j.state === "failed" || j.state === "cancelled" ||
(j.state === "done" && (j.published || (j.message || "").startsWith("trained, but")));
let timer = null;
async function refresh() {
clearTimeout(timer);
const resp = await fetch("/train/jobs");
const jobs = await resp.json().catch(() => []);
const body = $("jobs").tBodies[0];
body.replaceChildren();
$("nojobs").hidden = jobs.length > 0;
$("jobs").hidden = jobs.length === 0;
for (const j of jobs) {
const tr = body.insertRow();
const name = tr.insertCell();
const b = document.createElement("strong");
b.textContent = j.name;
const sub = document.createElement("div");
sub.className = "note";
sub.textContent = j.model + " · " + j.pairs + " · " + (j.project || "") + " · " + fill(say.by, { who: j.created_by });
name.append(b, sub);
const st = tr.insertCell();
st.textContent = describe(j);
if (j.state === "failed") st.classList.add("bad");
if (j.state === "running" && j.steps) {
const bar = document.createElement("div");
bar.className = "train-bar";
const fillBar = document.createElement("span");
fillBar.style.width = Math.floor(100 * j.step / j.steps) + "%";
bar.append(fillBar);
st.append(bar);
}
const sh = tr.insertCell();
const sel = document.createElement("select");
for (const k of ["me", "project", "team", "org", "all"]) {
if (!j.project && k !== "me" && k !== "all") continue;
const o = new Option(say.shares[k], k, false, j.share === k);
sel.add(o);
}
if (j.share === "other") sel.add(new Option(say.shares.other, "other", true, true));
sel.addEventListener("change", async () => {
const fd = new FormData();
fd.append("share", sel.value);
if (wide(sel.value)) {
if (!confirm(say.shareAsk)) { refresh(); return; }
fd.append("confirm", "yes");
}
try { await post("/train/jobs/" + encodeURIComponent(j.id) + "/share", fd); }
catch (err) { alert(err.message); }
refresh();
});
sh.append(sel);
const act = tr.insertCell();
if (j.published) {
const a = document.createElement("a");
a.href = "/chat";
a.className = "link";
a.textContent = say.tryIt;
act.append(a, " ");
}
const del = document.createElement("button");
del.type = "button";
del.className = "link";
del.textContent = say.del;
del.addEventListener("click", async () => {
if (!confirm(fill(say.delAsk, { name: j.name }))) return;
try { await post("/train/jobs/" + encodeURIComponent(j.id) + "/delete", new FormData()); }
catch (err) { alert(err.message); }
refresh();
});
act.append(del);
}
if (jobs.some((j) => !over(j))) timer = setTimeout(refresh, 5000);
}
refresh();
})();
</script>
</body></html>{{end}}
+34
View File
@@ -0,0 +1,34 @@
package web
import (
"net/http"
"time"
"gitea.mynodes.xyz/ilker/llmgw/internal/store"
)
type trainData struct {
Nav Nav
User store.User
Models []string
Projects []ChatContext
CSRF string
Version string
Now string
}
// Train renders the page that customises a model: a file of questions and
// answers, a model, a button, and the trainings of the person's projects.
func Train(user store.User, models []string, projects []ChatContext, version string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
noStore(w)
render(w, r, "train", trainData{
Nav: navFrom(r, "train"), User: user, Models: models, Projects: projects,
CSRF: csrfFor(r), Version: version, Now: time.Now().UTC().Format(time.RFC3339),
})
}
}
// SetTrain has the menu offer the page while a model can be customised.
// Asked on every page, so it must be cheap.
func (p *AccountPages) SetTrain(available func() bool) { p.train = available }
+49
View File
@@ -0,0 +1,49 @@
package web
import (
"net/http/httptest"
"regexp"
"strings"
"testing"
"gitea.mynodes.xyz/ilker/llmgw/internal/store"
)
var untranslated = regexp.MustCompile(`train\.[a-z]`)
func TestTheTrainingPageDrawsInEveryLanguage(t *testing.T) {
for _, lang := range []string{"en", "tr"} {
req := httptest.NewRequest("GET", "/train", nil)
req.Header.Set("Accept-Language", lang)
rec := httptest.NewRecorder()
Train(store.User{Email: "a@b.c"}, []string{"qwen2.5-7b"}, []ChatContext{{Value: "p1", Label: "Acme / hr / bot"}}, "v0")(rec, req)
if rec.Code != 200 {
t.Fatalf("%s: %d %s", lang, rec.Code, rec.Body.String())
}
page := rec.Body.String()
for _, want := range []string{`<option>qwen2.5-7b</option>`, `id="file"`, `/train/start`, `value="p1"`, `Acme / hr / bot`} {
if !strings.Contains(page, want) {
t.Errorf("%s: %s missing", lang, want)
}
}
if untranslated.MatchString(page) {
t.Errorf("%s: an untranslated key is on the page", lang)
}
}
for name, page := range map[string]func() string{
"no project": func() string {
rec := httptest.NewRecorder()
Train(store.User{}, []string{"q"}, nil, "v0")(rec, httptest.NewRequest("GET", "/train", nil))
return rec.Body.String()
},
"no model": func() string {
rec := httptest.NewRecorder()
Train(store.User{}, nil, []ChatContext{{Value: "p"}}, "v0")(rec, httptest.NewRequest("GET", "/train", nil))
return rec.Body.String()
},
} {
if p := page(); !strings.Contains(p, `class="empty"`) || strings.Contains(p, `id="start"`) {
t.Errorf("%s: the page offers training", name)
}
}
}