Enhance AI Agent Integration and Tool Command Functionality
- Added support for JSON in CMake configuration for AI integrations. - Implemented new tool commands: resource-list and dungeon-list-sprites. - Created ToolDispatcher for managing tool command execution. - Refactored CMake structure to include agent sources and improve build configuration. - Updated agent roadmap and README documentation to reflect current status and next steps.
This commit is contained in:
@@ -1,23 +1,32 @@
|
||||
#include "cli/service/ai/service_factory.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "cli/service/ai/ai_service.h"
|
||||
#include "cli/service/ai/gemini_ai_service.h"
|
||||
#include "cli/service/ai/ollama_ai_service.h"
|
||||
|
||||
#ifdef YAZE_WITH_JSON
|
||||
#include "cli/service/ai/gemini_ai_service.h"
|
||||
#endif
|
||||
|
||||
namespace yaze {
|
||||
namespace cli {
|
||||
|
||||
std::unique_ptr<AIService> CreateAIService() {
|
||||
// Priority: Ollama (local) > Gemini (remote) > Mock (testing)
|
||||
const char* provider_env = std::getenv("YAZE_AI_PROVIDER");
|
||||
const char* gemini_key = std::getenv("GEMINI_API_KEY");
|
||||
const char* ollama_model = std::getenv("OLLAMA_MODEL");
|
||||
const std::string provider = provider_env ? provider_env : "";
|
||||
const bool gemini_requested = provider == "gemini";
|
||||
|
||||
#ifdef YAZE_WITH_JSON
|
||||
const char* gemini_key = std::getenv("GEMINI_API_KEY");
|
||||
const char* gemini_model = std::getenv("GEMINI_MODEL");
|
||||
#endif
|
||||
|
||||
// Explicit provider selection
|
||||
if (provider_env && std::string(provider_env) == "ollama") {
|
||||
if (provider == "ollama") {
|
||||
OllamaConfig config;
|
||||
|
||||
// Allow model override via env
|
||||
@@ -39,6 +48,7 @@ std::unique_ptr<AIService> CreateAIService() {
|
||||
}
|
||||
|
||||
// Gemini if API key provided
|
||||
#ifdef YAZE_WITH_JSON
|
||||
if (gemini_key && std::strlen(gemini_key) > 0) {
|
||||
GeminiConfig config(gemini_key);
|
||||
|
||||
@@ -59,6 +69,11 @@ std::unique_ptr<AIService> CreateAIService() {
|
||||
std::cout << "🤖 Using Gemini AI with model: " << config.model << std::endl;
|
||||
return service;
|
||||
}
|
||||
#else
|
||||
if (gemini_requested || std::getenv("GEMINI_API_KEY")) {
|
||||
std::cerr << "⚠️ Gemini support not available: rebuild with YAZE_WITH_JSON=ON" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Default: Mock service for testing
|
||||
std::cout << "🤖 Using MockAIService (no LLM configured)" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user