/images offers the models that make pictures, and the chat no longer offers them. Like the chat, the browser holds a session and never a key; the page's request is rebuilt from its own fields and sent down the path every /v1/images/generations request takes. Size, how many, seed, steps and a negative prompt; each picture shown with its seed, a download link and a way to make it again. Nothing is kept but the usage. The menu offers the page while some model makes pictures. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package web
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/store"
|
|
)
|
|
|
|
type imagesData struct {
|
|
Nav Nav
|
|
Contexts []ChatContext
|
|
Context string
|
|
User store.User
|
|
Models []ChatModel
|
|
CSRF string
|
|
Version string
|
|
Now string
|
|
}
|
|
|
|
// Images renders the page that makes pictures, for one signed-in person.
|
|
// Its models are those that make them, as the chat's are those that write.
|
|
func Images(user store.User, models []ChatModel, contexts []ChatContext, current, version string) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
noStore(w)
|
|
render(w, r, "images", imagesData{
|
|
Nav: navFrom(r, "images"),
|
|
Contexts: contexts, Context: current,
|
|
User: user, Models: models, CSRF: csrfFor(r),
|
|
Version: version, Now: time.Now().UTC().Format(time.RFC3339),
|
|
})
|
|
}
|
|
}
|
|
|
|
// SetImages has the menu offer the pictures page while some model makes
|
|
// them. Asked on every page, so it must be cheap: the catalog, not a request.
|
|
func (p *AccountPages) SetImages(available func() bool) { p.images = available }
|