From fc63779b18a4bee5d4c1ce61b704014f9f3dffe1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 15 Jan 2026 02:37:47 +0100 Subject: [PATCH] Reduce nested divs in retrieved webpages. --- profiler/src/profiler/TracyLlmTools.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/profiler/src/profiler/TracyLlmTools.cpp b/profiler/src/profiler/TracyLlmTools.cpp index ca766c6f..ef3217fb 100644 --- a/profiler/src/profiler/TracyLlmTools.cpp +++ b/profiler/src/profiler/TracyLlmTools.cpp @@ -487,6 +487,15 @@ std::string TracyLlmTools::GetDictionary( std::string word, const std::string& l return str; } +static void ReplaceAll( std::string& str, std::string_view from, std::string_view to ) +{ + std::string::size_type pos = 0; + while( ( pos = str.find( from, pos ) ) != std::string::npos ) + { + str.replace( pos, from.size(), to ); + } +} + std::string TracyLlmTools::SearchWeb( std::string query ) { NetworkCheckString; @@ -682,6 +691,8 @@ std::string TracyLlmTools::GetWebpage( const std::string& url ) body.node().print( writer, nullptr, pugi::format_raw | pugi::format_no_declaration | pugi::format_no_escapes ); response = RemoveNewline( response ); + ReplaceAll( response, "
", "
" ); + ReplaceAll( response, "
", "
" ); auto it = std::ranges::unique( response, []( char a, char b ) { return ( a == ' ' || a == '\t' ) && ( b == ' ' || b == '\t' ); } ); response.erase( it.begin(), it.end() );