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

@@ -383,6 +383,7 @@ void EditorManager::Initialize(gfx::IRenderer* renderer,
*output_path = result->file_path;
return absl::OkStatus();
};
#ifdef YAZE_AI_RUNTIME_AVAILABLE
multimodal_callbacks.send_to_gemini =
[this](const std::filesystem::path& image_path,
const std::string& prompt) -> absl::Status {
@@ -417,6 +418,14 @@ void EditorManager::Initialize(gfx::IRenderer* renderer,
return absl::OkStatus();
};
#else
multimodal_callbacks.send_to_gemini =
[](const std::filesystem::path&, const std::string&) -> absl::Status {
return absl::FailedPreconditionError(
"Gemini AI runtime is disabled in this build");
};
#endif
agent_editor_.GetChatWidget()->SetMultimodalCallbacks(multimodal_callbacks);
// Set up Z3ED command callbacks for proposal management