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.
This commit is contained in:
Bartosz Taudul
2026-01-15 17:59:00 +01:00
parent fc63779b18
commit eeacbac8bc

View File

@@ -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();
}
}
}
}