e030466cac
- New internal/weather/ package: Provider interface, Weather struct, StubProvider - OpenMeteoProvider with geocoding + current weather (keyless, free API) - Config: WeatherConfig in VoiceConfig (provider, default_location) - Wire in voice.go as weatherProvider on reactiveHandler - Handle weather queries in IntentQuery (before notes RAG) - Helper: isWeatherQuery / extractWeatherLocation - Tests: mocked HTTP round-trip for OpenMeteo, stub ErrNotConfigured, config tests - No real network calls in any test Co-Authored-By: opencode <opencode@anthropic.com>
27 lines
582 B
Go
27 lines
582 B
Go
package weather
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
var ErrNotConfigured = errors.New("weather: not configured")
|
|
|
|
type Weather struct {
|
|
Location string `json:"location"`
|
|
Temperature float64 `json:"temperature"`
|
|
Condition string `json:"condition"`
|
|
}
|
|
|
|
type Provider interface {
|
|
CurrentWeather(ctx context.Context, location string) (Weather, error)
|
|
}
|
|
|
|
type StubProvider struct{}
|
|
|
|
func NewStubProvider() *StubProvider { return &StubProvider{} }
|
|
|
|
func (s *StubProvider) CurrentWeather(_ context.Context, location string) (Weather, error) {
|
|
return Weather{}, ErrNotConfigured
|
|
}
|