mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-14 21:05:40 +00:00
Add basic information about the profiling session to system prompt.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user