diff --git a/profiler/src/llm/system.prompt.md b/profiler/src/llm/system.prompt.md index cc3f5c53..a6024b23 100644 --- a/profiler/src/llm/system.prompt.md +++ b/profiler/src/llm/system.prompt.md @@ -33,7 +33,7 @@ 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%. +The program being profiled is named %PROGRAMNAME%. It was built at %PROGRAMTIME%. The profiling session was performed at %PROFILETIME%.%PROFILEDESCRIPTION% Here are instructions you must follow when you are asked to work with program the user is profiling. diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 3c1bbab9..b170fce3 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -903,11 +903,33 @@ void TracyLlm::UpdateSystemPrompt() static constexpr std::string_view UserToken = "%USER%"; static constexpr std::string_view TimeToken = "%TIME%"; static constexpr std::string_view ProgramNameToken = "%PROGRAMNAME%"; + static constexpr std::string_view ProgramTimeToken = "%PROGRAMTIME%"; + static constexpr std::string_view ProfileTimeToken = "%PROFILETIME%"; + static constexpr std::string_view ProfileDescriptionToken = "%PROFILEDESCRIPTION%"; static constexpr std::string_view SkillsToken = "%SKILLS%"; auto userName = GetUserFullName(); if( !userName ) userName = GetUserLogin(); + const auto exectime = m_worker.GetExecutableTime(); + const auto capturetime = m_worker.GetCaptureTime(); + + char etime[64], ctime[64]; + + time_t et = exectime; + auto elt = localtime( &et ); + strftime( etime, 64, "%F %T", elt ); + + time_t ct = capturetime; + auto clt = localtime( &ct ); + strftime( ctime, 64, "%F %T", clt ); + + std::string descStr; + const auto& desc = m_view.GetUserData().GetDescription(); + if( !desc.empty() ) descStr += " Profiling session description: '" + desc + "'."; + const auto& filename = m_view.GetFilename(); + if( !filename.empty() ) descStr += " Profiling session file: '" + filename + "'."; + std::string skills; for( auto& skill : m_skills ) skills += skill.name + ": " + skill.description + "\n"; @@ -916,6 +938,9 @@ void TracyLlm::UpdateSystemPrompt() Replace( systemPrompt, UserToken, userName ); Replace( systemPrompt, TimeToken, m_tools->GetCurrentTime() ); Replace( systemPrompt, ProgramNameToken, m_worker.GetCaptureProgram() ); + Replace( systemPrompt, ProgramTimeToken, etime ); + Replace( systemPrompt, ProfileTimeToken, ctime ); + Replace( systemPrompt, ProfileDescriptionToken, descStr ); Replace( systemPrompt, SkillsToken, skills ); if( !m_api )