Skip to content

Commit

Permalink
fix wrong api endpoind - handler mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
thunhu99 committed Nov 2, 2023
1 parent 3d81378 commit af3bdb9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/llamaCPP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,12 @@ void llamaCPP::loadModel(
void inferences::llamaCPP::unloadModel(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
{
Json::Value jsonResp;
jsonResp["message"] = "No model loaded";
if (model_loaded) {
llama.unloadModel();
model_loaded = false;
jsonResp["message"] = "Model unloaded successfully";
}
jsonResp["message"] = "No model loaded";
auto resp = nitro_utils::nitroHttpJsonResponse(jsonResp);
callback(resp);
}
2 changes: 1 addition & 1 deletion controllers/llamaCPP.h
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ class llamaCPP : public drogon::HttpController<llamaCPP> {
METHOD_ADD(llamaCPP::chatCompletion, "chat_completion", Post);
METHOD_ADD(llamaCPP::embedding, "embedding", Post);
METHOD_ADD(llamaCPP::loadModel, "loadmodel", Post);
METHOD_ADD(llamaCPP::loadModel, "unloadmodel", Delete);
METHOD_ADD(llamaCPP::unloadModel, "unloadmodel", Delete);
// PATH_ADD("/llama/chat_completion", Post);
METHOD_LIST_END
void chatCompletion(const HttpRequestPtr &req,
Expand Down

0 comments on commit af3bdb9

Please sign in to comment.