mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-22 16:50:49 +00:00
Access the user manual data through its singleton in the LLM chain.
This commit is contained in:
@@ -31,7 +31,7 @@ extern double s_time;
|
||||
|
||||
constexpr size_t InputBufferSize = 1024;
|
||||
|
||||
TracyLlm::TracyLlm( Worker& worker, View& view, const TracyManualData& manual )
|
||||
TracyLlm::TracyLlm( Worker& worker, View& view )
|
||||
: m_exit( false )
|
||||
, m_input( nullptr )
|
||||
, m_apiInput( nullptr )
|
||||
@@ -65,7 +65,7 @@ TracyLlm::TracyLlm( Worker& worker, View& view, const TracyManualData& manual )
|
||||
|
||||
m_api = std::make_unique<TracyLlmApi>();
|
||||
m_chatUi = std::make_unique<TracyLlmChat>( view, worker, m_skills );
|
||||
m_tools = std::make_unique<TracyLlmTools>( worker, view, manual, m_skills );
|
||||
m_tools = std::make_unique<TracyLlmTools>( worker, view, m_skills );
|
||||
|
||||
m_busy = true;
|
||||
QueueConnect();
|
||||
|
||||
@@ -21,7 +21,6 @@ constexpr int DefaultToolReplyLimit = 48 * 1024;
|
||||
class TracyLlmApi;
|
||||
class TracyLlmChat;
|
||||
class TracyLlmTools;
|
||||
class TracyManualData;
|
||||
class View;
|
||||
class WindowConstraints;
|
||||
class Worker;
|
||||
@@ -54,7 +53,7 @@ class TracyLlm
|
||||
};
|
||||
|
||||
public:
|
||||
TracyLlm( Worker& worker, View& view, const TracyManualData& manual );
|
||||
TracyLlm( Worker& worker, View& view );
|
||||
~TracyLlm();
|
||||
|
||||
[[nodiscard]] bool IsBusy() const { std::lock_guard lock( m_jobsLock ); return m_busy; }
|
||||
|
||||
@@ -85,14 +85,13 @@ static std::unique_ptr<pugi::xml_document> ParseHtml( const std::string& html )
|
||||
return doc;
|
||||
}
|
||||
|
||||
TracyLlmTools::TracyLlmTools( Worker& worker, const View& view, const TracyManualData& manual, const std::vector<LlmSkill>& skills )
|
||||
TracyLlmTools::TracyLlmTools( Worker& worker, const View& view, const std::vector<LlmSkill>& skills )
|
||||
: m_worker( worker )
|
||||
, m_view( view )
|
||||
, m_manual( manual )
|
||||
, m_skills( skills )
|
||||
{
|
||||
int idx = 0;
|
||||
for( auto& chunk : m_manual.GetChunks() )
|
||||
for( auto& chunk : GetManualData().GetChunks() )
|
||||
{
|
||||
std::string hdr;
|
||||
if( !chunk.section.empty() ) hdr += "Section " + chunk.section;
|
||||
@@ -245,7 +244,7 @@ void TracyLlmTools::SelectManualEmbeddings( const std::string& model )
|
||||
|
||||
try
|
||||
{
|
||||
m_manualEmbeddings = std::make_unique<TracyLlmEmbeddings>( cache, m_manual.GetHash() );
|
||||
m_manualEmbeddings = std::make_unique<TracyLlmEmbeddings>( cache, GetManualData().GetHash() );
|
||||
m_manualEmbeddingState = { .model = model, .done = true };
|
||||
}
|
||||
catch( std::exception& ) {}
|
||||
@@ -346,7 +345,7 @@ void TracyLlmTools::ManualEmbeddingsWorker( TracyLlmApi& api )
|
||||
i += bsz;
|
||||
}
|
||||
|
||||
m_manualEmbeddings->Save( cache, m_manual.GetHash() );
|
||||
m_manualEmbeddings->Save( cache, GetManualData().GetHash() );
|
||||
|
||||
lock.lock();
|
||||
m_manualEmbeddingState.inProgress = false;
|
||||
@@ -838,7 +837,7 @@ std::string TracyLlmTools::SearchManual( const std::string& query, TracyLlmApi&
|
||||
}
|
||||
if( chunks.size() > MaxOutputChunks ) chunks.resize( MaxOutputChunks );
|
||||
|
||||
auto& manualChunks = m_manual.GetChunks();
|
||||
auto& manualChunks = GetManualData().GetChunks();
|
||||
const auto maxSize = CalcMaxSize();
|
||||
int totalSize = 0;
|
||||
int idx;
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace tracy
|
||||
|
||||
struct LlmSkill;
|
||||
class TracyLlmApi;
|
||||
class TracyManualData;
|
||||
class View;
|
||||
class Worker;
|
||||
|
||||
@@ -33,7 +32,7 @@ public:
|
||||
float progress = 0;
|
||||
};
|
||||
|
||||
TracyLlmTools( Worker& worker, const View& view, const TracyManualData& manual, const std::vector<LlmSkill>& skills );
|
||||
TracyLlmTools( Worker& worker, const View& view, const std::vector<LlmSkill>& skills );
|
||||
~TracyLlmTools();
|
||||
|
||||
std::string HandleToolCalls( const std::string& tool, const nlohmann::json& json, TracyLlmApi& api, int contextSize, bool hasEmbeddingsModel );
|
||||
@@ -86,7 +85,6 @@ private:
|
||||
Worker& m_worker;
|
||||
const View& m_view;
|
||||
|
||||
const TracyManualData& m_manual;
|
||||
const std::vector<LlmSkill>& m_skills;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "TracyFileRead.hpp"
|
||||
#include "TracyFilesystem.hpp"
|
||||
#include "TracyImGui.hpp"
|
||||
#include "TracyManualData.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracySafeFileWrite.hpp"
|
||||
#include "TracySourceView.hpp"
|
||||
@@ -54,13 +53,12 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char*
|
||||
, m_achievements( s_config.achievements )
|
||||
, m_horizontalScrollMultiplier( s_config.horizontalScrollMultiplier )
|
||||
, m_verticalScrollMultiplier( s_config.verticalScrollMultiplier )
|
||||
, m_manualData( GetManualData() )
|
||||
, m_markdown( this, &m_worker, &GetManualWindow() )
|
||||
#ifdef __EMSCRIPTEN__
|
||||
, m_td( 2, "ViewMt" )
|
||||
#else
|
||||
, m_td( std::thread::hardware_concurrency(), "ViewMt" )
|
||||
, m_llm( m_worker, *this, m_manualData )
|
||||
, m_llm( m_worker, *this )
|
||||
#endif
|
||||
{
|
||||
InitTextEditor();
|
||||
@@ -86,13 +84,12 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
|
||||
, m_achievements( s_config.achievements )
|
||||
, m_horizontalScrollMultiplier( s_config.horizontalScrollMultiplier )
|
||||
, m_verticalScrollMultiplier( s_config.verticalScrollMultiplier )
|
||||
, m_manualData( GetManualData() )
|
||||
, m_markdown( this, &m_worker, &GetManualWindow() )
|
||||
#ifdef __EMSCRIPTEN__
|
||||
, m_td( 2, "ViewMt" )
|
||||
#else
|
||||
, m_td( std::thread::hardware_concurrency(), "ViewMt" )
|
||||
, m_llm( m_worker, *this, m_manualData )
|
||||
, m_llm( m_worker, *this )
|
||||
#endif
|
||||
{
|
||||
m_notificationTime = 4;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "TracyBuzzAnim.hpp"
|
||||
#include "TracyConfig.hpp"
|
||||
#include "TracyDecayValue.hpp"
|
||||
#include "TracyManualData.hpp"
|
||||
#include "TracyManualWindow.hpp"
|
||||
#include "TracyMarkdown.hpp"
|
||||
#include "TracySourceContents.hpp"
|
||||
@@ -1078,7 +1077,6 @@ private:
|
||||
double m_horizontalScrollMultiplier = 1.0;
|
||||
double m_verticalScrollMultiplier = 1.0;
|
||||
|
||||
const TracyManualData& m_manualData;
|
||||
Markdown m_markdown;
|
||||
|
||||
TaskDispatch m_td;
|
||||
|
||||
Reference in New Issue
Block a user