Skip to content

Commit a9b21f4

Browse files
committed
remote image_url log
1 parent 4adce86 commit a9b21f4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tools/server/utils.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,17 @@ static json oaicompat_completion_params_parse(
667667
common_remote_params params;
668668
params.headers.push_back("User-Agent: llama.cpp/" + build_info);
669669
params.max_size = 1024 * 1024 * 10; // 10MB
670+
params.timeout = 10; // seconds
671+
SRV_INF("downloading image from '%s'\n", url.c_str());
670672
auto res = common_remote_get_content(url, params);
671-
raw_buffer data;
672-
data.insert(data.end(), res.second.begin(), res.second.end());
673-
out_files.push_back(data);
673+
if (200 <= res.first && res.first < 300) {
674+
SRV_INF("downloaded %ld bytes\n", res.second.size());
675+
raw_buffer data;
676+
data.insert(data.end(), res.second.begin(), res.second.end());
677+
out_files.push_back(data);
678+
} else {
679+
throw std::runtime_error("Failed to download image");
680+
}
674681

675682
} else {
676683
// try to decode base64 image

0 commit comments

Comments
 (0)