Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
namchuai committed Dec 10, 2024
1 parent f2d088e commit 33c54e3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion engine/services/engine_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,31 @@ cpp::result<EngineV, std::string> EngineService::GetLoadedEngine(
cpp::result<void, std::string> EngineService::LoadEngine(
const std::string& engine_name) {
auto ne = NormalizeEngine(engine_name);

std::lock_guard<std::mutex> lock(engines_mutex_);
if (IsEngineLoaded(ne)) {
CTL_INF("Engine " << ne << " is already loaded");
return {};
}

// Check for remote engine
if (remote_engine::IsRemoteEngine(engine_name)) {
auto exist_engine = GetEngineByNameAndVariant(engine_name);
if (exist_engine.has_error()) {
return cpp::fail("Remote engine '" + engine_name + "' is not installed");
}

if (engine_name == kOpenAiEngine) {
engines_[engine_name].engine = new remote_engine::OpenAiEngine();
} else {
engines_[engine_name].engine = new remote_engine::AnthropicEngine();
}

CTL_INF("Loaded engine: " << engine_name);
return {};
}

// End hard code

CTL_INF("Loading engine: " << ne);

auto engine_dir_path_res = GetEngineDirPath(ne);
Expand Down

0 comments on commit 33c54e3

Please sign in to comment.