From a6d96d42018aa953ddb5134dfce5b7ece60f962c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 3 Aug 2026 22:09:48 +0200 Subject: [PATCH] Ignore all-newline message chunks at the beginning of LLM content. DeepSeek 4 Flash likes to send "\n\n" as content between the reasoning and tool call sections. --- profiler/src/profiler/TracyLlm.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 598358ae..92c4f1fc 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -1395,13 +1395,20 @@ void TracyLlm::AppendResponse( const char* name, const nlohmann::json& delta ) { assert( back[name].is_string() ); back[name].get_ref().append( str ); + m_usedCtx++; } else { - back[name] = std::move( str ); + for( auto c : str ) + { + if( c != '\n' ) + { + back[name] = std::move( str ); + m_usedCtx++; + break; + } + } } - - m_usedCtx++; } else if( json.is_array() ) {