Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 3d7cf40

Browse files
Fix: download log for model and engines
1 parent 72a03a0 commit 3d7cf40

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

engine/services/download_service.cc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ cpp::result<void, std::string> DownloadService::AddDownloadTask(
6767
std::optional<std::string> dl_err_msg = std::nullopt;
6868
for (const auto& item : task.items) {
6969
CLI_LOG("Start downloading: " + item.localPath.filename().string());
70-
auto result = Download(task.id, item, true, task.type);
70+
auto result = Download(task.id, item, true);
7171
if (result.has_error()) {
7272
dl_err_msg = result.error();
7373
break;
7474
}
7575
}
7676
if (dl_err_msg.has_value()) {
77-
CTL_ERR(dl_err_msg.value());
77+
// CTL_ERR(dl_err_msg.value());
7878
return cpp::fail(dl_err_msg.value());
7979
}
8080

@@ -121,7 +121,7 @@ cpp::result<void, std::string> DownloadService::AddAsyncDownloadTask(
121121
std::optional<std::string> dl_err_msg = std::nullopt;
122122
for (const auto& item : task.items) {
123123
CTL_INF("Start downloading: " + item.localPath.filename().string());
124-
auto result = Download(task.id, item, false, task.type);
124+
auto result = Download(task.id, item, false);
125125
if (result.has_error()) {
126126
dl_err_msg = result.error();
127127
break;
@@ -147,7 +147,7 @@ cpp::result<void, std::string> DownloadService::AddAsyncDownloadTask(
147147

148148
cpp::result<void, std::string> DownloadService::Download(
149149
const std::string& download_id, const DownloadItem& download_item,
150-
bool allow_resume, std::optional<DownloadType> download_type) noexcept {
150+
bool allow_resume) noexcept {
151151
CTL_INF("Absolute file output: " << download_item.localPath.string());
152152

153153
CURL* curl;
@@ -183,7 +183,7 @@ cpp::result<void, std::string> DownloadService::Download(
183183
CLI_LOG("Resuming download..");
184184
} else {
185185
CLI_LOG("Start over..");
186-
return {};
186+
return cpp::fail("Cancelled Resume download!");
187187
}
188188
} else {
189189
CLI_LOG(download_item.localPath.filename().string()
@@ -195,7 +195,7 @@ cpp::result<void, std::string> DownloadService::Download(
195195
if (answer == "Y" || answer == "y" || answer.empty()) {
196196
CLI_LOG("Re-downloading..");
197197
} else {
198-
return {};
198+
return cpp::fail("Cancelled Re-download!");
199199
}
200200
}
201201
}
@@ -232,9 +232,6 @@ cpp::result<void, std::string> DownloadService::Download(
232232

233233
fclose(file);
234234
curl_easy_cleanup(curl);
235-
if (download_type.has_value() && download_type == DownloadType::Model) {
236-
CLI_LOG("Model " << download_id << " downloaded successfully!")
237-
}
238235
return {};
239236
}
240237

engine/services/download_service.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class DownloadService {
7979

8080
cpp::result<void, std::string> Download(
8181
const std::string& download_id, const DownloadItem& download_item,
82-
bool allow_resume, std::optional<DownloadType> download_type) noexcept;
82+
bool allow_resume) noexcept;
8383

8484
curl_off_t GetLocalFileSize(const std::filesystem::path& path) const;
8585
};

engine/services/model_service.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@ cpp::result<std::string, std::string> ModelService::HandleUrl(
239239
} else {
240240
auto result = download_service_.AddDownloadTask(downloadTask, on_finished);
241241
if (result.has_error()) {
242-
CTL_ERR(result.error());
242+
// CTL_ERR(result.error());
243243
return cpp::fail(result.error());
244+
} else {
245+
CLI_LOG("Model " << model_id << " downloaded successfully!")
244246
}
245247
return unique_model_id;
246248
}
@@ -292,6 +294,8 @@ cpp::result<std::string, std::string> ModelService::DownloadModelFromCortexso(
292294

293295
if (result.has_error()) {
294296
return cpp::fail(result.error());
297+
} else {
298+
CLI_LOG("Model " << model_id << " downloaded successfully!")
295299
}
296300

297301
return model_id;

0 commit comments

Comments
 (0)