mirror of
https://github.com/wolfpld/tracy
synced 2026-01-19 04:52:09 +00:00
Fix newline removal in retrieved webpages.
This commit is contained in:
@@ -480,7 +480,7 @@ std::string TracyLlmTools::GetDictionary( std::string word, const std::string& l
|
|||||||
return TrimString( std::move( res ) );
|
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::erase( str, '\r' );
|
||||||
std::ranges::replace( str, '\n', ' ' );
|
std::ranges::replace( str, '\n', ' ' );
|
||||||
@@ -681,7 +681,7 @@ std::string TracyLlmTools::GetWebpage( const std::string& url )
|
|||||||
xml_writer writer( response );
|
xml_writer writer( response );
|
||||||
body.node().print( writer, nullptr, pugi::format_raw | pugi::format_no_declaration | pugi::format_no_escapes );
|
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' ); } );
|
auto it = std::ranges::unique( response, []( char a, char b ) { return ( a == ' ' || a == '\t' ) && ( b == ' ' || b == '\t' ); } );
|
||||||
response.erase( it.begin(), it.end() );
|
response.erase( it.begin(), it.end() );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user