Add YAML support and enhance AI service context handling

- Integrated yaml-cpp library into the project for YAML file parsing.
- Updated ConversationalAgentService to set ROM context in AI services.
- Extended AIService interface with SetRomContext method for context injection.
- Implemented SetRomContext in GeminiAIService and OllamaAIService.
- Enhanced PromptBuilder to load resource catalogues from YAML files.
- Added functions to parse commands, tools, examples, and tile references from YAML.
- Improved error handling for loading YAML files and added search paths for catalogues.
- Updated CMake configuration to fetch yaml-cpp if not found.
- Modified vcpkg.json to include yaml-cpp as a dependency.
This commit is contained in:
scawful
2025-10-03 16:44:29 -04:00
parent 467b0926e5
commit 42c64db904
12 changed files with 746 additions and 233 deletions

View File

@@ -1,6 +1,7 @@
#include "cli/service/ai/ollama_ai_service.h"
#include <cstdlib>
#include <iostream>
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
@@ -33,7 +34,10 @@ namespace cli {
OllamaAIService::OllamaAIService(const OllamaConfig& config) : config_(config) {
// Load command documentation into prompt builder
prompt_builder_.LoadResourceCatalogue(""); // TODO: Pass actual yaml path when available
if (auto status = prompt_builder_.LoadResourceCatalogue(""); !status.ok()) {
std::cerr << "⚠️ Failed to load agent prompt catalogue: "
<< status.message() << std::endl;
}
if (config_.system_prompt.empty()) {
// Use enhanced prompting by default
@@ -51,6 +55,10 @@ std::string OllamaAIService::BuildSystemPrompt() {
return prompt_builder_.BuildSystemInstruction();
}
void OllamaAIService::SetRomContext(Rom* rom) {
prompt_builder_.SetRom(rom);
}
absl::Status OllamaAIService::CheckAvailability() {
#if !YAZE_HAS_HTTPLIB || !YAZE_HAS_JSON
return absl::UnimplementedError(