@@ -3919,6 +3919,21 @@ int main(int argc, char ** argv) {
3919
3919
res_ok (res, {{ " success" , true }});
3920
3920
};
3921
3921
3922
+ const auto handle_api_show = [&ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) {
3923
+ json data = {
3924
+ {
3925
+ " template" , common_chat_templates_source (ctx_server.chat_templates .get ()),
3926
+ },
3927
+ {
3928
+ " model_info" , {
3929
+ { " llama.context_length" , ctx_server.slots .back ().n_ctx , },
3930
+ }
3931
+ },
3932
+ };
3933
+
3934
+ res_ok (res, data);
3935
+ };
3936
+
3922
3937
// handle completion-like requests (completion, chat, infill)
3923
3938
// we can optionally provide a custom format for partial results and final results
3924
3939
const auto handle_completions_impl = [&ctx_server, &res_error, &res_ok](
@@ -4483,6 +4498,7 @@ int main(int argc, char ** argv) {
4483
4498
svr->Get (" /metrics" , handle_metrics);
4484
4499
svr->Get (" /props" , handle_props);
4485
4500
svr->Post (" /props" , handle_props_change);
4501
+ svr->Post (" /api/show" , handle_api_show);
4486
4502
svr->Get (" /models" , handle_models); // public endpoint (no API key check)
4487
4503
svr->Get (" /v1/models" , handle_models); // public endpoint (no API key check)
4488
4504
svr->Post (" /completion" , handle_completions); // legacy
0 commit comments