MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / post

Method post

tools/server/server-http.cpp:438–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438void server_http_context::post(const std::string & path, const server_http_context::handler_t & handler) const {
439 pimpl->srv->Post(path_prefix + path, [handler](const httplib::Request & req, httplib::Response & res) {
440 std::string body = req.body;
441 std::map<std::string, raw_buffer> files;
442
443 if (req.is_multipart_form_data()) {
444 // translate text fields to a JSON object and use it as the body
445 json form_json = json::object();
446 for (const auto & [key, field] : req.form.fields) {
447 if (form_json.contains(key)) {
448 // if the key already exists, convert it to an array
449 if (!form_json[key].is_array()) {
450 json existing_value = form_json[key];
451 form_json[key] = json::array({existing_value});
452 }
453 form_json[key].push_back(field.content);
454 } else {
455 form_json[key] = field.content;
456 }
457 }
458 body = form_json.dump();
459
460 // populate files from multipart form
461 for (const auto & [key, file] : req.form.files) {
462 files[key] = raw_buffer(file.content.begin(), file.content.end());
463 }
464 }
465
466 server_http_req_ptr request = std::make_unique<server_http_req>(server_http_req{
467 get_params(req),
468 get_headers(req),
469 req.path,
470 build_query_string(req),
471 body,
472 std::move(files),
473 req.is_connection_closed
474 });
475 server_http_res_ptr response = handler(*request);
476 process_handler_response(std::move(request), response, res);
477 });
478}
479

Callers 14

tts-outetts.pyFile · 0.45
update_slotsMethod · 0.45
mainFunction · 0.45
make_requestMethod · 0.45
make_stream_requestMethod · 0.45
chat_completionFunction · 0.45
get_prompt_lengthFunction · 0.45
send_promptFunction · 0.45
chat_completionFunction · 0.45
dump_logitsFunction · 0.45
chat_completionFunction · 0.45
run_queryFunction · 0.45

Calls 9

get_paramsFunction · 0.85
get_headersFunction · 0.85
build_query_stringFunction · 0.85
process_handler_responseFunction · 0.85
containsMethod · 0.80
dumpMethod · 0.80
endMethod · 0.80
push_backMethod · 0.45
beginMethod · 0.45

Tested by 4

chat_completionFunction · 0.36
chat_completionFunction · 0.36
chat_completionFunction · 0.36
run_queryFunction · 0.36