mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-14 21:05:40 +00:00
Do not repeatedly probe for LLM provider type.
This commit is contained in:
@@ -61,7 +61,7 @@ bool TracyLlmApi::Connect( const char* url )
|
||||
m_models.emplace_back( LlmModel { .name = id } );
|
||||
|
||||
std::string buf2;
|
||||
if( GetRequest( m_url + "/api/v0/models/" + id, buf2 ) == 200 )
|
||||
if( ( m_type == Type::Unknown || m_type == Type::LmStudio ) && GetRequest( m_url + "/api/v0/models/" + id, buf2 ) == 200 )
|
||||
{
|
||||
m_type = Type::LmStudio;
|
||||
auto json2 = nlohmann::json::parse( buf2 );
|
||||
@@ -69,7 +69,7 @@ bool TracyLlmApi::Connect( const char* url )
|
||||
m_models.back().quant = json2["quantization"].get_ref<const std::string&>();
|
||||
if( json2.contains( "loaded_context_length" ) ) m_models.back().contextSize = json2["loaded_context_length"].get<int>();
|
||||
}
|
||||
else if( PostRequest( m_url + "/api/show", "{\"name\":\"" + id + "\"}", buf2 ) == 200 )
|
||||
else if( ( m_type == Type::Unknown || m_type == Type::Ollama ) && PostRequest( m_url + "/api/show", "{\"name\":\"" + id + "\"}", buf2 ) == 200 )
|
||||
{
|
||||
m_type = Type::Ollama;
|
||||
auto json2 = nlohmann::json::parse( buf2 );
|
||||
@@ -83,6 +83,10 @@ bool TracyLlmApi::Connect( const char* url )
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( m_type == Type::Unknown )
|
||||
{
|
||||
m_type = Type::Other;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
|
||||
@@ -25,6 +25,7 @@ class TracyLlmApi
|
||||
Unknown,
|
||||
Ollama,
|
||||
LmStudio,
|
||||
Other
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user