MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / load_models

Method load_models

app/server/runtime.cpp:402–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400 ",\"loaded\":true,\"reconfigured\":" + (changed ? "true" : "false") + "}");
401 }
402
403 auto loaded = make_model(std::move(requested));
404 ensure_model_loaded_locked(*loaded);
405 const std::string id = loaded->config.id;
406 {
407 std::lock_guard<std::mutex> state_lock(models_mutex_);
408 if (model_index_.find(id) != model_index_.end()) {
409 throw std::runtime_error("model id was registered concurrently: " + id);
410 }
411 model_index_.emplace(id, models_.size());
412 models_.push_back(std::move(loaded));
413 }
414 return json_response("{\"id\":" + json_quote(id) + ",\"loaded\":true,\"reconfigured\":false}");
415}
416
417std::filesystem::path ServerState::resolve_ui_model_path(const std::filesystem::path & path) const {
418 return minitts::server::resolve_ui_model_path(path, request_base_, repository_root_);
419}
420
421HttpResponse ServerState::handle_model_unload(const std::string & body_text) {
422 if (!config_.ui_management) {
423 return error_response(403, "dynamic model management is disabled", "forbidden");
424 }
425 const auto body = engine::io::json::parse(body_text);

Callers

nothing calls this directly

Calls 3

parse_voice_task_kindFunction · 0.85
parse_run_modeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected