@@ -67,7 +67,8 @@ void ParseGguf(DatabaseService& db_service,
6767 CTL_INF (" Adding model to modellist with branch: " << branch);
6868
6969 auto rel = file_manager_utils::ToRelativeCortexDataPath (yaml_name);
70- CTL_INF (" path_to_model_yaml: " << rel.string ());
70+ CTL_INF (" path_to_model_yaml: " << rel.string ()
71+ << " , model: " << ggufDownloadItem.id );
7172
7273 auto author_id = author.has_value () ? author.value () : " cortexso" ;
7374 if (!db_service.HasModel (ggufDownloadItem.id )) {
@@ -86,6 +87,7 @@ void ParseGguf(DatabaseService& db_service,
8687 } else {
8788 if (auto m = db_service.GetModelInfo (ggufDownloadItem.id ); m.has_value ()) {
8889 auto upd_m = m.value ();
90+ upd_m.path_to_model_yaml = rel.string ();
8991 upd_m.status = cortex::db::ModelStatus::Downloaded;
9092 if (auto r = db_service.UpdateModelEntry (ggufDownloadItem.id , upd_m);
9193 r.has_error ()) {
@@ -161,6 +163,9 @@ void ModelService::ForceIndexingModelList() {
161163 continue ;
162164 }
163165 try {
166+ CTL_DBG (fmu::ToAbsoluteCortexDataPath (
167+ fs::path (model_entry.path_to_model_yaml ))
168+ .string ());
164169 yaml_handler.ModelConfigFromFile (
165170 fmu::ToAbsoluteCortexDataPath (
166171 fs::path (model_entry.path_to_model_yaml ))
@@ -171,48 +176,12 @@ void ModelService::ForceIndexingModelList() {
171176 } catch (const std::exception& e) {
172177 // remove in db
173178 auto remove_result = db_service_->DeleteModelEntry (model_entry.model );
179+ CTL_DBG (e.what ());
174180 // silently ignore result
175181 }
176182 }
177183}
178184
179- cpp::result<std::string, std::string> ModelService::DownloadModel (
180- const std::string& input) {
181- if (input.empty ()) {
182- return cpp::fail (
183- " Input must be Cortex Model Hub handle or HuggingFace url!" );
184- }
185-
186- if (string_utils::StartsWith (input, " https://" )) {
187- return HandleUrl (input);
188- }
189-
190- if (input.find (" :" ) != std::string::npos) {
191- auto parsed = string_utils::SplitBy (input, " :" );
192- if (parsed.size () != 2 ) {
193- return cpp::fail (" Invalid model handle: " + input);
194- }
195- return DownloadModelFromCortexso (parsed[0 ], parsed[1 ]);
196- }
197-
198- if (input.find (" /" ) != std::string::npos) {
199- auto parsed = string_utils::SplitBy (input, " /" );
200- if (parsed.size () != 2 ) {
201- return cpp::fail (" Invalid model handle: " + input);
202- }
203-
204- auto author = parsed[0 ];
205- auto model_name = parsed[1 ];
206- if (author == " cortexso" ) {
207- return HandleCortexsoModel (model_name);
208- }
209-
210- return DownloadHuggingFaceGgufModel (author, model_name, std::nullopt );
211- }
212-
213- return HandleCortexsoModel (input);
214- }
215-
216185cpp::result<std::string, std::string> ModelService::HandleCortexsoModel (
217186 const std::string& modelName) {
218187 auto branches =
@@ -612,7 +581,8 @@ ModelService::DownloadModelFromCortexsoAsync(
612581 .branch_name = branch,
613582 .path_to_model_yaml = rel.string (),
614583 .model_alias = unique_model_id,
615- .status = cortex::db::ModelStatus::Downloaded};
584+ .status = cortex::db::ModelStatus::Downloaded,
585+ .engine = mc.engine };
616586 auto result = db_service_->AddModelEntry (model_entry);
617587
618588 if (result.has_error ()) {
@@ -621,6 +591,7 @@ ModelService::DownloadModelFromCortexsoAsync(
621591 } else {
622592 if (auto m = db_service_->GetModelInfo (unique_model_id); m.has_value ()) {
623593 auto upd_m = m.value ();
594+ upd_m.path_to_model_yaml = rel.string ();
624595 upd_m.status = cortex::db::ModelStatus::Downloaded;
625596 if (auto r = db_service_->UpdateModelEntry (unique_model_id, upd_m);
626597 r.has_error ()) {
@@ -1157,7 +1128,7 @@ cpp::result<ModelPullInfo, std::string> ModelService::GetModelPullInfo(
11571128
11581129 if (input.find (" :" ) != std::string::npos) {
11591130 auto parsed = string_utils::SplitBy (input, " :" );
1160- if (parsed.size () != 2 ) {
1131+ if (parsed.size () != 2 && parsed. size () != 3 ) {
11611132 return cpp::fail (" Invalid model handle: " + input);
11621133 }
11631134 return ModelPullInfo{.id = input,
0 commit comments