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

Description is optional.

This commit is contained in:
Bartosz Taudul
2026-01-15 20:55:13 +01:00
parent eeacbac8bc
commit ef77600bae

View File

@@ -435,13 +435,14 @@ TracyLlmTools::ToolReply TracyLlmTools::SearchWikipedia( std::string query, cons
auto summary = FetchWebPage( "https://" + lang + ".wikipedia.org/api/rest_v1/page/summary/" + key );
auto summaryJson = nlohmann::json::parse( summary );
output.push_back( {
nlohmann::json j = {
{ "key", key },
{ "title", page["title"] },
{ "description", page["description"] },
{ "preview", summaryJson["extract"] },
{ "excerpt", page["excerpt"] }
} );
};
if( page.contains( "description" ) && !page["description"].is_null() ) j["description"] = page["description"];
output.push_back( j );
}
const auto reply = output.dump( 2, ' ', false, nlohmann::json::error_handler_t::replace );