Enhance agent chat functionality with ROM context support and structured message rendering

This commit is contained in:
scawful
2025-10-03 14:46:22 -04:00
parent dc6040551e
commit 3715ae98eb
11 changed files with 341 additions and 29 deletions

View File

@@ -1,6 +1,7 @@
#ifndef YAZE_SRC_CLI_SERVICE_AGENT_CONVERSATIONAL_AGENT_SERVICE_H_
#define YAZE_SRC_CLI_SERVICE_AGENT_CONVERSATIONAL_AGENT_SERVICE_H_
#include <optional>
#include <string>
#include <vector>
@@ -9,14 +10,23 @@
#include "cli/service/agent/tool_dispatcher.h"
namespace yaze {
class Rom;
namespace cli {
namespace agent {
struct ChatMessage {
enum class Sender { kUser, kAgent };
struct TableData {
std::vector<std::string> headers;
std::vector<std::vector<std::string>> rows;
};
Sender sender;
std::string message;
absl::Time timestamp;
std::optional<std::string> json_pretty;
std::optional<TableData> table_data;
};
class ConversationalAgentService {
@@ -29,10 +39,14 @@ class ConversationalAgentService {
// Get the full chat history.
const std::vector<ChatMessage>& GetHistory() const;
// Provide the service with a ROM context for tool execution.
void SetRomContext(Rom* rom);
private:
std::vector<ChatMessage> history_;
std::unique_ptr<AIService> ai_service_;
ToolDispatcher tool_dispatcher_;
Rom* rom_context_ = nullptr;
};
} // namespace agent