Improved Wikipedia IA to be lang specific
Some checks failed
Run Integration Tests / test (push) Failing after 40s
Some checks failed
Run Integration Tests / test (push) Failing after 40s
This commit is contained in:
parent
89264b0f87
commit
41f7eb4357
2 changed files with 10 additions and 21 deletions
18
ia-main.go
18
ia-main.go
|
@ -56,7 +56,7 @@ func detectInstantAnswer(query string) *InstantAnswer {
|
|||
}
|
||||
|
||||
// Try Wikipedia search
|
||||
if title, text, link, ok := getWikipediaSummary(query); ok {
|
||||
if title, text, link, ok := getWikipediaSummary(query, settings.SiteLanguage); ok {
|
||||
return &InstantAnswer{
|
||||
Type: "wiki",
|
||||
Title: title,
|
||||
|
@ -71,29 +71,17 @@ func detectInstantAnswer(query string) *InstantAnswer {
|
|||
}
|
||||
|
||||
func initExchangeRates() {
|
||||
// Initial synchronous load
|
||||
// Initial sync
|
||||
if err := UpdateExchangeRates(); err != nil {
|
||||
printErr("Initial exchange rate update failed: %v", err)
|
||||
} else {
|
||||
PrecacheAllCurrencyPairs()
|
||||
}
|
||||
|
||||
// Pre-cache common wiki terms in background
|
||||
go func() {
|
||||
commonTerms := []string{"United States", "Europe", "Technology", "Science", "Mathematics"}
|
||||
for _, term := range commonTerms {
|
||||
getWikipediaSummary(term)
|
||||
}
|
||||
}()
|
||||
|
||||
// Periodically update cache
|
||||
// Periodic update only
|
||||
ticker := time.NewTicker(30 * time.Minute)
|
||||
go func() {
|
||||
for range ticker.C {
|
||||
if err := UpdateExchangeRates(); err != nil {
|
||||
printWarn("Periodic exchange rate update failed: %v", err)
|
||||
} else {
|
||||
PrecacheAllCurrencyPairs()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue