The mirror page's Strata tab; Strata's ready-made packs served with Strata fetching them, strata-ple named
CI / test (push) Successful in 10m35s
CI / test (push) Successful in 10m35s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4ee9ba54ef
commit
845de8eef4
13 files changed
+513
-21
No files matched your search
@@ -24,6 +24,7 @@ import (
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/safedial"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/sourcecheck"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/store"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/strata"
|
||||
)
|
||||
|
||||
// MirrorAdmin is the mirror's management API as this page needs it.
|
||||
@@ -169,6 +170,10 @@ type adminMirrorData struct {
|
||||
// the serve action is then not offered rather than offered and refused.
|
||||
HasCatalog bool
|
||||
|
||||
// Strata is the Strata tab: the models it runs, and where they would
|
||||
// run here.
|
||||
Strata *strataView
|
||||
|
||||
// The explorer.
|
||||
HasRegistry bool
|
||||
Query string
|
||||
@@ -256,6 +261,14 @@ func (p *AccountPages) RegisterAdminMirror(mux *http.ServeMux, d MirrorDeps) {
|
||||
render(w, r, "mirror_repo", d)
|
||||
}))
|
||||
|
||||
mux.HandleFunc("POST /admin/mirror/strata", p.mirrorAction(m,
|
||||
func(ctx context.Context, admin store.User, r *http.Request) (string, error) {
|
||||
if r.FormValue("action") == "serve" {
|
||||
return p.serveStrata(ctx, langOf(r), admin.Email, r.FormValue("family"), r.FormValue("size"))
|
||||
}
|
||||
return p.fetchStrata(ctx, langOf(r), m, r.FormValue("family"), r.FormValue("size"))
|
||||
}))
|
||||
|
||||
mux.HandleFunc("POST /admin/mirror/fetch", p.mirrorAction(m,
|
||||
func(ctx context.Context, admin store.User, r *http.Request) (string, error) {
|
||||
// One form posts one source or fifteen. A sharded model is one
|
||||
@@ -462,6 +475,9 @@ func (p *AccountPages) renderMirror(w http.ResponseWriter, r *http.Request,
|
||||
if d.Tab == tabExplore {
|
||||
p.explore(r, &d)
|
||||
}
|
||||
if d.Tab == tabStrata {
|
||||
d.Strata = p.strataView(l)
|
||||
}
|
||||
|
||||
got, err := m.List(r.Context())
|
||||
if err != nil {
|
||||
@@ -618,6 +634,7 @@ const (
|
||||
tabHeld = "held"
|
||||
tabExplore = "explore"
|
||||
tabFetch = "fetch"
|
||||
tabStrata = "strata"
|
||||
)
|
||||
|
||||
// mirrorTab is one of the page's tabs.
|
||||
@@ -636,7 +653,7 @@ type mirrorTab struct {
|
||||
// shown, where its effect is, unless it was refused: then the form it came
|
||||
// from, to try again.
|
||||
func mirrorTabFor(r *http.Request, errMsg string) string {
|
||||
valid := func(t string) bool { return t == tabHeld || t == tabExplore || t == tabFetch }
|
||||
valid := func(t string) bool { return t == tabHeld || t == tabExplore || t == tabFetch || t == tabStrata }
|
||||
if r.Method == http.MethodPost {
|
||||
if t := r.PostFormValue("tab"); errMsg != "" && valid(t) {
|
||||
return t
|
||||
@@ -673,6 +690,10 @@ func mirrorTabs(l *Lang, d adminMirrorData) []mirrorTab {
|
||||
tabs = append(tabs, mirrorTab{Label: l.T("mirror.tab.explore"),
|
||||
Href: "/admin/mirror?tab=explore", Active: d.Tab == tabExplore})
|
||||
}
|
||||
if d.HasRegistry {
|
||||
tabs = append(tabs, mirrorTab{Label: l.T("mirror.tab.strata"),
|
||||
Href: "/admin/mirror?tab=strata", Active: d.Tab == tabStrata})
|
||||
}
|
||||
return append(tabs, mirrorTab{Label: l.T("mirror.tab.fetch"),
|
||||
Href: "/admin/mirror?tab=fetch", Active: d.Tab == tabFetch})
|
||||
}
|
||||
@@ -823,9 +844,15 @@ func (p *AccountPages) openRepo(r *http.Request, d *adminMirrorData, repo string
|
||||
Version: got.ShortRevision(),
|
||||
}
|
||||
rs.Verdict = p.verdictFor(langOf(r), got.Architecture, set.Name)
|
||||
// A family Strata runs: one card and the experts in RAM, whether
|
||||
// or not llama.cpp could load it.
|
||||
if layout, ok := fit.strataLayout(langOf(r), got.ID, set.Name, set.Bytes); ok {
|
||||
// A pack made for Strata: served whole, from the Strata tab, when
|
||||
// Strata knows it; named for what it is when it does not.
|
||||
if fam, size, ok := strata.ForFetchedRepo(got.ID); ok {
|
||||
rs.Verdict = gguf.Verdict{Checked: true, Reason: langOf(r).T("strata.pack_files", fam.Title, size.Name)}
|
||||
} else if got.Architecture == "strata-ple" {
|
||||
rs.Verdict = gguf.Verdict{Checked: true, Reason: langOf(r).T("strata.unknown_pack")}
|
||||
} else if layout, ok := fit.strataLayout(langOf(r), got.ID, set.Name, set.Bytes); ok {
|
||||
// A family Strata runs: one card and the experts in RAM,
|
||||
// whether or not llama.cpp could load it.
|
||||
rs.Verdict, rs.GPULayout = gguf.Verdict{Checked: true, Servable: true}, layout
|
||||
} else if fit != nil && rs.Verdict.Servable {
|
||||
if v, ok := fit.holds(langOf(r), set.Name, set.Bytes, got.Params); !ok {
|
||||
|
||||
Reference in new issue
Block a user