Provide name of the profiled program to LLM.

This commit is contained in:
Bartosz Taudul
2026-02-01 12:56:26 +01:00
parent 0ad8767903
commit d4d9339d95
3 changed files with 8 additions and 0 deletions

View File

@@ -31,6 +31,8 @@ If the user thanks you for your help, ask them to consider making a donation at
# User's program
The program being profiled is named %PROGRAMNAME%.
Here are instructions you must follow when you are asked to work with program the user is profiling.
## Attachments

View File

@@ -12,6 +12,7 @@
#include "TracyLlmTools.hpp"
#include "TracyPrint.hpp"
#include "TracyWeb.hpp"
#include "TracyWorker.hpp"
#include "../Fonts.hpp"
#include "../public/common/TracySystem.hpp"
@@ -28,6 +29,7 @@ constexpr size_t InputBufferSize = 1024;
TracyLlm::TracyLlm( Worker& worker, View& view, const TracyManualData& manual )
: m_exit( false )
, m_input( nullptr )
, m_worker( worker )
{
if( !s_config.llm ) return;
@@ -771,6 +773,7 @@ void TracyLlm::UpdateSystemPrompt()
{
static constexpr std::string_view UserToken = "%USER%";
static constexpr std::string_view TimeToken = "%TIME%";
static constexpr std::string_view ProgramNameToken = "%PROGRAMNAME%";
auto userName = GetUserFullName();
if( !userName ) userName = GetUserLogin();
@@ -779,6 +782,7 @@ void TracyLlm::UpdateSystemPrompt()
Replace( systemPrompt, UserToken, userName );
Replace( systemPrompt, TimeToken, m_tools->GetCurrentTime() );
Replace( systemPrompt, ProgramNameToken, m_worker.GetCaptureProgram() );
if( m_chat.empty() )
{

View File

@@ -105,6 +105,8 @@ private:
std::shared_ptr<EmbedData> m_systemPrompt;
nlohmann::json m_toolsJson;
Worker& m_worker;
};
}