mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-17 14:25:37 +00:00
Use exact tokens count when available in server response.
Note that this is not really exacy, as it includes system prompt reminder and possibly other input data that is dynamically injected.
This commit is contained in:
@@ -825,6 +825,12 @@ bool TracyLlm::OnResponse( const nlohmann::json& json )
|
||||
|
||||
if( done )
|
||||
{
|
||||
if( json.contains( "usage" ) )
|
||||
{
|
||||
auto& usage = json["usage"];
|
||||
if( usage.contains( "total_tokens" ) ) m_usedCtx = usage["total_tokens"].get<int>();
|
||||
}
|
||||
|
||||
bool isTool = false;
|
||||
auto& str = back["content"].get_ref<const std::string&>();
|
||||
if( !str.starts_with( "<debug>" ) )
|
||||
|
||||
Reference in New Issue
Block a user