Skip to content

Commit

Permalink
fix: append models to list
Browse files Browse the repository at this point in the history
  • Loading branch information
vansangpfiev committed Jul 18, 2024
1 parent 6de90a9 commit 26a4768
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cortex-cpp/controllers/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ server::~server() {}
void server::ChatCompletion(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) {
if(!HasFieldInReq(req, callback, "engine")) {
if (!HasFieldInReq(req, callback, "engine")) {
return;
}

Expand Down Expand Up @@ -95,7 +95,7 @@ void server::Embedding(const HttpRequestPtr& req,
void server::UnloadModel(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) {
if(!HasFieldInReq(req, callback, "engine")) {
if (!HasFieldInReq(req, callback, "engine")) {
return;
}

Expand Down Expand Up @@ -126,7 +126,7 @@ void server::UnloadModel(
void server::ModelStatus(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) {
if(!HasFieldInReq(req, callback, "engine")) {
if (!HasFieldInReq(req, callback, "engine")) {
return;
}

Expand Down Expand Up @@ -174,7 +174,9 @@ void server::GetModels(const HttpRequestPtr& req,
if (e->IsSupported("GetModels")) {
e->GetModels(req->getJsonObject(),
[&resp_data](Json::Value status, Json::Value res) {
resp_data.append(res);
for (auto r : res["data"]) {
resp_data.append(r);
}
});
}
}
Expand Down Expand Up @@ -354,7 +356,7 @@ void server::ProcessStreamRes(std::function<void(const HttpResponsePtr&)> cb,
};

auto resp = cortex_utils::CreateCortexStreamResponse(chunked_content_provider,
"chat_completions.txt");
"chat_completions.txt");
cb(resp);
}

Expand Down

0 comments on commit 26a4768

Please sign in to comment.