Added Weather IA
Some checks failed
Run Integration Tests / test (push) Failing after 10m2s

This commit is contained in:
partisan 2025-06-30 08:07:57 +02:00
parent e2f1707723
commit 0559fd2bba
5 changed files with 623 additions and 2 deletions

View file

@ -38,6 +38,23 @@ func detectInstantAnswer(query string) *InstantAnswer {
}
}
// Try weather instant answer
if city, forecast, ok := getWeatherForQuery(query); ok {
return &InstantAnswer{
Type: "weather",
Title: fmt.Sprintf("Weather in %s", city.Name),
Content: map[string]interface{}{
"city": city.Name,
"country": city.Country,
"lat": city.Lat,
"lon": city.Lon,
"current": forecast.Current,
"forecast": forecast.Forecast,
"display": fmt.Sprintf("%.1f°C, %s", forecast.Current.Temperature, forecast.Current.Condition),
},
}
}
// Try Wikipedia search
if title, text, link, ok := getWikipediaSummary(query); ok {
return &InstantAnswer{