This repository was archived by the owner on Jul 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 66#include < drogon/HttpResponse.h>
77#include < drogon/HttpTypes.h>
88#include < regex>
9+ #include < string>
910#include < thread>
1011#include < trantor/utils/Logger.h>
1112
@@ -214,6 +215,17 @@ void llamaCPP::unloadModel(
214215 callback (resp);
215216 return ;
216217}
218+ void llamaCPP::modelStatus (
219+ const HttpRequestPtr &req,
220+ std::function<void (const HttpResponsePtr &)> &&callback) {
221+ Json::Value jsonResp;
222+ jsonResp[" model_loaded" ] = this ->model_loaded .load ();
223+ jsonResp[" model_data" ] = llama.get_model_props ().dump ();
224+
225+ auto resp = nitro_utils::nitroHttpJsonResponse (jsonResp);
226+ callback (resp);
227+ return ;
228+ }
217229
218230void llamaCPP::loadModel (
219231 const HttpRequestPtr &req,
Original file line number Diff line number Diff line change @@ -2125,6 +2125,7 @@ class llamaCPP : public drogon::HttpController<llamaCPP> {
21252125 METHOD_ADD (llamaCPP::embedding, " embedding" , Post);
21262126 METHOD_ADD (llamaCPP::loadModel, " loadmodel" , Post);
21272127 METHOD_ADD (llamaCPP::unloadModel, " unloadmodel" , Get);
2128+ METHOD_ADD (llamaCPP::modelStatus, " modelstatus" , Get);
21282129
21292130 // PATH_ADD("/llama/chat_completion", Post);
21302131 METHOD_LIST_END
@@ -2136,6 +2137,10 @@ class llamaCPP : public drogon::HttpController<llamaCPP> {
21362137 std::function<void (const HttpResponsePtr &)> &&callback);
21372138 void unloadModel (const HttpRequestPtr &req,
21382139 std::function<void (const HttpResponsePtr &)> &&callback);
2140+
2141+ void modelStatus (const HttpRequestPtr &req,
2142+ std::function<void (const HttpResponsePtr &)> &&callback);
2143+
21392144 void warmupModel ();
21402145
21412146 void backgroundTask ();
You can’t perform that action at this time.
0 commit comments