Move libcurl init to TracyLlm.cpp.

This commit is contained in:
Bartosz Taudul
2025-05-20 20:09:51 +02:00
parent 0f78084f8f
commit a4418bf50b
2 changed files with 9 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
#include <curl/curl.h>
#include <ollama.hpp>
#include <stdint.h>
#include <stdlib.h>
@@ -26,6 +27,14 @@ TracyLlm::TracyLlm()
{
if( !s_config.llm ) return;
static bool initialized = false;
if( !initialized )
{
initialized = true;
curl_global_init( CURL_GLOBAL_ALL );
atexit( curl_global_cleanup );
}
try
{
m_ollama = std::make_unique<Ollama>( s_config.llmAddress );

View File

@@ -113,14 +113,6 @@ std::string TracyLlmTools::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 )
{
initialized = true;
curl_global_init( CURL_GLOBAL_ALL );
atexit( curl_global_cleanup );
}
auto curl = curl_easy_init();
if( !curl ) return "Error: Failed to initialize cURL";