Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 9fe0c6f

Browse files
authored
feat: add more parameters to /v1/models/start (#1545)
1 parent 22e344b commit 9fe0c6f

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

engine/controllers/models.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,20 @@ void Models::StartModel(
370370
params_override.cache_type = o.asString();
371371
}
372372

373+
if (auto& o = (*(req->getJsonObject()))["mmproj"]; !o.isNull()) {
374+
params_override.mmproj = o.asString();
375+
}
376+
377+
// Support both llama_model_path and model_path for backward compatible
378+
// model_path has higher priority
379+
if (auto& o = (*(req->getJsonObject()))["llama_model_path"]; !o.isNull()) {
380+
params_override.model_path = o.asString();
381+
}
382+
383+
if (auto& o = (*(req->getJsonObject()))["model_path"]; !o.isNull()) {
384+
params_override.model_path = o.asString();
385+
}
386+
373387
auto model_entry = model_service_->GetDownloadedModel(model_handle);
374388
if (!model_entry.has_value()) {
375389
Json::Value ret;

engine/services/model_service.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ cpp::result<bool, std::string> ModelService::StartModel(
622622
ASSIGN_IF_PRESENT(json_data, params_override, n_parallel);
623623
ASSIGN_IF_PRESENT(json_data, params_override, ctx_len);
624624
ASSIGN_IF_PRESENT(json_data, params_override, cache_type);
625+
ASSIGN_IF_PRESENT(json_data, params_override, mmproj);
626+
ASSIGN_IF_PRESENT(json_data, params_override, model_path);
625627
#undef ASSIGN_IF_PRESENT;
626628

627629
CTL_INF(json_data.toStyledString());

engine/services/model_service.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ std::optional<int> n_parallel;
1414
std::optional<int> ctx_len;
1515
std::optional<std::string> custom_prompt_template;
1616
std::optional<std::string> cache_type;
17+
std::optional<std::string> mmproj;
18+
std::optional<std::string> model_path;
1719
};
1820
class ModelService {
1921
public:

0 commit comments

Comments
 (0)