File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4593,6 +4593,12 @@ int main(int argc, char ** argv) {
45934593 res_ok (res, health);
45944594 };
45954595
4596+ const auto handle_version = [&](const httplib::Request &, httplib::Response & res) {
4597+ // returns the build number
4598+ json version = {{" version" , std::to_string (LLAMA_BUILD_NUMBER)}};
4599+ res_ok (res, version);
4600+ };
4601+
45964602 const auto handle_slots = [&](const httplib::Request & req, httplib::Response & res) {
45974603 if (!params.endpoint_slots ) {
45984604 res_error (res, format_error_response (" This server does not support slots endpoint. Start it with `--slots`" , ERROR_TYPE_NOT_SUPPORTED));
@@ -5582,6 +5588,7 @@ int main(int argc, char ** argv) {
55825588 svr->Get (params.api_prefix + " /models" , handle_models); // public endpoint (no API key check)
55835589 svr->Get (params.api_prefix + " /v1/models" , handle_models); // public endpoint (no API key check)
55845590 svr->Get (params.api_prefix + " /api/tags" , handle_models); // ollama specific endpoint. public endpoint (no API key check)
5591+ svr->Get (params.api_prefix + " /api/version" , handle_version); // ollama endpoint, for compatibility with vscode
55855592 svr->Post (params.api_prefix + " /completion" , handle_completions); // legacy
55865593 svr->Post (params.api_prefix + " /completions" , handle_completions);
55875594 svr->Post (params.api_prefix + " /v1/completions" , handle_completions_oai);
You can’t perform that action at this time.
0 commit comments