From 3eae7a6d657064786f3ba767edfc4734f60a48f9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 18 Jul 2026 13:52:58 +0200 Subject: [PATCH] Constrain LLM window size. --- profiler/src/profiler/TracyLlm.cpp | 9 +++++++-- profiler/src/profiler/TracyLlm.hpp | 3 ++- profiler/src/profiler/TracyView.cpp | 3 ++- profiler/src/profiler/TracyView.hpp | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 5af68818..7bc6f0ed 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -83,10 +83,11 @@ TracyLlm::~TracyLlm() } } -void TracyLlm::Draw() +void TracyLlm::Draw( WindowConstraints& constraints ) { const auto scale = GetScale(); ImGui::SetNextWindowSize( ImVec2( 400 * scale, 800 * scale ), ImGuiCond_FirstUseEver ); + constraints.Constrain(); ImGui::Begin( "Tracy Assist", &m_show, ImGuiWindowFlags_NoScrollbar ); if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; } @@ -174,7 +175,9 @@ void TracyLlm::Draw() } ImGui::SameLine(); - if( ImGui::TreeNode( "Settings" ) ) + const bool expand = ImGui::TreeNode( "Settings" ); + constraints.MarkMinWidth(); + if( expand ) { m_jobsLock.lock(); const auto responding = m_currentJob != nullptr; @@ -335,6 +338,7 @@ void TracyLlm::Draw() { SaveConfig(); } + constraints.MarkMinWidth(); if( ImGui::Checkbox( ICON_FA_HAND_POINT_RIGHT " Show summary", &s_config.llmSummary ) ) { @@ -373,6 +377,7 @@ void TracyLlm::Draw() } ImGui::SameLine(); ImGui::TextDisabled( "(bytes)" ); + constraints.MarkMinWidth(); if( !s_config.llmLimitToolReplySize ) ImGui::EndDisabled(); if( !models.empty() ) { diff --git a/profiler/src/profiler/TracyLlm.hpp b/profiler/src/profiler/TracyLlm.hpp index 1869432a..09fea232 100644 --- a/profiler/src/profiler/TracyLlm.hpp +++ b/profiler/src/profiler/TracyLlm.hpp @@ -21,6 +21,7 @@ class TracyLlmChat; class TracyLlmTools; class TracyManualData; class View; +class WindowConstraints; class Worker; struct LlmSkill @@ -56,7 +57,7 @@ public: [[nodiscard]] bool IsBusy() const { std::lock_guard lock( m_jobsLock ); return m_busy; } - void Draw(); + void Draw( WindowConstraints& constraints ); bool m_show = false; diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 376679d3..86f9bf84 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -1215,7 +1215,7 @@ bool View::DrawImpl() if( m_showManual ) DrawManual(); if( m_showFrameStatistics ) DrawFrameStatistics(); #ifndef __EMSCRIPTEN__ - if( m_llm.m_show ) m_llm.Draw(); + if( m_llm.m_show ) m_llm.Draw( m_llmConstraint ); #endif if( m_setRangePopup.active ) @@ -1534,6 +1534,7 @@ void View::DpiScaleChanged() m_statisticsConstraint.Reset(); m_memoryConstraint.Reset(); m_compareConstraint.Reset(); + m_llmConstraint.Reset(); } void View::AddLlmAttachment( const nlohmann::json& json ) diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index 596f4b87..f3ecfdd4 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -1099,6 +1099,7 @@ private: WindowConstraints m_statisticsConstraint; WindowConstraints m_memoryConstraint; WindowConstraints m_compareConstraint; + WindowConstraints m_llmConstraint; #ifndef __EMSCRIPTEN__ TracyLlm m_llm;