{{/* The limits tab of the people page. */}} {{define "limits_body"}} {{if not .BudgetsBind}} {{/* A budget is spend per period and spend comes from a price table. With no prices every request costs nothing, so these numbers read as limits and bind on nothing. Self-hosted models having no per-token price is ordinary; showing somebody a budget without saying so is not. */}} {{end}} {{if .Error}}{{end}} {{if .Message}}

{{.Message}}

{{end}} {{if .Rows}} {{/* The tree is the interface. A quota belongs to a branch, so the form to set one opens on that branch rather than asking somebody to name it again in a box at the bottom. */}} {{range .Rows}} {{if .MemberEditing}} {{end}} {{if .Editing}} {{end}} {{end}}
{{t "quotas.col.where"}}{{t "quotas.col.rpm"}}{{t "quotas.col.tpm"}} {{t "quotas.col.budget"}}{{t "quotas.col.spent"}}
{{.Path}} {{t (print "quotas.kind." .Scope)}} {{if .Models}}
{{th "quotas.only_models" .Models}}
{{else if .ModelsFrom}}
{{t "quotas.models_from" .ModelsFrom}}
{{end}} {{if .Member}}
{{t "quotas.each_member" .Member}}
{{end}} {{if .Shadowed}} {{/* A value that is written here and never reached. Resolution takes the most restrictive along the chain, so without saying so the page would show a number as though it applied. */}}
{{.Shadowed}}
{{end}}
{{template "quota-value" dict "Own" .Shown.RPM "Up" .RPMUp "From" .RPMFrom}} {{template "quota-value" dict "Own" .Shown.TPM "Up" .TPMUp "From" .TPMFrom}} {{if .Budget}}{{.Shown.Budget}}{{if .Period}}/{{.Shown.Period}}{{end}} {{else}}{{template "quota-value" dict "Up" .BudgetUp "From" .BudgetFrom}}{{end}} {{.Spend}} {{if .HasPct}} {{t "quotas.pct" .Percent}}{{end}} {{if .Editing}}{{t "quotas.close"}} {{else}}{{if .HasAny}}{{t "quotas.change"}}{{else}}{{t "quotas.set"}}{{end}}{{end}} {{if .MemberEditing}}{{t "quotas.close"}} {{else}}{{t "quotas.per_member"}}{{end}}
{{template "quota-form" (dict "Scope" (printf "%s-member" .Scope) "ID" .ID "F" .MemberRaw "CSRF" $.CSRF "Title" (t "quotas.member_form.title" .Crumb) "Note" (t "quotas.member_form.note"))}}

{{th "quotas.form.title" .Crumb}}

{{t "common.cancel"}}

{{th "quotas.legend"}}

{{else}}

{{th "quotas.empty_tree"}}

{{end}}

{{t "quotas.people.title"}}

{{t "quotas.people.note"}} {{.Personal}}

{{if .People}} {{range .People}} {{if .Editing}} {{end}} {{end}}
{{t "quotas.col.person"}}{{t "quotas.col.rpm"}}{{t "quotas.col.tpm"}} {{t "quotas.col.budget"}}{{t "quotas.col.spent"}}
{{.Email}} {{if .Models}}
{{th "quotas.only_models" .Models}}
{{end}}
{{or .Shown.RPM "—"}} {{or .Shown.TPM "—"}} {{if .Budget}}{{.Shown.Budget}}{{if .Period}}/{{.Shown.Period}}{{end}}{{else}}—{{end}} {{.Spend}} {{if .HasPct}} {{t "quotas.pct" .Percent}}{{end}} {{if .Editing}}{{t "quotas.close"}} {{else}}{{if .HasAny}}{{t "quotas.change"}}{{else}}{{t "quotas.set"}}{{end}}{{end}}
{{template "quota-form" (dict "Scope" "user" "ID" .ID "CSRF" $.CSRF "F" (dict "RPM" .RPM "TPM" .TPM "Budget" .Budget "Period" .Period "Models" .Models "HasAny" .HasAny) "Title" (t "quotas.person_form.title" .Email) "Note" (t "quotas.person_form.note"))}}
{{else}}

{{t "quotas.people.empty"}}

{{end}} {{if .HasCapacity}}

{{t "capacity.title"}}

{{t "capacity.note"}}

{{if .Capacity}} {{range .Capacity}}{{end}}
{{t "quotas.col.where"}}GPUs{{t "capacity.col.cores"}}{{t "capacity.col.memory"}}{{t "capacity.col.set_by"}}
{{or .Name .Scope}} {{or .GPUs "—"}} {{or .Cores "—"}} {{or .Memory "—"}} {{.UpdatedBy}} {{t "quotas.change"}}

{{t "capacity.legend"}}

{{else}}

{{t "capacity.empty"}}

{{end}} {{if .Scopes}}

{{if .CapForm.Scope}}{{th "capacity.form.title_change"}}{{else}}{{th "capacity.form.title_set"}}{{end}}

{{if .CapForm.Scope}}{{t "common.cancel"}}{{end}}
{{else}}

{{th "capacity.empty_tree"}}

{{end}} {{end}}
{{t "quotas.explain.summary"}}

{{t "quotas.explain.chain"}}

{{th "quotas.explain.keys"}}

{{end}} {{/* A limit as the table shows it: the row's own value, else the one it is held to from above, marked as inherited and saying from where. */}} {{/* The form for a limit that is not a branch's own: per member, or a person. */}} {{define "quota-form"}}
{{/* From a panel on the people tab: the answer comes back to that panel. */}} {{with .Sel}}{{end}}

{{th "quotas.qform.title" .Title .Note}}

{{if not .Sel}}{{t "common.cancel"}}{{end}}
{{end}} {{define "quota-value"}}{{if .Own}}{{.Own}}{{else if .Up}}{{.Up}} ↑{{else}}—{{end}}{{end}}