Detect llama.cpp router mode.

This commit is contained in:
Bartosz Taudul
2026-06-18 20:56:07 +02:00
parent 3ccda1d3c4
commit eefc7aee4b
2 changed files with 11 additions and 0 deletions

View File

@@ -67,6 +67,16 @@ bool TracyLlmApi::Connect( const char* url )
m_type = Type::LlamaSwap;
if( id.find( "embed" ) != std::string::npos ) m_models.back().embeddings = true;
}
else if( ( m_type == Type::Unknown || m_type == Type::LlamaCpp ) && GetRequest( m_url + "/props", buf2 ) == 200 && buf2.find( "\"build_info\"" ) != std::string::npos )
{
m_type = Type::LlamaCpp;
if( model.contains( "status" ) && model["status"].contains( "preset" ) && model["status"]["preset"].is_string() &&
model["status"]["preset"].get_ref<const std::string&>().find( "embedding" ) != std::string::npos )
{
m_models.back().embeddings = true;
}
if( model.contains( "meta" ) && model["meta"].contains( "n_ctx" ) ) m_models.back().contextSize = model["meta"]["n_ctx"].get<int>();
}
else if( ( m_type == Type::Unknown || m_type == Type::LmStudio ) && GetRequest( m_url + "/api/v0/models/" + id, buf2 ) == 200 )
{
m_type = Type::LmStudio;

View File

@@ -25,6 +25,7 @@ class TracyLlmApi
Unknown,
LmStudio,
LlamaSwap,
LlamaCpp,
Other
};