0
0
mirror of https://github.com/wolfpld/tracy.git synced 2026-01-18 17:11:26 +01:00

Fix newline removal in retrieved webpages.

This commit is contained in:
Bartosz Taudul
2026-01-15 02:33:45 +01:00
parent fa8a57af86
commit 3817db0dc2

View File

@@ -480,7 +480,7 @@ std::string TracyLlmTools::GetDictionary( std::string word, const std::string& l
return TrimString( std::move( res ) );
}
static std::string RemoveNewline( std::string str )
[[nodiscard]] static std::string RemoveNewline( std::string str )
{
std::erase( str, '\r' );
std::ranges::replace( str, '\n', ' ' );
@@ -681,7 +681,7 @@ std::string TracyLlmTools::GetWebpage( const std::string& url )
xml_writer writer( response );
body.node().print( writer, nullptr, pugi::format_raw | pugi::format_no_declaration | pugi::format_no_escapes );
RemoveNewline( response );
response = RemoveNewline( response );
auto it = std::ranges::unique( response, []( char a, char b ) { return ( a == ' ' || a == '\t' ) && ( b == ' ' || b == '\t' ); } );
response.erase( it.begin(), it.end() );