Skip to content

Commit 0b0b371

Browse files
Update server-mmojo.cpp
Signed-off-by: Brad Hutchings <[email protected]>
1 parent 2ca4471 commit 0b0b371

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/server/server-mmojo.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ struct server_task {
269269
defaults.sampling = params_base.sampling;
270270
defaults.speculative = params_base.speculative;
271271
defaults.n_keep = params_base.n_keep;
272+
defaults.antiprompt = params_base.antiprompt;
272273

273274
// enabling this will output extra debug information in the HTTP responses from the server
274275
params.verbose = params_base.verbosity > 9;
@@ -506,6 +507,10 @@ struct server_task {
506507
}
507508
}
508509
}
510+
// set reverse prompt from cli args if not set in the request
511+
if (params.antiprompt.empty()) {
512+
params.antiprompt = defaults.antiprompt;
513+
}
509514
}
510515

511516
{
@@ -3698,7 +3703,6 @@ struct server_context {
36983703
};
36993704
}
37003705
// mmojo-server END
3701-
37023706
};
37033707

37043708
static void log_server_request(const httplib::Request & req, const httplib::Response & res) {
@@ -3904,17 +3908,17 @@ int main(int argc, char ** argv) {
39043908

39053909
return false;
39063910
};
3907-
3911+
39083912
auto middleware_server_state = [&res_error, &state](const httplib::Request & req, httplib::Response & res) {
39093913
server_state current_state = state.load();
39103914
if (current_state == SERVER_STATE_LOADING_MODEL) {
39113915
auto tmp = string_split<std::string>(req.path, '.');
3916+
// mmojo-server START
39123917
if (req.path == "/" || tmp.back() == "html" || ends_with(req.path, "/") || ends_with(req.path, ".html")) {
3913-
// mmojo-server START
39143918
// res.set_content(reinterpret_cast<const char*>(loading_html), loading_html_len, "text/html; charset=utf-8");
39153919
res.set_content(reinterpret_cast<const char*>(loading_mmojo_html), loading_mmojo_html_len, "text/html; charset=utf-8");
3916-
// mmojo-server END
39173920
res.status = 503;
3921+
// mmojo-server END
39183922
} else if (req.path == "/models" || req.path == "/v1/models" || req.path == "/api/tags") {
39193923
// allow the models endpoint to be accessed during loading
39203924
return true;

0 commit comments

Comments
 (0)