mirror of
https://github.com/wolfpld/tracy.git
synced 2026-08-29 14:38:21 +00:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user