Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
apply suggestions from comments
  • Loading branch information
albert-polak committed Aug 11, 2025
commit 5589224e8b20b247ecbe624aebf6b4129433bd3e
12 changes: 6 additions & 6 deletions tools/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4546,16 +4546,16 @@ int main(int argc, char ** argv) {
res_ok(res, models);
};

const auto handle_ollama_version = [&ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) {
const auto handle_version = [&ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) {
json version;
char* fake_ollama_version = std::getenv("FAKE_OLLAMA_VERSION");
if (fake_ollama_version) {
char* version_override = std::getenv("LLAMA_API_VERSION_OVERRIDE");
if (version_override) {
version = {
{"version", std::string(fake_ollama_version)}
{"version", std::string(version_override)}
};
} else {
version = {
{"version", "0.6.4"}
{"version", std::to_string(LLAMA_BUILD_NUMBER)}
};
}

Expand Down Expand Up @@ -4900,7 +4900,7 @@ int main(int argc, char ** argv) {
svr->Get (params.api_prefix + "/models", handle_models); // public endpoint (no API key check)
svr->Get (params.api_prefix + "/v1/models", handle_models); // public endpoint (no API key check)
svr->Get (params.api_prefix + "/api/tags", handle_models); // ollama specific endpoint. public endpoint (no API key check)
svr->Get (params.api_prefix + "/api/version", handle_ollama_version); // ollama specific endpoint. public endpoint (no API key check)
svr->Get (params.api_prefix + "/api/version", handle_version); // public endpoint (no API key check)
svr->Post(params.api_prefix + "/completion", handle_completions); // legacy
svr->Post(params.api_prefix + "/completions", handle_completions);
svr->Post(params.api_prefix + "/v1/completions", handle_completions_oai);
Expand Down