mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-18 23:05:23 +00:00
Add web cache.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user