Constrain LLM window size.

This commit is contained in:
Bartosz Taudul
2026-07-18 13:52:58 +02:00
parent 64c0c5c85f
commit 3eae7a6d65
4 changed files with 12 additions and 4 deletions

View File

@@ -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() )
{

View File

@@ -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;

View File

@@ -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 )

View File

@@ -1099,6 +1099,7 @@ private:
WindowConstraints m_statisticsConstraint;
WindowConstraints m_memoryConstraint;
WindowConstraints m_compareConstraint;
WindowConstraints m_llmConstraint;
#ifndef __EMSCRIPTEN__
TracyLlm m_llm;