feat: Integrate Chat History Popup and Shortcuts in EditorManager
- Initialized the AgentChatHistoryPopup within the EditorManager, enhancing user interaction by providing quick access to chat history. - Added keyboard shortcuts for toggling the Chat History Popup and Proposal Drawer, improving workflow efficiency. - Updated the menu to include options for accessing the Chat History and Proposal Drawer, streamlining user navigation. - Enhanced the drawing logic to ensure the chat history popup is displayed alongside the proposal drawer for better visibility.
This commit is contained in:
@@ -242,6 +242,12 @@ void EditorManager::Initialize(const std::string& filename) {
|
||||
agent_editor_.Initialize();
|
||||
agent_editor_.InitializeWithDependencies(&toast_manager_, &proposal_drawer_, nullptr);
|
||||
|
||||
// Initialize and connect the chat history popup
|
||||
agent_chat_history_popup_.SetToastManager(&toast_manager_);
|
||||
if (agent_editor_.GetChatWidget()) {
|
||||
agent_editor_.GetChatWidget()->SetChatHistoryPopup(&agent_chat_history_popup_);
|
||||
}
|
||||
|
||||
// Set up multimodal (vision) callbacks for Gemini
|
||||
AgentChatWidget::MultimodalCallbacks multimodal_callbacks;
|
||||
multimodal_callbacks.capture_snapshot =
|
||||
@@ -515,6 +521,16 @@ void EditorManager::Initialize(const std::string& filename) {
|
||||
context_.shortcut_manager.RegisterShortcut(
|
||||
"Agent Editor", {ImGuiKey_A, ImGuiMod_Ctrl, ImGuiMod_Shift},
|
||||
[this]() { agent_editor_.SetChatActive(true); });
|
||||
|
||||
// Agent Chat History Popup shortcut
|
||||
context_.shortcut_manager.RegisterShortcut(
|
||||
"Chat History Popup", {ImGuiKey_H, ImGuiMod_Ctrl},
|
||||
[this]() { agent_chat_history_popup_.Toggle(); });
|
||||
|
||||
// Agent Proposal Drawer shortcut
|
||||
context_.shortcut_manager.RegisterShortcut(
|
||||
"Proposal Drawer", {ImGuiKey_P, ImGuiMod_Ctrl},
|
||||
[this]() { proposal_drawer_.Toggle(); });
|
||||
#endif
|
||||
|
||||
// Testing shortcuts (only when tests are enabled)
|
||||
@@ -876,6 +892,10 @@ void EditorManager::BuildModernMenu() {
|
||||
#ifdef YAZE_WITH_GRPC
|
||||
.Item("AI Agent", ICON_MD_SMART_TOY,
|
||||
[this]() { agent_editor_.set_active(true); }, "Ctrl+Shift+A")
|
||||
.Item("Chat History", ICON_MD_CHAT,
|
||||
[this]() { agent_chat_history_popup_.Toggle(); }, "Ctrl+H")
|
||||
.Item("Proposal Drawer", ICON_MD_PREVIEW,
|
||||
[this]() { proposal_drawer_.Toggle(); }, "Ctrl+P")
|
||||
#endif
|
||||
.Separator()
|
||||
.Item("Welcome Screen", ICON_MD_HOME,
|
||||
@@ -1266,10 +1286,13 @@ void EditorManager::DrawMenuBar() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Agent proposal drawer
|
||||
// Agent proposal drawer (right side)
|
||||
proposal_drawer_.SetRom(current_rom_);
|
||||
proposal_drawer_.Draw();
|
||||
|
||||
// Agent chat history popup (left side)
|
||||
agent_chat_history_popup_.Draw();
|
||||
|
||||
// Welcome screen (accessible from View menu)
|
||||
if (show_welcome_screen_) {
|
||||
DrawWelcomeScreen();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "app/editor/sprite/sprite_editor.h"
|
||||
#include "app/editor/system/popup_manager.h"
|
||||
#include "app/editor/system/proposal_drawer.h"
|
||||
#include "app/editor/system/agent_chat_history_popup.h"
|
||||
#ifdef YAZE_WITH_GRPC
|
||||
#include "app/editor/agent/agent_editor.h"
|
||||
#endif
|
||||
@@ -189,6 +190,10 @@ class EditorManager {
|
||||
// Agent proposal drawer
|
||||
ProposalDrawer proposal_drawer_;
|
||||
bool show_proposal_drawer_ = false;
|
||||
|
||||
// Agent chat history popup
|
||||
AgentChatHistoryPopup agent_chat_history_popup_;
|
||||
bool show_chat_history_popup_ = false;
|
||||
|
||||
// Project file editor
|
||||
ProjectFileEditor project_file_editor_;
|
||||
|
||||
Reference in New Issue
Block a user