Skip to content

Commit 6f29bcb

Browse files
committed
use suggested idea instead of my overly verbose way
1 parent b407a4e commit 6f29bcb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

examples/server/server.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4127,11 +4127,9 @@ int main(int argc, char ** argv) {
41274127
const auto handle_apply_template = [&ctx_server, &params, &res_ok](const httplib::Request & req, httplib::Response & res) {
41284128
auto body = json::parse(req.body);
41294129
const auto & chat_template = body.contains("tools") && ctx_server.chat_templates.template_tool_use ? *ctx_server.chat_templates.template_tool_use : *ctx_server.chat_templates.template_default;
4130+
json data = oaicompat_completion_params_parse(body, chat_template, params.use_jinja);
41304131

4131-
// format and return only the "prompt" field
4132-
json data = json::object();
4133-
data["prompt"] = oaicompat_completion_params_parse(body, chat_template, params.use_jinja)["prompt"];
4134-
res_ok(res, data);
4132+
res_ok(res, {{ "prompt", data.at("prompt") }});
41354133
};
41364134

41374135
const auto handle_embeddings = [&handle_embeddings_impl](const httplib::Request & req, httplib::Response & res) {

0 commit comments

Comments
 (0)