From b0dd2b291d1708830e5bd6a987fea6c0b68c90c8 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 8 Mar 2026 14:41:42 +0100 Subject: [PATCH] Make a separate fast model optional. --- profiler/src/profiler/TracyConfig.cpp | 2 ++ profiler/src/profiler/TracyConfig.hpp | 1 + profiler/src/profiler/TracyLlm.cpp | 10 ++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/profiler/src/profiler/TracyConfig.cpp b/profiler/src/profiler/TracyConfig.cpp index 70fc0832..47b15c59 100644 --- a/profiler/src/profiler/TracyConfig.cpp +++ b/profiler/src/profiler/TracyConfig.cpp @@ -51,6 +51,7 @@ void LoadConfig() if( ini_sget( ini, "llm", "annotateCallstacks", "%d", &v ) ) s_config.llmAnnotateCallstacks = v; if( ini_sget( ini, "llm", "limitToolReplySize", "%d", &v ) ) s_config.llmLimitToolReplySize = v; if( ini_sget( ini, "llm", "maxToolReplySizeValue", "%d", &v ) ) s_config.llmMaxToolReplySizeValue = v; + if( ini_sget( ini, "llm", "separateFastModel", "%d", &v ) ) s_config.llmSeparateFastModel = v; ini_free( ini ); } @@ -103,6 +104,7 @@ bool SaveConfig() fprintf( f, "annotateCallstacks = %i\n", (int)s_config.llmAnnotateCallstacks ); fprintf( f, "limitToolReplySize = %i\n", (int)s_config.llmLimitToolReplySize ); fprintf( f, "maxToolReplySizeValue = %i\n", s_config.llmMaxToolReplySizeValue ); + fprintf( f, "separateFastModel = %i\n", (int)s_config.llmSeparateFastModel ); fclose( f ); return true; diff --git a/profiler/src/profiler/TracyConfig.hpp b/profiler/src/profiler/TracyConfig.hpp index c49e8dc9..461ae45b 100644 --- a/profiler/src/profiler/TracyConfig.hpp +++ b/profiler/src/profiler/TracyConfig.hpp @@ -44,6 +44,7 @@ struct Config std::string llmSearchIdentifier; std::string llmSearchApiKey; std::string llmSearchBraveApiKey; + bool llmSeparateFastModel = true; bool llmAnnotateCallstacks = false; bool llmLimitToolReplySize = false; int llmMaxToolReplySizeValue = 48*1024; diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 9bf7e6a9..de0a77ab 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -240,8 +240,11 @@ void TracyLlm::Draw() } ImGui::AlignTextToFramePadding(); + if( ImGui::Checkbox( "##useFastModel", &s_config.llmSeparateFastModel ) ) SaveConfig(); + ImGui::SameLine(); TextDisabledUnformatted( ICON_FA_BOLT_LIGHTNING " Fast model:" ); ImGui::SameLine(); + if( !s_config.llmSeparateFastModel ) ImGui::BeginDisabled(); if( models.empty() || m_fastIdx < 0 ) { ImGui::TextUnformatted( "No models available" ); @@ -271,6 +274,7 @@ void TracyLlm::Draw() ImGui::EndCombo(); } } + if( !s_config.llmSeparateFastModel ) ImGui::EndDisabled(); ImGui::AlignTextToFramePadding(); TextDisabledUnformatted( ICON_FA_BOOK_BOOKMARK " Embeddings model:" ); @@ -732,7 +736,8 @@ void TracyLlm::WorkerThread() auto param = m_currentJob->param2; auto callback = m_currentJob->callback2; lock.unlock(); - auto response = m_api->SendMessage( param, m_fastIdx ); + const int modelIdx = s_config.llmSeparateFastModel ? m_fastIdx : m_modelIdx; + auto response = m_api->SendMessage( param, modelIdx ); callback( response ); lock.lock(); break; @@ -906,7 +911,8 @@ bool TracyLlm::QueueFastMessageLocking( const nlohmann::json& req, std::function // requires m_jobsLock bool TracyLlm::QueueFastMessage( const nlohmann::json& req, std::function callback ) { - if( !m_api->IsConnected() || m_fastIdx < 0 ) return false; + const int modelIdx = s_config.llmSeparateFastModel ? m_fastIdx : m_modelIdx; + if( !m_api->IsConnected() || modelIdx < 0 ) return false; m_jobs.emplace_back( std::make_shared( WorkItem { .task = Task::FastMessage, .callback2 = std::move( callback ),