mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-15 05:15:23 +00:00
Move libcurl init to TracyLlm.cpp.
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user