Do not display system prompt injected into user messages.

This commit is contained in:
Bartosz Taudul
2025-12-28 18:15:44 +01:00
parent 0246cec0a7
commit 9183aef645

View File

@@ -152,7 +152,21 @@ bool TracyLlmChat::Turn( TurnRole role, const std::string& content )
}
else if( role != TurnRole::Assistant )
{
m_markdown.Print( content.c_str(), content.size() );
auto pos = content.find( "<SYSTEM_PROMPT>" );
if( pos == std::string::npos )
{
m_markdown.Print( content.c_str(), content.size() );
}
else
{
auto str = content;
while( ( pos = str.find( "<SYSTEM_PROMPT>" ) ) != std::string::npos )
{
auto pos2 = str.find( "</SYSTEM_PROMPT>" );
str = str.substr( 0, pos ) + str.substr( pos2 + sizeof( "</SYSTEM_PROMPT>" ) - 1 );
}
m_markdown.Print( str.c_str(), str.size() );
}
}
else if( content.starts_with( "<tool_output>\n" ) )
{