@@ -3919,6 +3919,21 @@ int main(int argc, char ** argv) {
39193919 res_ok (res, {{ " success" , true }});
39203920 };
39213921
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+
39223937 // handle completion-like requests (completion, chat, infill)
39233938 // we can optionally provide a custom format for partial results and final results
39243939 const auto handle_completions_impl = [&ctx_server, &res_error, &res_ok](
@@ -4483,6 +4498,7 @@ int main(int argc, char ** argv) {
44834498 svr->Get (" /metrics" , handle_metrics);
44844499 svr->Get (" /props" , handle_props);
44854500 svr->Post (" /props" , handle_props_change);
4501+ svr->Post (" /api/show" , handle_api_show);
44864502 svr->Get (" /models" , handle_models); // public endpoint (no API key check)
44874503 svr->Get (" /v1/models" , handle_models); // public endpoint (no API key check)
44884504 svr->Post (" /completion" , handle_completions); // legacy
0 commit comments