From 85a82fbb70521a9982235c67326c9bc3bb09f6a3 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 11 May 2025 16:58:47 +0200 Subject: [PATCH] Implement checking for connection validity and API version in TracyLlm. --- profiler/src/profiler/TracyLlm.cpp | 15 ++++++++++++++- profiler/src/profiler/TracyLlm.hpp | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 3f1d228c..c470ba02 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -1,13 +1,26 @@ #include +#include "TracyConfig.hpp" #include "TracyLlm.hpp" +extern tracy::Config s_config; + namespace tracy { TracyLlm::TracyLlm() + : m_ollama( std::make_unique( s_config.llmAddress ) ) + , m_valid( m_ollama->is_running() ) { - m_ollama = std::make_unique(); +} + +TracyLlm::~TracyLlm() +{ +} + +std::string TracyLlm::GetVersion() const +{ + return m_ollama->get_version(); } } diff --git a/profiler/src/profiler/TracyLlm.hpp b/profiler/src/profiler/TracyLlm.hpp index 66255e83..30bd749e 100644 --- a/profiler/src/profiler/TracyLlm.hpp +++ b/profiler/src/profiler/TracyLlm.hpp @@ -12,9 +12,14 @@ class TracyLlm { public: TracyLlm(); + ~TracyLlm(); + + [[nodiscard]] bool IsValid() const { return m_valid; } + [[nodiscard]] std::string GetVersion() const; private: std::unique_ptr m_ollama; + bool m_valid; }; }