@@ -59,81 +59,6 @@ std::string GetEnginePath(std::string_view e) {
5959};
6060} // namespace
6161
62- // cpp::result<EngineInfo, std::string> EngineService::GetEngineInfo(
63- // const std::string& engine) const {
64- //
65- // if (std::find(kSupportEngines.begin(), kSupportEngines.end(), engine) ==
66- // kSupportEngines.end()) {
67- // return cpp::fail("Engine " + engine + " is not supported!");
68- // }
69- //
70- // auto engine_status_list = GetEngineInfoList();
71- //
72- // return *std::find_if(
73- // engine_status_list.begin(), engine_status_list.end(),
74- // [&engine](const EngineInfo& e) { return e.name == engine; });
75- // }
76-
77- // std::vector<EngineInfo> EngineService::GetEngineInfoList() const {
78- // auto ecp = file_manager_utils::GetEnginesContainerPath();
79- //
80- // std::string onnx_status{kIncompatible};
81- // std::string llamacpp_status =
82- // std::filesystem::exists(ecp / kLlamaRepo) ? kReady : kNotInstalled;
83- // std::string tensorrt_status{kIncompatible};
84- //
85- // #ifdef _WIN32
86- // onnx_status =
87- // std::filesystem::exists(ecp / kOnnxRepo) ? kReady : kNotInstalled;
88- // tensorrt_status =
89- // std::filesystem::exists(ecp / kTrtLlmRepo) ? kReady : kNotInstalled;
90- // #elif defined(__linux__)
91- // tensorrt_status =
92- // std::filesystem::exists(ecp / kTrtLlmRepo) ? kReady : kNotInstalled;
93- // #endif
94- // std::vector<EngineInfo> engines = {
95- // {.name = kOnnxEngine,
96- // .description = "This extension enables chat completion API calls using "
97- // "the Onnx engine",
98- // .format = "ONNX",
99- // .product_name = kOnnxEngine,
100- // .status = onnx_status},
101- // {.name = kLlamaEngine,
102- // .description = "This extension enables chat completion API calls using "
103- // "the LlamaCPP engine",
104- // .format = "GGUF",
105- // .product_name = kLlamaEngine,
106- // .status = llamacpp_status},
107- // {.name = kTrtLlmEngine,
108- // .description = "This extension enables chat completion API calls using "
109- // "the TensorrtLLM engine",
110- // .format = "TensorRT Engines",
111- // .product_name = kTrtLlmEngine,
112- // .status = tensorrt_status},
113- // };
114- //
115- // for (auto& engine : engines) {
116- // if (engine.status == kReady) {
117- // // try to read the version.txt
118- // auto engine_info_path = file_manager_utils::GetEnginesContainerPath() /
119- // NormalizeEngine(engine.name) / "version.txt";
120- // if (!std::filesystem::exists(engine_info_path)) {
121- // continue;
122- // }
123- // try {
124- // auto node = YAML::LoadFile(engine_info_path.string());
125- // engine.version = node["version"].as<std::string>();
126- // engine.variant = node["name"].as<std::string>();
127- // } catch (const YAML::Exception& e) {
128- // CTL_ERR("Error reading version.txt: " << e.what());
129- // continue;
130- // }
131- // }
132- // }
133- //
134- // return engines;
135- // }
136-
13762cpp::result<bool , std::string> EngineService::InstallEngine (
13863 const std::string& engine, const std::string& version,
13964 const std::string& src) {
@@ -246,12 +171,13 @@ cpp::result<bool, std::string> EngineService::UnzipEngine(
246171 return true ;
247172}
248173
249- cpp::result<bool , std::string> EngineService::UninstallEngine (
250- const std::string& engine) {
174+ cpp::result<bool , std::string> EngineService::UninstallEngineVariant (
175+ const std::string& engine, const std::string& variant,
176+ const std::string& version) {
251177 auto ne = NormalizeEngine (engine);
252- auto ecp = file_manager_utils::GetEnginesContainerPath ();
253- auto engine_path = ecp / ne;
254-
178+ auto engine_path =
179+ file_manager_utils::GetEnginesContainerPath () / ne / variant / version ;
180+ std::cout << " engine_path: " << engine_path. string () << std::endl;
255181 if (!std::filesystem::exists (engine_path)) {
256182 return cpp::fail (" Engine " + ne + " is not installed!" );
257183 }
@@ -374,7 +300,6 @@ cpp::result<bool, std::string> EngineService::DownloadEngine(
374300 // CTL_INF("No GitHub token found. Sending request without authentication.");
375301 // }
376302
377- // TODO: namh add back the github_token
378303 auto res = GetEngineVariants (engine, version);
379304 if (res.has_error ()) {
380305 return cpp::fail (" Failed to fetch engine releases: " + res.error ());
0 commit comments