Integrate AI Agent Services and Chat Interface
- Added support for AI agent services, including `ConversationalAgentService`, to facilitate user interactions through a chat interface. - Implemented `ChatTUI` for a terminal-based chat experience, allowing users to send messages and receive responses from the AI agent. - Updated `EditorManager` to include options for displaying the agent chat widget and performance dashboard. - Enhanced CMake configurations to include new source files for AI services and chat interface components. This commit significantly expands the functionality of the z3ed system, paving the way for a more interactive and user-friendly experience in ROM hacking.
This commit is contained in:
42
src/app/editor/system/agent_chat_widget.cc
Normal file
42
src/app/editor/system/agent_chat_widget.cc
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "app/editor/system/agent_chat_widget.h"
|
||||
#include "imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace editor {
|
||||
|
||||
AgentChatWidget::AgentChatWidget() {
|
||||
title_ = "Agent Chat";
|
||||
memset(input_buffer_, 0, sizeof(input_buffer_));
|
||||
}
|
||||
|
||||
void AgentChatWidget::Draw() {
|
||||
if (!active_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::Begin(title_.c_str(), &active_);
|
||||
|
||||
// Display message history
|
||||
ImGui::BeginChild("History", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()));
|
||||
for (const auto& msg : agent_service_.GetHistory()) {
|
||||
std::string prefix =
|
||||
msg.sender == cli::agent::ChatMessage::Sender::kUser ? "You: " : "Agent: ";
|
||||
ImGui::TextWrapped((prefix + msg.message).c_str());
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
// Display input text box
|
||||
if (ImGui::InputText("Input", input_buffer_, sizeof(input_buffer_),
|
||||
ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
if (strlen(input_buffer_) > 0) {
|
||||
(void)agent_service_.SendMessage(input_buffer_);
|
||||
memset(input_buffer_, 0, sizeof(input_buffer_));
|
||||
}
|
||||
ImGui::SetKeyboardFocusHere(-1); // Refocus input
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
Reference in New Issue
Block a user