From 3f84749b0524ccdaa148643ef83259c71814486f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Jan 2026 15:28:49 +0100 Subject: [PATCH] Implement system prompt updates without clearing chat. --- profiler/src/profiler/TracyLlm.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index c0215833..2ea60868 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -709,9 +709,6 @@ void TracyLlm::ResetChat() void TracyLlm::UpdateSystemPrompt() { - assert( m_chat.size() <= 1 ); - m_chat.clear(); - static constexpr std::string UserToken = "%USER%"; static constexpr std::string TimeToken = "%TIME%"; @@ -723,7 +720,14 @@ void TracyLlm::UpdateSystemPrompt() Replace( systemPrompt, UserToken, userName ); Replace( systemPrompt, TimeToken, m_tools->GetCurrentTime() ); - AddMessage( std::move( systemPrompt ), "system" ); + if( m_chat.empty() ) + { + AddMessage( std::move( systemPrompt ), "system" ); + } + else + { + m_chat[0]["content"] = systemPrompt; + } } void TracyLlm::QueueConnect()