Help us shape the future of Go! Take the 2026 Go Developer Survey

web

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package web is the operator dashboard: server-rendered HTML with HTMX for partial updates and an SSE feed for live refresh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelView

type ChannelView struct {
	sqlcgen.Channel
	InFlight     int64
	ModelList    []string
	AvgLatencyMs int64
	TokenName    string
	Closed       bool
}

ChannelView decorates a channel.

type ChartBar

type ChartBar struct {
	Label                    string
	Total, Completed, Failed int64
	X, W, Y, H               float64
	YOk, HOk, YFail, HFail   float64
}

ChartBar is one bucket in the throughput chart.

type ChartLabel

type ChartLabel struct {
	X    float64
	Text string
}

ChartLabel is an x-axis label.

type ChartView

type ChartView struct {
	Bars   []ChartBar
	Labels []ChartLabel
	W, H   int
	Max    int64
}

ChartView renders buckets as an SVG bar chart.

type Counts

type Counts struct{ Queued, InFlight, Online int64 }

Counts are the live gauges shown in the sidebar.

type EventTable

type EventTable struct {
	Rows  []EventView
	Pager Pager
	ID    string
	URL   string
}

EventTable is the data for the event-table partial.

type EventView

type EventView struct {
	sqlcgen.Event
	Payload    map[string]any
	DataPretty string
}

EventView decorates an event.

type Flash

type Flash struct{ Kind, Message string }

Flash is a one-shot message shown at the top of the next page.

type MessageView

type MessageView struct {
	Role       string
	Text       string
	Name       string
	ToolCallID string
	ToolCalls  []openai.ToolCall
	Index      int
}

MessageView is one chat message.

type Page

type Page struct {
	Title    string
	Nav      string
	Instance string
	Version  string
	CSRF     string
	Path     string
	Flash    *Flash
	Counts   Counts
	Now      time.Time
}

Page is embedded by every page view.

type Pager

type Pager struct {
	Page    int
	Pages   int
	Total   int64
	PerPage int
	Base    string
}

Pager paginates a list. Base is the path plus query (without page=), ending in '?' or '&'.

func (Pager) Next

func (p Pager) Next() int

func (Pager) Offset

func (p Pager) Offset() int64

Offset is the row offset for the current page.

func (Pager) Prev

func (p Pager) Prev() int

Prev and Next are the neighbouring pages.

func (Pager) Range

func (p Pager) Range() []int

Range is a window of page numbers around the current one.

func (Pager) URL

func (p Pager) URL(n int) string

URL links to page n.

type RequestTable

type RequestTable struct {
	Rows             []RequestView
	Pager            Pager
	ID               string
	URL              string
	ShowKey          bool
	ShowChannel      bool
	ShowConversation bool
	EmptyText        string
}

RequestTable is the data for the request-table partial.

type RequestView

type RequestView struct {
	sqlcgen.Request
	KeyName       string
	ChannelName   string
	Prompt        string
	Answer        string
	LatencyMs     int64
	QueueMs       int64
	TTFTMs        int64
	ToolCallCount int
}

RequestView decorates a request row for templates.

type Server

type Server struct {
	DBPath string
	// contains filtered or unexported fields
}

Server serves the dashboard.

func New

func New(svc *core.Service, log *slog.Logger, dbPath string) (*Server, error)

New parses templates and builds the server.

func (*Server) Register

func (s *Server) Register(mux *http.ServeMux)

Register mounts the dashboard routes.

func (*Server) RequireSession

func (s *Server) RequireSession(next http.Handler) http.Handler

RequireSession guards handlers with the dashboard login. It is exported so the OAuth consent screen can reuse it.

type TurnView

type TurnView struct {
	Request   RequestView
	Messages  []MessageView
	Answer    *openai.Answer
	HasAnswer bool
}

TurnView is one exchange in a reconstructed conversation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL