@@ -3907,6 +3907,21 @@ int main(int argc, char ** argv) {
3907
3907
res_ok (res, {{ " success" , true }});
3908
3908
};
3909
3909
3910
+ const auto handle_api_show = [&ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) {
3911
+ json data = {
3912
+ {
3913
+ " template" , common_chat_templates_source (ctx_server.chat_templates .get ()),
3914
+ },
3915
+ {
3916
+ " model_info" , {
3917
+ { " llama.context_length" , ctx_server.slots .back ().n_ctx , },
3918
+ }
3919
+ },
3920
+ };
3921
+
3922
+ res_ok (res, data);
3923
+ };
3924
+
3910
3925
// handle completion-like requests (completion, chat, infill)
3911
3926
// we can optionally provide a custom format for partial results and final results
3912
3927
const auto handle_completions_impl = [&ctx_server, &res_error, &res_ok](
@@ -4471,6 +4486,7 @@ int main(int argc, char ** argv) {
4471
4486
svr->Get (" /metrics" , handle_metrics);
4472
4487
svr->Get (" /props" , handle_props);
4473
4488
svr->Post (" /props" , handle_props_change);
4489
+ svr->Post (" /api/show" , handle_api_show);
4474
4490
svr->Get (" /models" , handle_models); // public endpoint (no API key check)
4475
4491
svr->Get (" /v1/models" , handle_models); // public endpoint (no API key check)
4476
4492
svr->Post (" /completion" , handle_completions); // legacy
0 commit comments