- 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.
28 lines
642 B
C++
28 lines
642 B
C++
#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
|
|
|