server: refactor: clean up http code (#5912)
This commit is contained in:
parent
3166ccf5aa
commit
c50a510092
1 changed files with 3 additions and 1 deletions
|
@ -2945,7 +2945,7 @@ int main(int argc, char ** argv) {
|
|||
if (!result.error && result.stop) {
|
||||
res.set_content(result.data.dump(-1, ' ', false, json::error_handler_t::replace), "application/json; charset=utf-8");
|
||||
} else {
|
||||
res.status = 404;
|
||||
res.status = 400;
|
||||
res.set_content(result.data["content"], "text/plain; charset=utf-8");
|
||||
}
|
||||
|
||||
|
@ -3202,6 +3202,7 @@ int main(int argc, char ** argv) {
|
|||
svr.Post("/embedding", [¶ms, &llama](const httplib::Request & req, httplib::Response & res) {
|
||||
res.set_header("Access-Control-Allow-Origin", req.get_header_value("Origin"));
|
||||
if (!params.embedding) {
|
||||
res.status = 400;
|
||||
res.set_content("This server does not support embeddings. Start it with `--embeddings`", "text/plain; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
|
@ -3232,6 +3233,7 @@ int main(int argc, char ** argv) {
|
|||
svr.Post("/v1/embeddings", [¶ms, &llama](const httplib::Request & req, httplib::Response & res) {
|
||||
res.set_header("Access-Control-Allow-Origin", req.get_header_value("Origin"));
|
||||
if (!params.embedding) {
|
||||
res.status = 400;
|
||||
res.set_content("This server does not support embeddings. Start it with `--embeddings`", "text/plain; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue