mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-01 16:08:30 +00:00
Fix chat input focus.
This commit is contained in:
@@ -338,7 +338,11 @@ void TracyLlm::Draw()
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ImGui::IsWindowAppearing() ) ImGui::SetKeyboardFocusHere( 0 );
|
||||
if( ImGui::IsWindowAppearing() || m_focusInput )
|
||||
{
|
||||
ImGui::SetKeyboardFocusHere( 0 );
|
||||
m_focusInput = false;
|
||||
}
|
||||
ImGui::PushItemWidth( -1 );
|
||||
if( ImGui::InputTextWithHint( "##ollama_input", "Write your question here...", m_input, InputBufferSize, ImGuiInputTextFlags_EnterReturnsTrue ) )
|
||||
{
|
||||
@@ -484,6 +488,7 @@ bool TracyLlm::OnResponse( const ollama::response& response )
|
||||
{
|
||||
m_stop = false;
|
||||
m_responding = false;
|
||||
m_focusInput = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -496,6 +501,7 @@ bool TracyLlm::OnResponse( const ollama::response& response )
|
||||
if( json["done"] )
|
||||
{
|
||||
m_responding = false;
|
||||
m_focusInput = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ private:
|
||||
bool m_responding = false;
|
||||
bool m_stop = false;
|
||||
bool m_wasUpdated = false;
|
||||
bool m_focusInput = false;
|
||||
|
||||
char* m_input;
|
||||
std::unique_ptr<ollama::messages> m_chat;
|
||||
|
||||
Reference in New Issue
Block a user