From c8dbe33a3c1f7e02e5293a68ff8068c8416e03e4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 13 May 2025 19:50:03 +0200 Subject: [PATCH] Move LLM system prompt to an external file. --- profiler/CMakeLists.txt | 4 +++- profiler/src/llm/system.prompt | 1 + profiler/src/profiler/TracyLlm.cpp | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 profiler/src/llm/system.prompt diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index 3546ace1..da216b72 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.25) option(NO_FILESELECTOR "Disable the file selector" OFF) option(GTK_FILESELECTOR "Use the GTK file selector on Linux instead of the xdg-portal one" OFF) @@ -120,6 +120,8 @@ set(PROFILER_FILES src/winmainArchDiscovery.cpp ) +Embed(PROFILER_FILES SystemPrompt src/llm/system.prompt) + set(INCLUDES "${CMAKE_CURRENT_BINARY_DIR}") set(LIBS "") diff --git a/profiler/src/llm/system.prompt b/profiler/src/llm/system.prompt new file mode 100644 index 00000000..1cef8d1d --- /dev/null +++ b/profiler/src/llm/system.prompt @@ -0,0 +1 @@ +You are a helpful assistant operating in context of Tracy Profiler, a C++ real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications. diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 034d8488..9177d9f1 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -2,10 +2,13 @@ #include #include "TracyConfig.hpp" +#include "TracyEmbed.hpp" #include "TracyImGui.hpp" #include "TracyLlm.hpp" #include "TracyPrint.hpp" +#include "data/SystemPrompt.hpp" + extern tracy::Config s_config; namespace tracy @@ -464,8 +467,9 @@ void TracyLlm::UpdateModels() void TracyLlm::ResetChat() { + Unembed( SystemPrompt ); m_chat = std::make_unique(); - m_chat->emplace_back( ollama::message( "system", "You are a helpful assistant operating in context of Tracy Profiler, a C++ real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications." ) ); + m_chat->emplace_back( ollama::message( "system", std::string( SystemPrompt->data(), SystemPrompt->size() ) ) ); } void TracyLlm::SendMessage( ollama::messages&& messages )