feat: implement conditional AI runtime features based on build configuration

- Added conditional compilation for AI services and callbacks based on the YAZE_AI_RUNTIME_AVAILABLE flag.
- Implemented stubs for AI service methods to return errors when the AI runtime is disabled, enhancing error handling.
- Updated GeminiAIService and OllamaAIService to provide appropriate responses when AI features are not available.
- Introduced a new service factory stub to create mock AI services when the runtime is disabled, improving testing capabilities.
This commit is contained in:
scawful
2025-11-16 21:54:20 -05:00
parent 61c99ecfcd
commit 24078301be
6 changed files with 137 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
#ifndef YAZE_AI_RUNTIME_AVAILABLE
#include "cli/service/ai/service_factory.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
namespace yaze::cli {
std::unique_ptr<AIService> CreateAIService() {
return std::make_unique<MockAIService>();
}
std::unique_ptr<AIService> CreateAIService(const AIServiceConfig&) {
return std::make_unique<MockAIService>();
}
absl::StatusOr<std::unique_ptr<AIService>> CreateAIServiceStrict(
const AIServiceConfig&) {
return absl::FailedPreconditionError(
"AI runtime features are disabled in this build");
}
} // namespace yaze::cli
#endif // !YAZE_AI_RUNTIME_AVAILABLE