Add web cache.

This commit is contained in:
Bartosz Taudul
2025-05-17 13:07:02 +02:00
parent 82b976b1ee
commit 72de3ecaa7
2 changed files with 6 additions and 0 deletions

View File

@@ -852,6 +852,9 @@ static size_t WriteFn( void* _data, size_t size, size_t num, void* ptr )
std::string TracyLlm::FetchWebPage( const std::string& url )
{
auto it = m_webCache.find( url );
if( it != m_webCache.end() ) return it->second;
static bool initialized = false;
if( !initialized )
{
@@ -884,6 +887,7 @@ std::string TracyLlm::FetchWebPage( const std::string& url )
{
response = std::move( buf );
}
m_webCache.emplace( url, response );
curl_easy_cleanup( curl );
return response;

View File

@@ -128,6 +128,8 @@ private:
std::unique_ptr<ollama::messages> m_chat;
unordered_flat_map<size_t, ChatCache> m_chatCache;
unordered_flat_map<std::string, std::string> m_webCache;
ImFont* m_font;
ImFont* m_smallFont;
ImFont* m_bigFont;