yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::tui::ChatTUI Class Reference

#include <chat_tui.h>

Collaboration diagram for yaze::cli::tui::ChatTUI:

Public Member Functions

 ChatTUI (Rom *rom_context=nullptr)
 
 ~ChatTUI ()
 
void Run ()
 
void SetRomContext (Rom *rom_context)
 

Private Member Functions

void OnSubmit (const std::string &message)
 
void LaunchAgentPrompt (const std::string &prompt)
 
void CleanupWorkers ()
 
void StopSpinner ()
 
void InitializeAutocomplete ()
 
agent::ChatMessage::SessionMetrics CurrentMetrics () const
 
void ToggleTodoPopup ()
 
ftxui::Component CreateTodoPopup ()
 
ftxui::Component BuildShortcutPalette ()
 
bool IsPopupOpen () const
 
void ToggleShortcutPalette ()
 

Private Attributes

ftxui::ScreenInteractive screen_ = ftxui::ScreenInteractive::Fullscreen()
 
agent::ConversationalAgentService agent_service_
 
agent::TodoManager todo_manager_
 
Romrom_context_ = nullptr
 
std::optional< std::string > last_error_
 
AutocompleteEngine autocomplete_engine_
 
std::string rom_header_
 
std::atomic< bool > agent_busy_ {false}
 
std::atomic< bool > spinner_running_ {false}
 
std::atomic< int > spinner_index_ {0}
 
std::vector< std::future< void > > worker_futures_
 
std::mutex worker_mutex_
 
std::chrono::steady_clock::time_point last_send_time_ {}
 
double last_response_seconds_ = 0.0
 
std::vector< double > latency_history_
 
std::vector< std::string > quick_actions_
 
std::thread spinner_thread_
 
bool todo_popup_visible_ = false
 
ftxui::Component todo_popup_component_
 
ftxui::Component shortcut_palette_component_
 
bool shortcut_palette_visible_ = false
 
bool todo_manager_ready_ = false
 

Detailed Description

Definition at line 26 of file chat_tui.h.

Constructor & Destructor Documentation

◆ ChatTUI()

◆ ~ChatTUI()

yaze::cli::tui::ChatTUI::~ChatTUI ( )

Definition at line 83 of file chat_tui.cc.

References CleanupWorkers().

Here is the call graph for this function:

Member Function Documentation

◆ Run()

◆ SetRomContext()

void yaze::cli::tui::ChatTUI::SetRomContext ( Rom rom_context)

Definition at line 87 of file chat_tui.cc.

References agent_service_, rom_context_, rom_header_, yaze::cli::agent::ConversationalAgentService::SetRomContext(), yaze::Rom::size(), and yaze::Rom::title().

Here is the call graph for this function:

◆ OnSubmit()

void yaze::cli::tui::ChatTUI::OnSubmit ( const std::string &  message)
private

◆ LaunchAgentPrompt()

void yaze::cli::tui::ChatTUI::LaunchAgentPrompt ( const std::string &  prompt)
private

◆ CleanupWorkers()

void yaze::cli::tui::ChatTUI::CleanupWorkers ( )
private

Definition at line 467 of file chat_tui.cc.

References StopSpinner(), worker_futures_, and worker_mutex_.

Referenced by ~ChatTUI().

Here is the call graph for this function:

◆ StopSpinner()

void yaze::cli::tui::ChatTUI::StopSpinner ( )
private

Definition at line 483 of file chat_tui.cc.

References spinner_running_, and spinner_thread_.

Referenced by CleanupWorkers(), and LaunchAgentPrompt().

◆ InitializeAutocomplete()

void yaze::cli::tui::ChatTUI::InitializeAutocomplete ( )
private

Definition at line 97 of file chat_tui.cc.

References autocomplete_engine_, and yaze::cli::AutocompleteEngine::RegisterCommand().

Referenced by ChatTUI().

Here is the call graph for this function:

◆ CurrentMetrics()

agent::ChatMessage::SessionMetrics yaze::cli::tui::ChatTUI::CurrentMetrics ( ) const
private

Definition at line 479 of file chat_tui.cc.

References agent_service_, and yaze::cli::agent::ConversationalAgentService::GetMetrics().

Referenced by Run().

Here is the call graph for this function:

◆ ToggleTodoPopup()

void yaze::cli::tui::ChatTUI::ToggleTodoPopup ( )
private

Definition at line 490 of file chat_tui.cc.

References CreateTodoPopup(), screen_, todo_popup_component_, and todo_popup_visible_.

Referenced by Run().

Here is the call graph for this function:

◆ CreateTodoPopup()

ftxui::Component yaze::cli::tui::ChatTUI::CreateTodoPopup ( )
private

Definition at line 510 of file chat_tui.cc.

References yaze::cli::agent::TodoManager::GetAllTodos(), screen_, todo_manager_, todo_manager_ready_, and todo_popup_visible_.

Referenced by Run(), and ToggleTodoPopup().

Here is the call graph for this function:

◆ BuildShortcutPalette()

ftxui::Component yaze::cli::tui::ChatTUI::BuildShortcutPalette ( )
private

Definition at line 553 of file chat_tui.cc.

Referenced by Run(), and ToggleShortcutPalette().

◆ IsPopupOpen()

bool yaze::cli::tui::ChatTUI::IsPopupOpen ( ) const
private

Definition at line 591 of file chat_tui.cc.

◆ ToggleShortcutPalette()

void yaze::cli::tui::ChatTUI::ToggleShortcutPalette ( )
private

Definition at line 500 of file chat_tui.cc.

References BuildShortcutPalette(), screen_, shortcut_palette_component_, and shortcut_palette_visible_.

Referenced by Run().

Here is the call graph for this function:

Member Data Documentation

◆ screen_

ftxui::ScreenInteractive yaze::cli::tui::ChatTUI::screen_ = ftxui::ScreenInteractive::Fullscreen()
private

◆ agent_service_

agent::ConversationalAgentService yaze::cli::tui::ChatTUI::agent_service_
private

Definition at line 50 of file chat_tui.h.

Referenced by ChatTUI(), CurrentMetrics(), LaunchAgentPrompt(), OnSubmit(), Run(), and SetRomContext().

◆ todo_manager_

agent::TodoManager yaze::cli::tui::ChatTUI::todo_manager_
private

Definition at line 51 of file chat_tui.h.

Referenced by ChatTUI(), and CreateTodoPopup().

◆ rom_context_

Rom* yaze::cli::tui::ChatTUI::rom_context_ = nullptr
private

Definition at line 52 of file chat_tui.h.

Referenced by ChatTUI(), and SetRomContext().

◆ last_error_

std::optional<std::string> yaze::cli::tui::ChatTUI::last_error_
private

Definition at line 53 of file chat_tui.h.

Referenced by OnSubmit(), and Run().

◆ autocomplete_engine_

AutocompleteEngine yaze::cli::tui::ChatTUI::autocomplete_engine_
private

Definition at line 54 of file chat_tui.h.

Referenced by InitializeAutocomplete(), and Run().

◆ rom_header_

std::string yaze::cli::tui::ChatTUI::rom_header_
private

Definition at line 55 of file chat_tui.h.

Referenced by ChatTUI(), Run(), and SetRomContext().

◆ agent_busy_

std::atomic<bool> yaze::cli::tui::ChatTUI::agent_busy_ {false}
private

Definition at line 57 of file chat_tui.h.

Referenced by LaunchAgentPrompt(), and Run().

◆ spinner_running_

std::atomic<bool> yaze::cli::tui::ChatTUI::spinner_running_ {false}
private

Definition at line 58 of file chat_tui.h.

Referenced by LaunchAgentPrompt(), and StopSpinner().

◆ spinner_index_

std::atomic<int> yaze::cli::tui::ChatTUI::spinner_index_ {0}
private

Definition at line 59 of file chat_tui.h.

Referenced by Run().

◆ worker_futures_

std::vector<std::future<void> > yaze::cli::tui::ChatTUI::worker_futures_
private

Definition at line 61 of file chat_tui.h.

Referenced by CleanupWorkers(), and LaunchAgentPrompt().

◆ worker_mutex_

std::mutex yaze::cli::tui::ChatTUI::worker_mutex_
mutableprivate

Definition at line 62 of file chat_tui.h.

Referenced by CleanupWorkers(), and LaunchAgentPrompt().

◆ last_send_time_

std::chrono::steady_clock::time_point yaze::cli::tui::ChatTUI::last_send_time_ {}
private

Definition at line 63 of file chat_tui.h.

Referenced by LaunchAgentPrompt().

◆ last_response_seconds_

double yaze::cli::tui::ChatTUI::last_response_seconds_ = 0.0
private

Definition at line 64 of file chat_tui.h.

Referenced by LaunchAgentPrompt(), and Run().

◆ latency_history_

std::vector<double> yaze::cli::tui::ChatTUI::latency_history_
private

Definition at line 65 of file chat_tui.h.

Referenced by LaunchAgentPrompt(), and Run().

◆ quick_actions_

std::vector<std::string> yaze::cli::tui::ChatTUI::quick_actions_
private

Definition at line 67 of file chat_tui.h.

Referenced by ChatTUI(), and Run().

◆ spinner_thread_

std::thread yaze::cli::tui::ChatTUI::spinner_thread_
private

Definition at line 69 of file chat_tui.h.

Referenced by LaunchAgentPrompt(), and StopSpinner().

◆ todo_popup_visible_

bool yaze::cli::tui::ChatTUI::todo_popup_visible_ = false
private

Definition at line 72 of file chat_tui.h.

Referenced by CreateTodoPopup(), Run(), and ToggleTodoPopup().

◆ todo_popup_component_

ftxui::Component yaze::cli::tui::ChatTUI::todo_popup_component_
private

Definition at line 73 of file chat_tui.h.

Referenced by Run(), and ToggleTodoPopup().

◆ shortcut_palette_component_

ftxui::Component yaze::cli::tui::ChatTUI::shortcut_palette_component_
private

Definition at line 74 of file chat_tui.h.

Referenced by Run(), and ToggleShortcutPalette().

◆ shortcut_palette_visible_

bool yaze::cli::tui::ChatTUI::shortcut_palette_visible_ = false
private

Definition at line 75 of file chat_tui.h.

Referenced by Run(), and ToggleShortcutPalette().

◆ todo_manager_ready_

bool yaze::cli::tui::ChatTUI::todo_manager_ready_ = false
private

Definition at line 76 of file chat_tui.h.

Referenced by ChatTUI(), and CreateTodoPopup().


The documentation for this class was generated from the following files: