Replace CLI + SQLite architecture with a Go web server + vanilla JS frontend using IndexedDB for all client-side data storage. - Remove: cli, store, report, static packages - Add: compute engine (BuildDashboard), server package, web UI - Add: setup page with CRUD for profiles, rooms, devices, occupants, AC - Add: dashboard with SVG temperature timeline, risk analysis, care checklist - Add: i18n support (English/German) with server-side Go templates - Add: LLM provider selection UI with client-side API key storage - Add: per-room indoor temperature, edit buttons, language-aware AI summary
73 lines
1.7 KiB
Go
73 lines
1.7 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
|
|
Language string
|
|
}
|
|
|
|
// 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
|
|
}
|