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

#include <enhanced_chat_component.h>

Collaboration diagram for yaze::cli::EnhancedChatComponent:

Public Member Functions

 EnhancedChatComponent (Rom *rom_context=nullptr)
 
ftxui::Component GetComponent ()
 
void SetRomContext (Rom *rom_context)
 
void SendMessage (const std::string &message)
 
void ClearHistory ()
 
void ResetConversation ()
 
bool IsFocused () const
 
void SetFocused (bool focused)
 
void SetMaxHistoryLines (int lines)
 
int GetMaxHistoryLines () const
 

Private Member Functions

ftxui::Component CreateInputComponent ()
 
ftxui::Component CreateHistoryComponent ()
 
ftxui::Component CreateChatContainer ()
 
bool HandleInputEvents (const ftxui::Event &event)
 
bool HandleHistoryEvents (const ftxui::Event &event)
 
void ProcessMessage (const std::string &message)
 
void AddMessageToHistory (const std::string &sender, const std::string &message)
 
void UpdateHistoryDisplay ()
 
ftxui::Element RenderChatMessage (const std::string &sender, const std::string &message)
 
ftxui::Element RenderInputArea ()
 
ftxui::Element RenderHistoryArea ()
 

Private Attributes

Romrom_context_
 
agent::ConversationalAgentService agent_service_
 
AutocompleteEngine autocomplete_engine_
 
std::string input_message_
 
std::vector< std::pair< std::string, std::string > > chat_history_
 
int selected_history_index_ = 0
 
bool focused_ = false
 
int max_history_lines_ = 20
 
ftxui::Component input_component_
 
ftxui::Component history_component_
 
ftxui::Component chat_container_
 
std::function< bool(const ftxui::Event &)> input_event_handler_
 
std::function< bool(const ftxui::Event &)> history_event_handler_
 

Detailed Description

Definition at line 18 of file enhanced_chat_component.h.

Constructor & Destructor Documentation

◆ EnhancedChatComponent()

Member Function Documentation

◆ GetComponent()

Component yaze::cli::EnhancedChatComponent::GetComponent ( )

Definition at line 44 of file enhanced_chat_component.cc.

References chat_container_.

◆ SetRomContext()

void yaze::cli::EnhancedChatComponent::SetRomContext ( Rom rom_context)

Definition at line 48 of file enhanced_chat_component.cc.

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

Here is the call graph for this function:

◆ SendMessage()

void yaze::cli::EnhancedChatComponent::SendMessage ( const std::string &  message)

Definition at line 55 of file enhanced_chat_component.cc.

References input_message_, and ProcessMessage().

Referenced by CreateInputComponent(), and HandleInputEvents().

Here is the call graph for this function:

◆ ClearHistory()

void yaze::cli::EnhancedChatComponent::ClearHistory ( )

Definition at line 62 of file enhanced_chat_component.cc.

References chat_history_, selected_history_index_, and UpdateHistoryDisplay().

Referenced by CreateInputComponent(), ProcessMessage(), and ResetConversation().

Here is the call graph for this function:

◆ ResetConversation()

void yaze::cli::EnhancedChatComponent::ResetConversation ( )

Definition at line 68 of file enhanced_chat_component.cc.

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

Here is the call graph for this function:

◆ IsFocused()

bool yaze::cli::EnhancedChatComponent::IsFocused ( ) const
inline

Definition at line 32 of file enhanced_chat_component.h.

References focused_.

◆ SetFocused()

void yaze::cli::EnhancedChatComponent::SetFocused ( bool  focused)
inline

Definition at line 33 of file enhanced_chat_component.h.

References focused_.

◆ SetMaxHistoryLines()

void yaze::cli::EnhancedChatComponent::SetMaxHistoryLines ( int  lines)
inline

Definition at line 36 of file enhanced_chat_component.h.

References max_history_lines_.

◆ GetMaxHistoryLines()

int yaze::cli::EnhancedChatComponent::GetMaxHistoryLines ( ) const
inline

Definition at line 37 of file enhanced_chat_component.h.

References max_history_lines_.

◆ CreateInputComponent()

Component yaze::cli::EnhancedChatComponent::CreateInputComponent ( )
private

Definition at line 73 of file enhanced_chat_component.cc.

References ClearHistory(), input_event_handler_, input_message_, and SendMessage().

Referenced by EnhancedChatComponent().

Here is the call graph for this function:

◆ CreateHistoryComponent()

Component yaze::cli::EnhancedChatComponent::CreateHistoryComponent ( )
private

Definition at line 93 of file enhanced_chat_component.cc.

References RenderHistoryArea().

Referenced by EnhancedChatComponent().

Here is the call graph for this function:

◆ CreateChatContainer()

Component yaze::cli::EnhancedChatComponent::CreateChatContainer ( )
private

Definition at line 99 of file enhanced_chat_component.cc.

References history_component_, and input_component_.

Referenced by EnhancedChatComponent().

◆ HandleInputEvents()

bool yaze::cli::EnhancedChatComponent::HandleInputEvents ( const ftxui::Event &  event)
private

Definition at line 118 of file enhanced_chat_component.cc.

References input_message_, and SendMessage().

Referenced by EnhancedChatComponent().

Here is the call graph for this function:

◆ HandleHistoryEvents()

bool yaze::cli::EnhancedChatComponent::HandleHistoryEvents ( const ftxui::Event &  event)
private

Definition at line 134 of file enhanced_chat_component.cc.

References chat_history_, and selected_history_index_.

Referenced by EnhancedChatComponent().

◆ ProcessMessage()

void yaze::cli::EnhancedChatComponent::ProcessMessage ( const std::string &  message)
private

◆ AddMessageToHistory()

void yaze::cli::EnhancedChatComponent::AddMessageToHistory ( const std::string &  sender,
const std::string &  message 
)
private

Definition at line 206 of file enhanced_chat_component.cc.

References chat_history_, max_history_lines_, and selected_history_index_.

Referenced by ProcessMessage().

◆ UpdateHistoryDisplay()

void yaze::cli::EnhancedChatComponent::UpdateHistoryDisplay ( )
private

Definition at line 218 of file enhanced_chat_component.cc.

Referenced by ClearHistory(), and ProcessMessage().

◆ RenderChatMessage()

Element yaze::cli::EnhancedChatComponent::RenderChatMessage ( const std::string &  sender,
const std::string &  message 
)
private

Definition at line 223 of file enhanced_chat_component.cc.

Referenced by RenderHistoryArea().

◆ RenderInputArea()

Element yaze::cli::EnhancedChatComponent::RenderInputArea ( )
private

Definition at line 240 of file enhanced_chat_component.cc.

References input_component_.

◆ RenderHistoryArea()

Element yaze::cli::EnhancedChatComponent::RenderHistoryArea ( )
private

Definition at line 247 of file enhanced_chat_component.cc.

References chat_history_, and RenderChatMessage().

Referenced by CreateHistoryComponent().

Here is the call graph for this function:

Member Data Documentation

◆ rom_context_

Rom* yaze::cli::EnhancedChatComponent::rom_context_
private

Definition at line 60 of file enhanced_chat_component.h.

Referenced by EnhancedChatComponent(), ProcessMessage(), and SetRomContext().

◆ agent_service_

agent::ConversationalAgentService yaze::cli::EnhancedChatComponent::agent_service_
private

◆ autocomplete_engine_

AutocompleteEngine yaze::cli::EnhancedChatComponent::autocomplete_engine_
private

Definition at line 62 of file enhanced_chat_component.h.

Referenced by EnhancedChatComponent().

◆ input_message_

std::string yaze::cli::EnhancedChatComponent::input_message_
private

Definition at line 65 of file enhanced_chat_component.h.

Referenced by CreateInputComponent(), HandleInputEvents(), and SendMessage().

◆ chat_history_

std::vector<std::pair<std::string, std::string> > yaze::cli::EnhancedChatComponent::chat_history_
private

◆ selected_history_index_

int yaze::cli::EnhancedChatComponent::selected_history_index_ = 0
private

◆ focused_

bool yaze::cli::EnhancedChatComponent::focused_ = false
private

Definition at line 68 of file enhanced_chat_component.h.

Referenced by IsFocused(), ProcessMessage(), and SetFocused().

◆ max_history_lines_

int yaze::cli::EnhancedChatComponent::max_history_lines_ = 20
private

◆ input_component_

ftxui::Component yaze::cli::EnhancedChatComponent::input_component_
private

◆ history_component_

ftxui::Component yaze::cli::EnhancedChatComponent::history_component_
private

Definition at line 73 of file enhanced_chat_component.h.

Referenced by CreateChatContainer(), and EnhancedChatComponent().

◆ chat_container_

ftxui::Component yaze::cli::EnhancedChatComponent::chat_container_
private

Definition at line 74 of file enhanced_chat_component.h.

Referenced by EnhancedChatComponent(), and GetComponent().

◆ input_event_handler_

std::function<bool(const ftxui::Event&)> yaze::cli::EnhancedChatComponent::input_event_handler_
private

Definition at line 77 of file enhanced_chat_component.h.

Referenced by CreateInputComponent(), and EnhancedChatComponent().

◆ history_event_handler_

std::function<bool(const ftxui::Event&)> yaze::cli::EnhancedChatComponent::history_event_handler_
private

Definition at line 78 of file enhanced_chat_component.h.

Referenced by EnhancedChatComponent().


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