File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments