mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-04-05 18:09:04 +00:00
Introduce a pluggable web client interface and concrete CURL implementation: adds IWebClient, CURLWebClient, and CurlGlobalState (headers + curl_web_client.cpp). DataDownloader now accepts an IWebClient and delegates downloads. Add WikipediaService for cached Wikipedia summary lookups. Refactor SqliteDatabase to return full City records and update consumers accordingly. Improve JsonLoader to use batched transactions during streaming parses. Enhance LlamaGenerator with sampling options, increased token limits, JSON extraction/validation, and other parsing helpers. Modernize CMake: set policy/version, add project_options, simplify FetchContent usage (spdlog), require Boost components (program_options/json), list pipeline sources explicitly, and tweak post-build/memcheck targets. Update README to match implementation changes and new CLI/config conventions.
25 lines
739 B
C++
25 lines
739 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <unordered_map>
|
|
|
|
#include "web_client.h"
|
|
|
|
/// @brief Provides cached Wikipedia summary lookups for city and country pairs.
|
|
class WikipediaService {
|
|
public:
|
|
/// @brief Creates a new Wikipedia service with the provided web client.
|
|
explicit WikipediaService(std::shared_ptr<IWebClient> client);
|
|
|
|
/// @brief Returns the Wikipedia summary extract for city and country.
|
|
[[nodiscard]] std::string GetSummary(std::string_view city,
|
|
std::string_view country);
|
|
|
|
private:
|
|
std::string FetchExtract(std::string_view query);
|
|
std::shared_ptr<IWebClient> client_;
|
|
std::unordered_map<std::string, std::string> cache_;
|
|
};
|