Search Hugging Face from the console and serve what is found
Serve a model is a view of the registry's GGUF models, trending or searched; Enter on one lists its files, and the one chosen is served with llmgw ctl model serve. A form of one field is applied by Enter on it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6a7b4bb6a0
commit
2bf43ed90c
5 files changed
+300
-31
No files matched your search
@@ -20,6 +20,7 @@ import (
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/config"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/control/adminapi"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/docgen"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/hf"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/settings"
|
||||
)
|
||||
|
||||
@@ -151,6 +152,7 @@ type consoleModel struct {
|
||||
st *storeHolder
|
||||
people peopleData
|
||||
mirror consoleMirrorMsg
|
||||
hf hfState
|
||||
}
|
||||
|
||||
var usageGroupings = []string{"team", "project", "org"}
|
||||
@@ -286,6 +288,21 @@ func (m consoleModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.logs = msg
|
||||
case consoleMirrorMsg:
|
||||
m.mirror = msg
|
||||
case consoleHFMsg:
|
||||
if msg.query == m.hf.query && msg.sort == m.hf.sort {
|
||||
m.hf.models, m.hf.err = msg.models, msg.err
|
||||
if m.hf.models == nil && msg.err == nil {
|
||||
m.hf.models = []hf.Model{}
|
||||
}
|
||||
}
|
||||
case consoleRepoMsg:
|
||||
m.busy = ""
|
||||
if msg.err != nil {
|
||||
m.dialog, m.dialogTitle = "error", "Hugging Face"
|
||||
m.dialogText = sBad.Render("✗ ") + msg.err.Error() + "\n\n" + sDim.Render("any key")
|
||||
} else {
|
||||
m.menuD = m.repoMenu(msg.repo)
|
||||
}
|
||||
case consolePeopleMsg:
|
||||
m.people = peopleData(msg)
|
||||
case consoleQuotasMsg:
|
||||
@@ -366,7 +383,7 @@ func (m consoleModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
return m.ask("Replicate the store", "user@address of database machine", 2)
|
||||
case cLeave:
|
||||
return m.leave()
|
||||
case cServe, cUpgrade, cRestartAll, cBackup:
|
||||
case cUpgrade, cRestartAll, cBackup:
|
||||
return m, m.doEntry()
|
||||
case cOverview:
|
||||
return m, nil
|
||||
@@ -408,6 +425,8 @@ func (m consoleModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
m.menuD = m.quotaMenu(m.quotas[m.row])
|
||||
case cMirror:
|
||||
m.menuD = m.mirrorMenu(m.mirror.res.Models[m.row])
|
||||
case cServe:
|
||||
return m, m.fetchRepo(m.hf.models[m.row].ID)
|
||||
case cAccounts:
|
||||
m.menuD = m.userMenu(m.people.users[m.row])
|
||||
case cKeys:
|
||||
@@ -415,6 +434,16 @@ func (m consoleModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
case cOrgs:
|
||||
m.menuD = m.orgMenu(m.people.orgs[m.row])
|
||||
}
|
||||
case "/":
|
||||
if m.menu == cServe {
|
||||
m.hfSearchDialog()
|
||||
}
|
||||
case "s":
|
||||
if m.menu == cServe {
|
||||
m.hf.sort = (m.hf.sort + 1) % len(hfSorts)
|
||||
m.hf.models, m.hf.err, m.row = nil, nil, 0
|
||||
return m, m.fetchHF()
|
||||
}
|
||||
case "a":
|
||||
switch m.menu {
|
||||
case cQuotas:
|
||||
@@ -456,6 +485,10 @@ func (m consoleModel) onEnter() tea.Cmd {
|
||||
return m.fetchQuotas()
|
||||
case cMirror:
|
||||
return m.fetchMirror()
|
||||
case cServe:
|
||||
if m.hf.models == nil {
|
||||
return m.fetchHF()
|
||||
}
|
||||
case cAccounts, cKeys, cOrgs:
|
||||
// The quotas too, for an organization's quota form.
|
||||
return tea.Batch(m.fetchPeople(), m.fetchQuotas())
|
||||
@@ -766,6 +799,8 @@ func (m consoleModel) rowCount() int {
|
||||
return len(m.quotas)
|
||||
case cMirror:
|
||||
return len(m.mirror.res.Models)
|
||||
case cServe:
|
||||
return len(m.hf.models)
|
||||
case cAccounts:
|
||||
return len(m.people.users)
|
||||
case cKeys:
|
||||
@@ -966,6 +1001,8 @@ func (m consoleModel) panel() (title, body, keys string) {
|
||||
return m.peoplePanel(pw)
|
||||
case cMirror:
|
||||
return m.mirrorPanel(pw)
|
||||
case cServe:
|
||||
return m.hfPanel(pw)
|
||||
case cSettings:
|
||||
return m.settingsPanel(pw)
|
||||
}
|
||||
@@ -978,9 +1015,6 @@ func (m consoleModel) panel() (title, body, keys string) {
|
||||
item = "\n Moves the store onto two machines under Patroni, replicated,\n so losing one loses nothing.\n\n " +
|
||||
sDim.Render("On the command line:") +
|
||||
"\n sudo --preserve-env=SSH_AUTH_SOCK llmgw server init \\\n --patroni <user>@<a> --patroni <user>@<b> --no-mirror --no-node --no-model"
|
||||
case cServe:
|
||||
item = "\n Takes a GGUF model from Hugging Face to a replica that answers:\n the mirror fetches it, its checksum and memory are checked, it joins\n the catalog, and a replica is started and asked to say hello.\n\n " +
|
||||
sDim.Render("On the command line:") + "\n llmgw ctl model serve OWNER/REPO"
|
||||
case cUpgrade:
|
||||
item = "\n Moves the cluster to a release: this machine first, then each node\n in turn. Engines keep serving; a node that does not come back stops it.\n\n " +
|
||||
sDim.Render("On the command line:") + "\n sudo llmgw ctl upgrade VERSION"
|
||||
|
||||
Reference in new issue
Block a user