Hook up LLM window.

This commit is contained in:
Bartosz Taudul
2025-05-11 19:01:47 +02:00
parent e8c2d498d3
commit e4e23eabb6
4 changed files with 23 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include <ollama.hpp>
#include "TracyConfig.hpp"
#include "TracyImGui.hpp"
#include "TracyLlm.hpp"
extern tracy::Config s_config;
@@ -68,4 +69,13 @@ size_t TracyLlm::GetCtxSize( const std::string& model ) const
}
}
void TracyLlm::Draw()
{
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 400 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Tracy AI", &m_show, ImGuiWindowFlags_NoScrollbar );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
ImGui::End();
}
}

View File

@@ -21,6 +21,10 @@ public:
[[nodiscard]] std::vector<std::string> GetModels() const;
[[nodiscard]] size_t GetCtxSize( const std::string& model ) const;
void Draw();
bool m_show = false;
private:
std::unique_ptr<Ollama> m_ollama;

View File

@@ -957,6 +957,11 @@ bool View::DrawImpl()
ImGui::EndPopup();
}
}
if( m_llm.IsValid() )
{
ImGui::SameLine();
ToggleButton( ICON_FA_ROBOT, m_llm.m_show );
}
if( m_worker.AreFramesUsed() )
{
ImGui::SameLine();
@@ -1151,6 +1156,7 @@ bool View::DrawImpl()
if( m_sampleParents.symAddr != 0 ) DrawSampleParents();
if( m_showRanges ) DrawRanges();
if( m_showWaitStacks ) DrawWaitStacks();
if( m_llm.m_show ) m_llm.Draw();
if( m_setRangePopup.active )
{

View File

@@ -17,6 +17,7 @@
#include "TracyBuzzAnim.hpp"
#include "TracyConfig.hpp"
#include "TracyDecayValue.hpp"
#include "TracyLlm.hpp"
#include "TracySourceContents.hpp"
#include "TracyTimelineController.hpp"
#include "TracyUserData.hpp"
@@ -936,6 +937,8 @@ private:
lastTime = 0;
}
} m_flameGraphInvariant;
TracyLlm m_llm;
};
}