From dabfa36913fb82dbe574a0d41b60c78f83efce29 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 17 Jun 2025 01:43:25 +0200 Subject: [PATCH] Display attachment type. --- profiler/src/profiler/TracyLlmChat.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/profiler/src/profiler/TracyLlmChat.cpp b/profiler/src/profiler/TracyLlmChat.cpp index 1e7715a6..0085277e 100644 --- a/profiler/src/profiler/TracyLlmChat.cpp +++ b/profiler/src/profiler/TracyLlmChat.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -139,12 +140,20 @@ bool TracyLlmChat::Turn( TurnRole role, const std::string& content ) } else if( role == TurnRole::Attachment ) { + constexpr auto tagSize = sizeof( "\n" ) - 1; + + auto j = nlohmann::json::parse( content.c_str() + tagSize, content.c_str() + content.size() ); + const auto& type = j["type"].get_ref(); + NormalScope(); ImGui::PushID( m_thinkIdx++ ); - if( ImGui::TreeNode( "Attachment" ) ) + const bool expand = ImGui::TreeNode( "Attachment" ); + ImGui::SameLine(); + ImGui::TextDisabled( "(%s)", type.c_str() ); + if( expand ) { ImGui::PushFont( g_fonts.mono ); - ImGui::TextWrapped( "%s", content.c_str() + sizeof( "\n" ) - 1 ); + ImGui::TextWrapped( "%s", content.c_str() + tagSize ); ImGui::PopFont(); ImGui::TreePop(); }