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_.Initialize();
|
||||||
agent_editor_.InitializeWithDependencies(&toast_manager_, &proposal_drawer_, nullptr);
|
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
|
// Set up multimodal (vision) callbacks for Gemini
|
||||||
AgentChatWidget::MultimodalCallbacks multimodal_callbacks;
|
AgentChatWidget::MultimodalCallbacks multimodal_callbacks;
|
||||||
multimodal_callbacks.capture_snapshot =
|
multimodal_callbacks.capture_snapshot =
|
||||||
@@ -515,6 +521,16 @@ void EditorManager::Initialize(const std::string& filename) {
|
|||||||
context_.shortcut_manager.RegisterShortcut(
|
context_.shortcut_manager.RegisterShortcut(
|
||||||
"Agent Editor", {ImGuiKey_A, ImGuiMod_Ctrl, ImGuiMod_Shift},
|
"Agent Editor", {ImGuiKey_A, ImGuiMod_Ctrl, ImGuiMod_Shift},
|
||||||
[this]() { agent_editor_.SetChatActive(true); });
|
[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
|
#endif
|
||||||
|
|
||||||
// Testing shortcuts (only when tests are enabled)
|
// Testing shortcuts (only when tests are enabled)
|
||||||
@@ -876,6 +892,10 @@ void EditorManager::BuildModernMenu() {
|
|||||||
#ifdef YAZE_WITH_GRPC
|
#ifdef YAZE_WITH_GRPC
|
||||||
.Item("AI Agent", ICON_MD_SMART_TOY,
|
.Item("AI Agent", ICON_MD_SMART_TOY,
|
||||||
[this]() { agent_editor_.set_active(true); }, "Ctrl+Shift+A")
|
[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
|
#endif
|
||||||
.Separator()
|
.Separator()
|
||||||
.Item("Welcome Screen", ICON_MD_HOME,
|
.Item("Welcome Screen", ICON_MD_HOME,
|
||||||
@@ -1266,10 +1286,13 @@ void EditorManager::DrawMenuBar() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Agent proposal drawer
|
// Agent proposal drawer (right side)
|
||||||
proposal_drawer_.SetRom(current_rom_);
|
proposal_drawer_.SetRom(current_rom_);
|
||||||
proposal_drawer_.Draw();
|
proposal_drawer_.Draw();
|
||||||
|
|
||||||
|
// Agent chat history popup (left side)
|
||||||
|
agent_chat_history_popup_.Draw();
|
||||||
|
|
||||||
// Welcome screen (accessible from View menu)
|
// Welcome screen (accessible from View menu)
|
||||||
if (show_welcome_screen_) {
|
if (show_welcome_screen_) {
|
||||||
DrawWelcomeScreen();
|
DrawWelcomeScreen();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "app/editor/sprite/sprite_editor.h"
|
#include "app/editor/sprite/sprite_editor.h"
|
||||||
#include "app/editor/system/popup_manager.h"
|
#include "app/editor/system/popup_manager.h"
|
||||||
#include "app/editor/system/proposal_drawer.h"
|
#include "app/editor/system/proposal_drawer.h"
|
||||||
|
#include "app/editor/system/agent_chat_history_popup.h"
|
||||||
#ifdef YAZE_WITH_GRPC
|
#ifdef YAZE_WITH_GRPC
|
||||||
#include "app/editor/agent/agent_editor.h"
|
#include "app/editor/agent/agent_editor.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -190,6 +191,10 @@ class EditorManager {
|
|||||||
ProposalDrawer proposal_drawer_;
|
ProposalDrawer proposal_drawer_;
|
||||||
bool show_proposal_drawer_ = false;
|
bool show_proposal_drawer_ = false;
|
||||||
|
|
||||||
|
// Agent chat history popup
|
||||||
|
AgentChatHistoryPopup agent_chat_history_popup_;
|
||||||
|
bool show_chat_history_popup_ = false;
|
||||||
|
|
||||||
// Project file editor
|
// Project file editor
|
||||||
ProjectFileEditor project_file_editor_;
|
ProjectFileEditor project_file_editor_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user