From eeacbac8bc1f3c0d3757313375e81d24e63fb2cc Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 15 Jan 2026 17:59:00 +0100 Subject: [PATCH] Workaround issues with LM Studio. LM Studio will prefix the assistant's content with '\n\n'. While this is not a problem when proper text follows (the markdown parser will ignore this), the empty check does fail. --- profiler/src/profiler/TracyLlmChat.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/profiler/src/profiler/TracyLlmChat.cpp b/profiler/src/profiler/TracyLlmChat.cpp index 71063ab3..41818c9d 100644 --- a/profiler/src/profiler/TracyLlmChat.cpp +++ b/profiler/src/profiler/TracyLlmChat.cpp @@ -277,9 +277,15 @@ bool TracyLlmChat::Turn( TurnRole role, const nlohmann::json& json, Think think, { if( !content.empty() ) { - NormalScope(); - m_markdown.Print( content.c_str(), content.size() ); - if( !last && think == Think::Hide && roleStr == "assistant" ) ImGui::Spacing(); + auto ptr = content.c_str(); + auto end = ptr + content.size(); + while( *ptr == '\n' ) ptr++; + if( ptr != end ) + { + NormalScope(); + m_markdown.Print( content.c_str(), content.size() ); + if( !last && think == Think::Hide && roleStr == "assistant" ) ImGui::Spacing(); + } } } }