yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
agent_chat_history_popup.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_AGENT_AGENT_CHAT_HISTORY_POPUP_H
2#define YAZE_APP_EDITOR_AGENT_AGENT_CHAT_HISTORY_POPUP_H
3
4#include <string>
5#include <vector>
6
8
9namespace yaze {
10namespace editor {
11
12class ToastManager;
13
29 public:
32
33 // Set dependencies
34 void SetToastManager(ToastManager* toast_manager) {
35 toast_manager_ = toast_manager;
36 }
37
38 // Render the popup UI
39 void Draw();
40
41 // Show/hide the popup
42 void Show() { visible_ = true; }
43 void Hide() { visible_ = false; }
44 void Toggle() { visible_ = !visible_; }
45 bool IsVisible() const { return visible_; }
46
47 // Update history from service
48 void UpdateHistory(const std::vector<cli::agent::ChatMessage>& history);
49
50 // Notify of new message (triggers auto-scroll)
51 void NotifyNewMessage();
52
53 // Set callback for opening full chat window
54 using OpenChatCallback = std::function<void()>;
56 open_chat_callback_ = std::move(callback);
57 }
58
59 // Set callback for sending messages
60 using SendMessageCallback = std::function<void(const std::string&)>;
62 send_message_callback_ = std::move(callback);
63 }
64
65 // Set callback for capturing snapshots
66 using CaptureSnapshotCallback = std::function<void()>;
68 capture_snapshot_callback_ = std::move(callback);
69 }
70
71 private:
72 void DrawHeader();
73 void DrawMessageList();
74 void DrawMessage(const cli::agent::ChatMessage& msg, int index);
75 void DrawInputSection();
76 void DrawQuickActions();
77
78 void SendMessage(const std::string& message);
79 void ClearHistory();
80 void ExportHistory();
81 void ScrollToBottom();
82
83 bool visible_ = false;
84 bool needs_scroll_ = false;
85 bool auto_scroll_ = true;
86 bool compact_mode_ = true;
88
89 // History state
90 std::vector<cli::agent::ChatMessage> messages_;
91 int display_limit_ = 50; // Show last 50 messages
92
93 // Input state
94 char input_buffer_[512] = {};
95 bool focus_input_ = false;
96
97 // UI state
98 float drawer_width_ = 420.0f;
99 float min_drawer_width_ = 300.0f;
100 float max_drawer_width_ = 700.0f;
101 bool is_resizing_ = false;
102
103 // Filter state
104 enum class MessageFilter {
105 kAll,
106 kUserOnly,
108 };
110
111 // Visual state
112 float header_pulse_ = 0.0f;
114
115 // Retro hacker aesthetic animations
116 float pulse_animation_ = 0.0f;
117 float scanline_offset_ = 0.0f;
118 float glitch_animation_ = 0.0f;
120
121 // Dependencies
126};
127
128} // namespace editor
129} // namespace yaze
130
131#endif // YAZE_APP_EDITOR_AGENT_AGENT_CHAT_HISTORY_POPUP_H
ImGui popup drawer for displaying chat history on the left side.
void SetCaptureSnapshotCallback(CaptureSnapshotCallback callback)
void SetSendMessageCallback(SendMessageCallback callback)
void SetToastManager(ToastManager *toast_manager)
std::function< void(const std::string &)> SendMessageCallback
void SendMessage(const std::string &message)
void UpdateHistory(const std::vector< cli::agent::ChatMessage > &history)
void DrawMessage(const cli::agent::ChatMessage &msg, int index)
void SetOpenChatCallback(OpenChatCallback callback)
std::vector< cli::agent::ChatMessage > messages_
Main namespace for the application.