Detect llama-swap, match embedding models by name.

This commit is contained in:
Bartosz Taudul
2025-06-08 21:47:05 +02:00
parent c35a75f86c
commit e2ba66cf04
2 changed files with 7 additions and 1 deletions

View File

@@ -61,7 +61,12 @@ bool TracyLlmApi::Connect( const char* url )
m_models.emplace_back( LlmModel { .name = id } );
std::string buf2;
if( ( m_type == Type::Unknown || m_type == Type::LmStudio ) && GetRequest( m_url + "/api/v0/models/" + id, buf2 ) == 200 )
if( ( m_type == Type::Unknown || m_type == Type::LlamaSwap ) && GetRequest( m_url + "/running", buf2 ) == 200 && buf2.starts_with( "{\"running\":" ) )
{
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::LmStudio ) && GetRequest( m_url + "/api/v0/models/" + id, buf2 ) == 200 )
{
m_type = Type::LmStudio;
auto json2 = nlohmann::json::parse( buf2 );

View File

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