Add chat UI elements.

This commit is contained in:
Bartosz Taudul
2025-07-12 11:49:54 +02:00
parent 4250fa51c2
commit 2ea7a183f1
2 changed files with 21 additions and 0 deletions
+19
View File
@@ -13,8 +13,11 @@ namespace tracy
extern double s_time;
constexpr size_t InputBufferSize = 1024;
TracyLlm::TracyLlm()
: m_exit( false )
, m_input( nullptr )
{
if( !s_config.llm ) return;
@@ -33,6 +36,9 @@ TracyLlm::TracyLlm()
return;
}
m_input = new char[InputBufferSize];
*m_input = 0;
m_jobs.emplace_back( WorkItem {
.task = Task::LoadModels,
.callback = [this] { UpdateModels(); }
@@ -42,6 +48,8 @@ TracyLlm::TracyLlm()
TracyLlm::~TracyLlm()
{
delete[] m_input;
if( m_thread.joinable() )
{
{
@@ -124,6 +132,17 @@ void TracyLlm::Draw()
}
ImGui::PopStyleVar();
ImGui::Spacing();
ImGui::BeginChild( "##ollama", ImVec2( 0, -( ImGui::GetFrameHeight() + ImGui::GetStyle().ItemSpacing.y * 2 ) ), ImGuiChildFlags_Borders );
ImGui::EndChild();
ImGui::Spacing();
ImGui::PushItemWidth( -1 );
if( ImGui::InputTextWithHint( "##ollama_input", "Write your question here...", m_input, InputBufferSize, ImGuiInputTextFlags_EnterReturnsTrue ) )
{
*m_input = 0;
}
ImGui::End();
}
+2
View File
@@ -74,6 +74,8 @@ private:
std::vector<WorkItem> m_jobs;
bool m_busy;
char* m_input;
ImFont* m_font;
ImFont* m_smallFont;
ImFont* m_bigFont;