From 237e90fe64410d6b8f77f54ce411d459dcedb99c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 29 Dec 2025 17:30:47 +0100 Subject: [PATCH] Adapt context management to tool role usage. --- profiler/src/profiler/TracyLlm.cpp | 10 +++------- profiler/src/profiler/TracyLlmChat.hpp | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 2a385f70..f40df0ac 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -764,14 +764,10 @@ void TracyLlm::ManageContext( std::unique_lock& lock ) std::vector> toolOutputs; for( auto& msg : m_chat ) { - if( msg["role"].get_ref() == "user" ) + if( msg["role"].get_ref() == "tool" ) { - auto& content = msg["content"]; - const auto& str = content.get_ref(); - if( str.starts_with( "\n" ) ) - { - toolOutputs.emplace_back( str.size(), idx ); - } + auto& str = msg["content"].get_ref(); + toolOutputs.emplace_back( str.size(), idx ); } idx++; } diff --git a/profiler/src/profiler/TracyLlmChat.hpp b/profiler/src/profiler/TracyLlmChat.hpp index 8d91e717..dbc7a29c 100644 --- a/profiler/src/profiler/TracyLlmChat.hpp +++ b/profiler/src/profiler/TracyLlmChat.hpp @@ -11,7 +11,7 @@ namespace tracy class TracyLlmChat { public: - static constexpr const char* ForgetMsg = "\n..."; + static constexpr const char* ForgetMsg = "..."; enum class TurnRole {