mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-30 05:55:52 +00:00
Allow opening callstack window from LLM attachment.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "TracyLlmChat.hpp"
|
||||
#include "TracyMouse.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracyView.hpp"
|
||||
#include "../Fonts.hpp"
|
||||
#include "../../public/common/TracyForceInline.hpp"
|
||||
|
||||
@@ -144,6 +145,7 @@ TracyLlmChat::TracyLlmChat( View& view, Worker& worker, const std::vector<LlmSki
|
||||
: m_width( new float[NumRoles] )
|
||||
, m_markdown( &view, &worker )
|
||||
, m_skills( skills )
|
||||
, m_view( view )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -285,6 +287,20 @@ bool TracyLlmChat::Turn( TurnRole role, std::vector<nlohmann::json>::iterator it
|
||||
const bool expand = ImGui::TreeNode( "Attachment" );
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(%s)", type.c_str() );
|
||||
if( type == "callstack" )
|
||||
{
|
||||
if( j.contains( "id" ) )
|
||||
{
|
||||
const auto id = j["id"].get<int64_t>();
|
||||
assert( id >= 0 );
|
||||
const auto thread = j.contains( "thread" ) ? j["thread"].get<uint32_t>() : 0;
|
||||
ImGui::SameLine();
|
||||
if( ImGui::SmallButton( ICON_FA_EYE ) )
|
||||
{
|
||||
m_view.ViewCallstack( id, thread );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( expand )
|
||||
{
|
||||
ImGui::PushFont( g_fonts.mono, FontNormal );
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
std::string m_label;
|
||||
|
||||
const std::vector<LlmSkill>& m_skills;
|
||||
View& m_view;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void View::DrawCallstackTable( const CallstackFrameId* data, size_t size, uint64
|
||||
}
|
||||
if( s_config.llm )
|
||||
{
|
||||
auto Attach = [this, data, size, hasCrashed, thread]() {
|
||||
auto Attach = [this, data, size, hasCrashed, thread, callstack]() {
|
||||
auto json = GetCallstackJson( data, size );
|
||||
if( hasCrashed )
|
||||
{
|
||||
@@ -130,6 +130,7 @@ void View::DrawCallstackTable( const CallstackFrameId* data, size_t size, uint64
|
||||
if( strcmp( threadName, "???" ) != 0 ) json["thread_name"] = threadName;
|
||||
json["thread_id"] = thread;
|
||||
}
|
||||
if( callstack >= 0 ) json["id"] = callstack;
|
||||
|
||||
AddLlmAttachment( json );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user