Allow optional parameters with a default value.

This commit is contained in:
Bartosz Taudul
2026-01-07 16:24:10 +01:00
parent 82d47db47d
commit 3c82b63046

View File

@@ -121,8 +121,15 @@ static uint32_t GetParamU32( const nlohmann::json& json, const char* name )
return json[name].get<uint32_t>();
}
static uint32_t GetParamOptU32( const nlohmann::json& json, const char* name, uint32_t def )
{
if( !json.contains( name ) ) return def;
return json[name].get<uint32_t>();
}
#define Param(name) GetParam( json, name )
#define ParamU32(name) GetParamU32( json, name )
#define ParamOptU32(name, def) GetParamOptU32( json, name, def )
TracyLlmTools::ToolReply TracyLlmTools::HandleToolCalls( const std::string& tool, const nlohmann::json& json, TracyLlmApi& api, int contextSize, bool hasEmbeddingsModel )
{