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:
scawful
2025-10-03 12:39:48 -04:00
parent 655c5547b2
commit 208b9ade51
25 changed files with 689 additions and 242 deletions

View File

@@ -1,28 +1,28 @@
#include "cli/service/ai/ai_service.h"
#include "cli/service/agent/conversational_agent_service.h"
namespace yaze {
namespace cli {
absl::StatusOr<std::vector<std::string>> MockAIService::GetCommands(
absl::StatusOr<AgentResponse> MockAIService::GenerateResponse(
const std::string& prompt) {
// NOTE: These commands use positional arguments (not --flags) because
// the command handlers haven't been updated to parse flags yet.
// TODO: Update handlers to use absl::flags parsing
if (prompt == "Make all the soldiers in Hyrule Castle wear red armor.") {
// Simplified command sequence - just export then import
// (In reality, you'd modify the palette file between export and import)
return std::vector<std::string>{
"palette export sprites_aux1 4 soldier_palette.col"
// Would normally modify soldier_palette.col here to change colors
// Then import it back
};
} else if (prompt == "Place a tree") {
// Example: Place a tree on the light world map
// Command format: map_id x y tile_id (hex)
return std::vector<std::string>{"overworld set-tile 0 10 20 0x02E"};
AgentResponse response;
if (prompt == "Place a tree") {
response.text_response = "Sure, I can do that. Here is the command:";
response.commands.push_back("overworld set-tile 0 10 20 0x02E");
response.reasoning = "The user asked to place a tree, so I generated the appropriate `set-tile` command.";
} else {
response.text_response = "I'm sorry, I don't understand that prompt. Try 'Place a tree'.";
}
return absl::UnimplementedError("Prompt not supported by mock AI service. Try: 'Make all the soldiers in Hyrule Castle wear red armor.' or 'Place a tree'");
return response;
}
absl::StatusOr<AgentResponse> MockAIService::GenerateResponse(
const std::vector<agent::ChatMessage>& history) {
if (history.empty()) {
return absl::InvalidArgumentError("History cannot be empty.");
}
return GenerateResponse(history.back().message);
}
} // namespace cli