Add server-side rendered setup UI accessible via `heatwave web`. The dashboard is now re-rendered per request and includes a nav bar linking to the new /setup page. Setup provides full CRUD for profiles, rooms, devices, occupants, AC units (with room assignment), scenario toggles, and forecast fetching — all via POST/redirect/GET forms. - Add ShowNav field to DashboardData for conditional nav bar - Extract fetchForecastForProfile() for reuse by web handler - Create setup.html.tmpl with Tailwind-styled entity sections - Create web_handlers.go with 15 route handlers and flash cookies - Switch web.go from pre-rendered to per-request dashboard rendering - Graceful dashboard fallback when no forecast data exists
72 lines
1.6 KiB
Go
72 lines
1.6 KiB
Go
package llm
|
|
|
|
import "context"
|
|
|
|
// Provider is the interface for LLM backends.
|
|
type Provider interface {
|
|
Summarize(ctx context.Context, input SummaryInput) (string, error)
|
|
RewriteAction(ctx context.Context, action ActionInput) (string, error)
|
|
GenerateHeatPlan(ctx context.Context, input HeatPlanInput) (string, error)
|
|
Name() string
|
|
}
|
|
|
|
// HeatSource represents a ranked heat source for summary.
|
|
type HeatSource struct {
|
|
Name string
|
|
Watts float64
|
|
}
|
|
|
|
// RiskWindowSummary is a simplified risk window for LLM input.
|
|
type RiskWindowSummary struct {
|
|
StartHour int
|
|
EndHour int
|
|
PeakTempC float64
|
|
Level string
|
|
}
|
|
|
|
// SummaryInput holds computed data for the 3-bullet summary.
|
|
type SummaryInput struct {
|
|
Date string
|
|
PeakTempC float64
|
|
MinNightTempC float64
|
|
RiskLevel string
|
|
TopHeatSources []HeatSource
|
|
ACHeadroomBTUH float64
|
|
BudgetStatus string
|
|
ActiveWarnings []string
|
|
RiskWindows []RiskWindowSummary
|
|
}
|
|
|
|
// ActionInput holds data for rewriting a technical action.
|
|
type ActionInput struct {
|
|
ActionName string
|
|
Description string
|
|
TempC float64
|
|
Hour int
|
|
}
|
|
|
|
// TimelineSlotSummary is a simplified timeline slot for LLM input.
|
|
type TimelineSlotSummary struct {
|
|
Hour int
|
|
TempC float64
|
|
RiskLevel string
|
|
BudgetStatus string
|
|
Actions []string
|
|
}
|
|
|
|
// ActionSummary is a simplified action for LLM input.
|
|
type ActionSummary struct {
|
|
Name string
|
|
Category string
|
|
Impact string
|
|
Hour int
|
|
}
|
|
|
|
// HeatPlanInput holds full day data for the 1-page plan.
|
|
type HeatPlanInput struct {
|
|
Summary SummaryInput
|
|
Timeline []TimelineSlotSummary
|
|
Actions []ActionSummary
|
|
CareChecklist []string
|
|
}
|