mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Formatted src/services/enrichment/wikipedia
This commit is contained in:
@@ -21,10 +21,10 @@ std::string WikipediaEnrichmentService::FetchExtract(std::string_view query) {
|
|||||||
if (const auto cache_it = this->extract_cache_.find(cache_key);
|
if (const auto cache_it = this->extract_cache_.find(cache_key);
|
||||||
cache_it != this->extract_cache_.end()) {
|
cache_it != this->extract_cache_.end()) {
|
||||||
if (logger_) {
|
if (logger_) {
|
||||||
logger_->Log(
|
logger_->Log({.level = LogLevel::Debug,
|
||||||
{.level = LogLevel::Debug,
|
|
||||||
.phase = PipelinePhase::Enrichment,
|
.phase = PipelinePhase::Enrichment,
|
||||||
.message = std::format("Wikipedia: Cache hit for {}!", cache_key)});
|
.message = std::format("Wikipedia: Cache hit for {}!",
|
||||||
|
cache_key)});
|
||||||
}
|
}
|
||||||
return cache_it->second;
|
return cache_it->second;
|
||||||
}
|
}
|
||||||
@@ -121,10 +121,10 @@ std::string WikipediaEnrichmentService::FetchExtract(std::string_view query) {
|
|||||||
// Handle 404/Missing status
|
// Handle 404/Missing status
|
||||||
if (page.contains("missing")) {
|
if (page.contains("missing")) {
|
||||||
if (logger_) {
|
if (logger_) {
|
||||||
logger_->Log(
|
logger_->Log({.level = LogLevel::Warn,
|
||||||
{.level = LogLevel::Warn,
|
|
||||||
.phase = PipelinePhase::Enrichment,
|
.phase = PipelinePhase::Enrichment,
|
||||||
.message = std::format("WikipediaService: Page '{}' does not exist",
|
.message = std::format(
|
||||||
|
"WikipediaService: Page '{}' does not exist",
|
||||||
std::string(query))});
|
std::string(query))});
|
||||||
}
|
}
|
||||||
this->extract_cache_.emplace(cache_key, "");
|
this->extract_cache_.emplace(cache_key, "");
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include "services/enrichment/wikipedia_service.h"
|
#include "services/enrichment/wikipedia_service.h"
|
||||||
|
|
||||||
std::string WikipediaEnrichmentService::GetLocationContext(
|
std::string WikipediaEnrichmentService::GetLocationContext(const City& loc) {
|
||||||
const City& loc) {
|
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
if (!this->client_) {
|
if (!this->client_) {
|
||||||
if (logger_) {
|
if (logger_) {
|
||||||
@@ -53,10 +52,10 @@ std::string WikipediaEnrichmentService::GetLocationContext(
|
|||||||
|
|
||||||
} catch (const std::runtime_error& e) {
|
} catch (const std::runtime_error& e) {
|
||||||
if (logger_) {
|
if (logger_) {
|
||||||
logger_->Log(
|
logger_->Log({.level = LogLevel::Debug,
|
||||||
{.level = LogLevel::Debug,
|
|
||||||
.phase = PipelinePhase::Enrichment,
|
.phase = PipelinePhase::Enrichment,
|
||||||
.message = std::format("WikipediaService lookup failed for '{}': {}",
|
.message = std::format(
|
||||||
|
"WikipediaService lookup failed for '{}': {}",
|
||||||
location_query, e.what())});
|
location_query, e.what())});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user