feat: Introduce Agent Chat History Popup for Enhanced User Interaction

- Added AgentChatHistoryPopup class to provide a sidebar for displaying recent chat messages, improving user accessibility to chat history.
- Integrated the new popup into the editor's source files, ensuring proper inclusion and functionality within the existing UI framework.
- Refactored related files to accommodate the new popup, enhancing code organization and maintainability.
- Updated CMake configuration to include the new source files, ensuring a seamless build process.
This commit is contained in:
scawful
2025-10-05 16:08:44 -04:00
parent c8d7eb3597
commit 409cf357af
8 changed files with 528 additions and 91 deletions

View File

@@ -1,4 +1,4 @@
#include "app/editor/system/agent_chat_history_popup.h"
#include "app/editor/agent/agent_chat_history_popup.h"
#include <cstring>

View File

@@ -1,5 +1,5 @@
#ifndef YAZE_APP_EDITOR_SYSTEM_AGENT_CHAT_HISTORY_POPUP_H
#define YAZE_APP_EDITOR_SYSTEM_AGENT_CHAT_HISTORY_POPUP_H
#ifndef YAZE_APP_EDITOR_AGENT_AGENT_CHAT_HISTORY_POPUP_H
#define YAZE_APP_EDITOR_AGENT_AGENT_CHAT_HISTORY_POPUP_H
#include <string>
#include <vector>
@@ -122,4 +122,4 @@ class AgentChatHistoryPopup {
} // namespace editor
} // namespace yaze
#endif // YAZE_APP_EDITOR_SYSTEM_AGENT_CHAT_HISTORY_POPUP_H
#endif // YAZE_APP_EDITOR_AGENT_AGENT_CHAT_HISTORY_POPUP_H

View File

@@ -21,7 +21,7 @@
#include "app/core/project.h"
#include "app/editor/agent/agent_chat_history_codec.h"
#include "app/editor/agent/agent_ui_theme.h"
#include "app/editor/system/agent_chat_history_popup.h"
#include "app/editor/agent/agent_chat_history_popup.h"
#include "app/editor/system/proposal_drawer.h"
#include "app/editor/system/toast_manager.h"
#include "app/gui/icons.h"
@@ -1348,14 +1348,13 @@ void AgentChatWidget::RenderCollaborationPanel() {
}
void AgentChatWidget::RenderMultimodalPanel() {
const auto& theme = AgentUI::GetTheme();
ImGui::PushID("MultimodalPanel");
ImVec4 gemini_color = ImVec4(0.196f, 0.6f, 0.8f, 1.0f);
// Dense header (no collapsing for small panel)
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.16f, 0.20f, 0.95f));
ImGui::BeginChild("Multimodal_Panel", ImVec2(0, 100), true);
ImGui::TextColored(gemini_color, ICON_MD_CAMERA " Vision");
ImGui::Separator();
AgentUI::PushPanelStyle();
ImGui::BeginChild("Multimodal_Panel", ImVec2(0, 120), true); // Slightly taller
AgentUI::RenderSectionHeader(ICON_MD_CAMERA, "Vision", theme.provider_gemini);
bool can_capture = static_cast<bool>(multimodal_callbacks_.capture_snapshot);
bool can_send = static_cast<bool>(multimodal_callbacks_.send_to_gemini);
@@ -1405,7 +1404,7 @@ void AgentChatWidget::RenderMultimodalPanel() {
ImGui::SameLine();
if (multimodal_state_.last_capture_path.has_value()) {
ImGui::TextColored(gemini_color, ICON_MD_CHECK_CIRCLE);
ImGui::TextColored(theme.status_success, ICON_MD_CHECK_CIRCLE);
} else {
ImGui::TextDisabled(ICON_MD_CAMERA_ALT);
}

View File

@@ -41,7 +41,6 @@ set(
app/editor/system/shortcut_manager.cc
app/editor/system/popup_manager.cc
app/editor/system/proposal_drawer.cc
app/editor/system/agent_chat_history_popup.cc
app/editor/agent/agent_chat_history_codec.cc
)
@@ -49,6 +48,7 @@ if(YAZE_WITH_GRPC)
list(APPEND YAZE_APP_EDITOR_SRC
app/editor/agent/agent_editor.cc
app/editor/agent/agent_chat_widget.cc
app/editor/agent/agent_chat_history_popup.cc
app/editor/agent/agent_ui_theme.cc
app/editor/agent/agent_collaboration_coordinator.cc
app/editor/agent/network_collaboration_coordinator.cc

View File

@@ -25,7 +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"
#include "app/editor/agent/agent_chat_history_popup.h"
#ifdef YAZE_WITH_GRPC
#include "app/editor/agent/agent_editor.h"
#include "app/editor/agent/automation_bridge.h"

View File

@@ -25,6 +25,7 @@
#include "app/gui/icons.h"
#include "app/gui/input.h"
#include "app/gui/style.h"
#include "app/gui/ui_helpers.h"
#include "app/gui/widgets/widget_id_registry.h"
#include "app/rom.h"
#include "app/zelda3/common.h"
@@ -453,16 +454,15 @@ void OverworldEditor::DrawOverworldMapSettings() {
// Header with ROM version indicator and upgrade option
if (asm_version == 0xFF) {
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "Vanilla ROM");
if (ImGui::Button(ICON_MD_UPGRADE " Upgrade to v3")) {
gui::RomVersionBadge("Vanilla ROM", true);
if (gui::IconButton(ICON_MD_UPGRADE, "Upgrade to v3")) {
// Show upgrade dialog
ImGui::OpenPopup("UpgradeROMVersion");
}
HOVER_HINT("Upgrade ROM to support ZSCustomOverworld features");
} else {
ImGui::TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
"ZSCustomOverworld v%d", asm_version);
if (asm_version < 3 && ImGui::Button(ICON_MD_UPGRADE " Upgrade to v3")) {
gui::RomVersionBadge(absl::StrFormat("ZSCustomOverworld v%d", asm_version).c_str(), false);
if (asm_version < 3 && gui::IconButton(ICON_MD_UPGRADE, "Upgrade to v3")) {
ImGui::OpenPopup("UpgradeROMVersion");
}
}
@@ -482,23 +482,20 @@ void OverworldEditor::DrawOverworldMapSettings() {
// Show ASM application option if feature flag is enabled
if (core::FeatureFlags::get().overworld.kApplyZSCustomOverworldASM) {
ImGui::TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
ICON_MD_CODE " ASM Patch Application Enabled");
ImGui::Text(
"ZSCustomOverworld ASM will be automatically applied to ROM");
gui::SectionHeader(ICON_MD_CODE, "ASM Patch Application Enabled", gui::GetSuccessColor());
ImGui::Text("ZSCustomOverworld ASM will be automatically applied to ROM");
ImGui::Separator();
} else {
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f),
ICON_MD_INFO " ASM Patch Application Disabled");
gui::SectionHeader(ICON_MD_INFO, "ASM Patch Application Disabled", gui::GetWarningColor());
ImGui::Text("Only version marker will be set. Enable in Feature Flags");
ImGui::Text("for full ASM functionality.");
ImGui::Separator();
}
ImGui::TextColored(ImVec4(1.0f, 0.5f, 0.0f, 1.0f),
"Warning: This will modify your ROM!");
ImGui::TextColored(gui::GetWarningColor(),
ICON_MD_WARNING " Warning: This will modify your ROM!");
if (ImGui::Button(ICON_MD_CHECK " Upgrade", ImVec2(120, 0))) {
if (gui::ColoredButton(ICON_MD_CHECK " Upgrade", gui::ButtonType::Success, ImVec2(120, 0))) {
// Apply ASM if feature flag is enabled
if (core::FeatureFlags::get().overworld.kApplyZSCustomOverworldASM) {
auto asm_status = ApplyZSCustomOverworldASM(3);
@@ -1611,7 +1608,7 @@ void OverworldEditor::DrawOverworldEntrances(ImVec2 canvas_p0, ImVec2 scrolling,
if (each.is_hole_) {
color = ImVec4(255, 255, 0, 200);
}
ow_map_canvas_.DrawRect(each.x_, each.y_, 16, 16, color);
ow_map_canvas_.DrawRect(each.x_, each.y_, 16, 16, gui::GetEntranceColor());
std::string str = util::HexByte(each.entrance_id_);
if (current_mode == EditingMode::ENTRANCES) {
@@ -1673,7 +1670,7 @@ void OverworldEditor::DrawOverworldExits(ImVec2 canvas_p0, ImVec2 scrolling) {
if (each.map_id_ < 0x40 + (current_world_ * 0x40) &&
each.map_id_ >= (current_world_ * 0x40) && !each.deleted_) {
ow_map_canvas_.DrawRect(each.x_, each.y_, 16, 16,
ImVec4(255, 255, 255, 150));
gui::GetExitColor());
if (current_mode == EditingMode::EXITS) {
each.entity_id_ = i;
HandleEntityDragging(&each, ow_map_canvas_.zero_point(),
@@ -1724,7 +1721,7 @@ void OverworldEditor::DrawOverworldItems() {
// Get the item's bitmap and real X and Y positions
if (item.room_map_id_ < 0x40 + (current_world_ * 0x40) &&
item.room_map_id_ >= (current_world_ * 0x40) && !item.deleted) {
ow_map_canvas_.DrawRect(item.x_, item.y_, 16, 16, ImVec4(255, 0, 0, 150));
ow_map_canvas_.DrawRect(item.x_, item.y_, 16, 16, gui::GetItemColor());
if (current_mode == EditingMode::ITEMS) {
// Check if this item is being clicked and dragged
@@ -1784,7 +1781,7 @@ void OverworldEditor::DrawOverworldSprites() {
int original_y = sprite.y_;
ow_map_canvas_.DrawRect(sprite_x, sprite_y, kTile16Size, kTile16Size,
/*magenta=*/ImVec4(255, 0, 255, 150));
gui::GetSpriteColor());
if (current_mode == EditingMode::SPRITES) {
HandleEntityDragging(&sprite, ow_map_canvas_.zero_point(),
ow_map_canvas_.scrolling(), is_dragging_entity_,
@@ -2816,16 +2813,15 @@ void OverworldEditor::DrawOverlayPreview() {
void OverworldEditor::DrawMapLockControls() {
if (current_map_lock_) {
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.5f, 0.0f, 1.0f));
Text("Map Locked: %d (0x%02X)", current_map_, current_map_);
PopStyleColor();
if (Button("Unlock Map")) {
gui::LockIndicator(true, absl::StrFormat("Map %d (0x%02X)", current_map_, current_map_).c_str());
if (gui::IconButton(ICON_MD_LOCK_OPEN, "Unlock Map")) {
current_map_lock_ = false;
}
} else {
Text("Map: %d (0x%02X) - Click to lock", current_map_, current_map_);
if (Button("Lock Map")) {
gui::LockIndicator(false, absl::StrFormat("Map %d (0x%02X)", current_map_, current_map_).c_str());
if (gui::IconButton(ICON_MD_LOCK, "Lock Map")) {
current_map_lock_ = true;
}
}
@@ -2957,17 +2953,14 @@ void OverworldEditor::DrawMapPropertiesPanel() {
// Header with map info and lock status
ImGui::BeginGroup();
if (current_map_lock_) {
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.5f, 0.0f, 1.0f));
Text("Map Locked: %d (0x%02X)", current_map_, current_map_);
PopStyleColor();
} else {
Text("Current Map: %d (0x%02X)", current_map_, current_map_);
}
gui::LockIndicator(current_map_lock_,
absl::StrFormat("Map %d (0x%02X)", current_map_, current_map_).c_str());
SameLine();
if (Button(current_map_lock_ ? "Unlock" : "Lock")) {
current_map_lock_ = !current_map_lock_;
if (gui::ToggleIconButton(ICON_MD_LOCK_OPEN, ICON_MD_LOCK,
&current_map_lock_,
current_map_lock_ ? "Unlock Map" : "Lock Map")) {
// Toggle handled by helper
}
ImGui::EndGroup();
@@ -3538,9 +3531,7 @@ void OverworldEditor::DrawUsageGrid() {
// Set highlight color if needed
if (highlight) {
PushStyleColor(ImGuiCol_Button,
ImVec4(1.0f, 0.5f, 0.0f,
1.0f)); // Or any highlight color
PushStyleColor(ImGuiCol_Button, gui::GetSelectedColor());
}
// Create a button or selectable for each square