This commit is contained in:
parent
e2f1707723
commit
0559fd2bba
5 changed files with 623 additions and 2 deletions
17
ia-main.go
17
ia-main.go
|
@ -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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue