yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
enhanced_chat_component.h
Go to the documentation of this file.
1#ifndef YAZE_CLI_TUI_ENHANCED_CHAT_COMPONENT_H
2#define YAZE_CLI_TUI_ENHANCED_CHAT_COMPONENT_H
3
4#include <ftxui/component/component.hpp>
5#include <ftxui/dom/elements.hpp>
6#include <memory>
7#include <string>
8#include <vector>
9
10#include "rom/rom.h"
13
14namespace yaze {
15namespace cli {
16
17// Enhanced chat component that integrates with the unified layout
19 public:
20 explicit EnhancedChatComponent(Rom* rom_context = nullptr);
21
22 // Component interface
23 ftxui::Component GetComponent();
24 void SetRomContext(Rom* rom_context);
25
26 // Chat functionality
27 void SendMessage(const std::string& message);
28 void ClearHistory();
29 void ResetConversation();
30
31 // State management
32 bool IsFocused() const { return focused_; }
33 void SetFocused(bool focused) { focused_ = focused; }
34
35 // Configuration
36 void SetMaxHistoryLines(int lines) { max_history_lines_ = lines; }
37 int GetMaxHistoryLines() const { return max_history_lines_; }
38
39 private:
40 // Component creation
41 ftxui::Component CreateInputComponent();
42 ftxui::Component CreateHistoryComponent();
43 ftxui::Component CreateChatContainer();
44
45 // Event handling
46 bool HandleInputEvents(const ftxui::Event& event);
47 bool HandleHistoryEvents(const ftxui::Event& event);
48
49 // Message processing
50 void ProcessMessage(const std::string& message);
51 void AddMessageToHistory(const std::string& sender,
52 const std::string& message);
54
55 // Rendering
56 ftxui::Element RenderChatMessage(const std::string& sender,
57 const std::string& message);
58 ftxui::Element RenderInputArea();
59 ftxui::Element RenderHistoryArea();
60
61 // State
65
66 // UI State
67 std::string input_message_;
68 std::vector<std::pair<std::string, std::string>> chat_history_;
70 bool focused_ = false;
72
73 // Components
74 ftxui::Component input_component_;
75 ftxui::Component history_component_;
76 ftxui::Component chat_container_;
77
78 // Event handlers
79 std::function<bool(const ftxui::Event&)> input_event_handler_;
80 std::function<bool(const ftxui::Event&)> history_event_handler_;
81};
82
83} // namespace cli
84} // namespace yaze
85
86#endif // YAZE_CLI_TUI_ENHANCED_CHAT_COMPONENT_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
void SendMessage(const std::string &message)
std::function< bool(const ftxui::Event &) input_event_handler_)
ftxui::Element RenderChatMessage(const std::string &sender, const std::string &message)
bool HandleHistoryEvents(const ftxui::Event &event)
void ProcessMessage(const std::string &message)
void AddMessageToHistory(const std::string &sender, const std::string &message)
agent::ConversationalAgentService agent_service_
bool HandleInputEvents(const ftxui::Event &event)
std::function< bool(const ftxui::Event &) history_event_handler_)
std::vector< std::pair< std::string, std::string > > chat_history_
EnhancedChatComponent(Rom *rom_context=nullptr)