#include <enhanced_chat_component.h>
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 | |
Rom * | rom_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_ |
Definition at line 18 of file enhanced_chat_component.h.
|
explicit |
Definition at line 15 of file enhanced_chat_component.cc.
References agent_service_, autocomplete_engine_, chat_container_, CreateChatContainer(), CreateHistoryComponent(), CreateInputComponent(), HandleHistoryEvents(), HandleInputEvents(), history_component_, history_event_handler_, input_component_, input_event_handler_, yaze::cli::AutocompleteEngine::RegisterCommand(), rom_context_, and yaze::cli::agent::ConversationalAgentService::SetRomContext().
Component yaze::cli::EnhancedChatComponent::GetComponent | ( | ) |
Definition at line 44 of file enhanced_chat_component.cc.
References chat_container_.
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().
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().
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().
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().
|
inline |
Definition at line 32 of file enhanced_chat_component.h.
References focused_.
|
inline |
Definition at line 33 of file enhanced_chat_component.h.
References focused_.
|
inline |
Definition at line 36 of file enhanced_chat_component.h.
References max_history_lines_.
|
inline |
Definition at line 37 of file enhanced_chat_component.h.
References max_history_lines_.
|
private |
Definition at line 73 of file enhanced_chat_component.cc.
References ClearHistory(), input_event_handler_, input_message_, and SendMessage().
Referenced by EnhancedChatComponent().
|
private |
Definition at line 93 of file enhanced_chat_component.cc.
References RenderHistoryArea().
Referenced by EnhancedChatComponent().
|
private |
Definition at line 99 of file enhanced_chat_component.cc.
References history_component_, and input_component_.
Referenced by EnhancedChatComponent().
|
private |
Definition at line 118 of file enhanced_chat_component.cc.
References input_message_, and SendMessage().
Referenced by EnhancedChatComponent().
|
private |
Definition at line 134 of file enhanced_chat_component.cc.
References chat_history_, and selected_history_index_.
Referenced by EnhancedChatComponent().
|
private |
Definition at line 152 of file enhanced_chat_component.cc.
References AddMessageToHistory(), agent_service_, chat_history_, ClearHistory(), focused_, rom_context_, yaze::cli::agent::ConversationalAgentService::SendMessage(), yaze::Rom::size(), yaze::Rom::title(), and UpdateHistoryDisplay().
Referenced by SendMessage().
|
private |
Definition at line 206 of file enhanced_chat_component.cc.
References chat_history_, max_history_lines_, and selected_history_index_.
Referenced by ProcessMessage().
|
private |
Definition at line 218 of file enhanced_chat_component.cc.
Referenced by ClearHistory(), and ProcessMessage().
|
private |
Definition at line 223 of file enhanced_chat_component.cc.
Referenced by RenderHistoryArea().
|
private |
Definition at line 240 of file enhanced_chat_component.cc.
References input_component_.
|
private |
Definition at line 247 of file enhanced_chat_component.cc.
References chat_history_, and RenderChatMessage().
Referenced by CreateHistoryComponent().
|
private |
Definition at line 60 of file enhanced_chat_component.h.
Referenced by EnhancedChatComponent(), ProcessMessage(), and SetRomContext().
|
private |
Definition at line 61 of file enhanced_chat_component.h.
Referenced by EnhancedChatComponent(), ProcessMessage(), ResetConversation(), and SetRomContext().
|
private |
Definition at line 62 of file enhanced_chat_component.h.
Referenced by EnhancedChatComponent().
|
private |
Definition at line 65 of file enhanced_chat_component.h.
Referenced by CreateInputComponent(), HandleInputEvents(), and SendMessage().
|
private |
Definition at line 66 of file enhanced_chat_component.h.
Referenced by AddMessageToHistory(), ClearHistory(), HandleHistoryEvents(), ProcessMessage(), and RenderHistoryArea().
|
private |
Definition at line 67 of file enhanced_chat_component.h.
Referenced by AddMessageToHistory(), ClearHistory(), and HandleHistoryEvents().
|
private |
Definition at line 68 of file enhanced_chat_component.h.
Referenced by IsFocused(), ProcessMessage(), and SetFocused().
|
private |
Definition at line 69 of file enhanced_chat_component.h.
Referenced by AddMessageToHistory(), GetMaxHistoryLines(), and SetMaxHistoryLines().
|
private |
Definition at line 72 of file enhanced_chat_component.h.
Referenced by CreateChatContainer(), EnhancedChatComponent(), and RenderInputArea().
|
private |
Definition at line 73 of file enhanced_chat_component.h.
Referenced by CreateChatContainer(), and EnhancedChatComponent().
|
private |
Definition at line 74 of file enhanced_chat_component.h.
Referenced by EnhancedChatComponent(), and GetComponent().
|
private |
Definition at line 77 of file enhanced_chat_component.h.
Referenced by CreateInputComponent(), and EnhancedChatComponent().
|
private |
Definition at line 78 of file enhanced_chat_component.h.
Referenced by EnhancedChatComponent().