From 10ce22556e9a7e52d62b7bea72fa9facd55f581b Mon Sep 17 00:00:00 2001 From: Louis Le Date: Mon, 4 Nov 2024 18:29:30 +0700 Subject: [PATCH] chore: update model's size on import --- engine/controllers/models.cc | 5 +++++ engine/services/download_service.cc | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/controllers/models.cc b/engine/controllers/models.cc index 544b3588c..0233d34d4 100644 --- a/engine/controllers/models.cc +++ b/engine/controllers/models.cc @@ -1,5 +1,6 @@ #include "database/models.h" #include +#include #include #include #include "config/gguf_parser.h" @@ -351,8 +352,12 @@ void Models::ImportModel( modelPath, file_path, std::filesystem::copy_options::update_existing); model_config.files.push_back(file_path.string()); + auto size = std::filesystem::file_size(file_path); + model_config.size = size; } else { model_config.files.push_back(modelPath); + auto size = std::filesystem::file_size(modelPath); + model_config.size = size; } model_config.model = modelHandle; model_config.name = modelName.empty() ? model_config.name : modelName; diff --git a/engine/services/download_service.cc b/engine/services/download_service.cc index 1a8f7b0a7..24af79d32 100644 --- a/engine/services/download_service.cc +++ b/engine/services/download_service.cc @@ -1,4 +1,3 @@ -#include "download_service.h" #include #include #include