| 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 | |
| 417 | std::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 | |
| 421 | HttpResponse 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); |
nothing calls this directly
no test coverage detected