Open a repository beneath its row in the mirror's listing

Clicking a repository in the explorer shows its card and files in a row
beneath it, fetched from /admin/mirror/repo, and a second click closes
it; the list stays where it was. The link still leads to the
repository's own page without script or with a modifier key.

A repository's files now take one line each, and an importance matrix
published beside the quantisations is marked as not a model rather than
offered for fetching.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-09-28 22:11:38 +02:00
1 parent 3fea39feb9
commit ff86e52126
4 files changed
+211 -69

No files matched your search

+78 -35
View File
@@ -214,8 +214,8 @@ document.addEventListener('click', function (e) {
<table class="explore">
<tr><th>Repository</th><th class="num">Size</th><th>Architecture</th><th class="num">Context</th>
<th class="num">Downloads</th><th class="num">Likes</th><th class="num">Updated</th></tr>
{{range .Rows}}<tr>
<td><a href="{{.Href}}"><code>{{.ID}}</code></a>
{{range .Rows}}<tr class="explore-row">
<td><a href="{{.Href}}" class="open-repo" data-repo="{{.ID}}" aria-expanded="false"><code>{{.ID}}</code></a>
{{if .New}}<span class="tag new">new</span>{{end}}{{if .Gated.Is}}<span class="tag">gated</span>{{end}}
{{if or .BaseModel .License}}<div class="from">{{with .BaseModel}}from {{.}}{{end}}{{if and .BaseModel .License}} · {{end}}{{.License}}</div>{{end}}</td>
<td class="num">{{.ParamsLabel}}</td>
@@ -226,6 +226,44 @@ document.addEventListener('click', function (e) {
<td class="num">{{.Age}}</td>
</tr>{{end}}
</table>
<script>
// A repository opens beneath its row rather than replacing the list: the
// list is what somebody is choosing from, and losing it to read one card
// means finding their place again for the next. The link still goes to the
// repository's own page when this does not run, or with a modifier key.
document.querySelector("table.explore").addEventListener("click", async function (e) {
const a = e.target.closest("a.open-repo");
if (!a || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
e.preventDefault();
const row = a.closest("tr");
let detail = row.nextElementSibling;
if (detail && detail.classList.contains("repo-detail")) {
detail.hidden = !detail.hidden;
a.setAttribute("aria-expanded", String(!detail.hidden));
row.classList.toggle("open", !detail.hidden);
return;
}
detail = document.createElement("tr");
detail.className = "repo-detail";
const td = document.createElement("td");
td.colSpan = row.children.length;
td.textContent = "Loading…";
detail.appendChild(td);
row.after(detail);
row.classList.add("open");
a.setAttribute("aria-expanded", "true");
try {
const resp = await fetch("/admin/mirror/repo?repo=" + encodeURIComponent(a.dataset.repo));
const text = await resp.text();
if (!resp.ok) { td.textContent = text.slice(0, 300); td.classList.add("error-row"); return; }
// Our own server's rendering of the repository, the card already
// stripped of anything that runs: the same HTML the full page shows.
td.innerHTML = text;
} catch (err) {
td.textContent = "Could not load it: " + err;
}
});
</script>
{{if .Hidden}}<p class="note">{{.Hidden}} more {{if eq .Hidden 1}}is{{else}}are{{end}} hidden: their architecture is one the nodes' llama.cpp cannot load.
Untick “only what these nodes can run” to see them.</p>{{end}}
<p class="note">A gated repository needs its terms accepted with a Hugging Face
@@ -237,10 +275,43 @@ directory, or give the mirror a token.</p>
{{end}}
{{end}}{{end}}
{{if .Repo}}
<p><a href="{{.Back}}">← back to the list</a></p>
<h3>{{.Repo.ID}} <span class="opt">at {{.Repo.ShortRevision}}</span></h3>
{{if .Repo}}{{template "mirror_repo" .}}{{end}}
{{end}}
<h2>Fetch a model</h2>
<p class="note">By hand, for anything the search does not reach.</p>
<form method="post" action="/admin/mirror/fetch">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<label>Source URL
<input type="text" name="source" required
placeholder="https://huggingface.co/…/resolve/main/model.gguf"></label>
<div class="field-row">
<label>Model <input type="text" name="model" required placeholder="qwen2.5-coder-7b"></label>
<label>Version <input type="text" name="version" required placeholder="2026-09"></label>
<label>File <span class="opt">optional</span>
<input type="text" name="file" placeholder="taken from the URL"></label>
</div>
<label class="inline-check"><input type="checkbox" name="force" value="1">
Fetch anyway <span class="opt">even if the nodes' llama.cpp cannot load it</span></label>
<button type="submit">Start download</button>
</form>
<p class="note">The mirror answers as soon as the download is under way, not when
it finishes — a model is tens of gigabytes and nothing here holds a connection
open for that. The row above will show it arriving. A version is never
overwritten: fetching into one that exists is refused, so a new build is a new
version and the old weights stay where they are.</p>
{{end}}
<footer><span>llmgw {{.Version}}</span><span>{{.Now}}</span></footer>
</div></body></html>{{end}}
{{/* One repository: its card and its files. The whole page when opened by
address, and the row beneath a listing entry when opened from the list. */}}
{{define "mirror_repo"}}
{{if not .Inline}}<p><a href="{{.Back}}">← back to the list</a></p>
<h3>{{.Repo.ID}} <span class="opt">at {{.Repo.ShortRevision}}</span></h3>{{end}}
<p class="repo-meta">
{{if .Inline}}<span>at <code>{{.Repo.ShortRevision}}</code></span>{{end}}
{{with .Repo.BaseModel}}<span>from {{range $i, $b := .}}{{if $i}}, {{end}}<code>{{$b}}</code>{{end}}</span>{{end}}
{{with .Repo.License}}<span>license {{.}}</span>{{end}}
{{with .Repo.Languages}}<span>{{join .}}</span>{{end}}
@@ -253,8 +324,8 @@ directory, or give the mirror a token.</p>
</details>
{{end}}
{{if .RepoSets}}
<table>
<tr><th>What</th><th>Size</th><th>Published checksum</th><th></th></tr>
<table class="repo-files">
<tr><th>What</th><th class="num">Size</th><th>Published checksum</th><th></th></tr>
{{range .RepoSets}}<tr>
<td><code>{{.Name}}</code>
{{if .Shards}}<span class="opt">{{.Shards}} shards, fetched together</span>{{end}}</td>
@@ -292,31 +363,3 @@ computes once it has it.</p>
<p class="empty">No weight files in {{.Repo.ID}}.</p>
{{end}}
{{end}}
{{end}}
<h2>Fetch a model</h2>
<p class="note">By hand, for anything the search does not reach.</p>
<form method="post" action="/admin/mirror/fetch">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<label>Source URL
<input type="text" name="source" required
placeholder="https://huggingface.co/…/resolve/main/model.gguf"></label>
<div class="field-row">
<label>Model <input type="text" name="model" required placeholder="qwen2.5-coder-7b"></label>
<label>Version <input type="text" name="version" required placeholder="2026-09"></label>
<label>File <span class="opt">optional</span>
<input type="text" name="file" placeholder="taken from the URL"></label>
</div>
<label class="inline-check"><input type="checkbox" name="force" value="1">
Fetch anyway <span class="opt">even if the nodes' llama.cpp cannot load it</span></label>
<button type="submit">Start download</button>
</form>
<p class="note">The mirror answers as soon as the download is under way, not when
it finishes — a model is tens of gigabytes and nothing here holds a connection
open for that. The row above will show it arriving. A version is never
overwritten: fetching into one that exists is refused, so a new build is a new
version and the old weights stay where they are.</p>
{{end}}
<footer><span>llmgw {{.Version}}</span><span>{{.Now}}</span></footer>
</div></body></html>{{end}}