Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Changes from all commits
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
9 changes: 5 additions & 4 deletions controllers/llamaCPP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ void llamaCPP::InferenceImpl(
if (llama.model_type == ModelType::EMBEDDING) {
LOG_WARN << "Not support completion for embedding model";
Json::Value jsonResp;
jsonResp["message"] =
"Not support completion for embedding model";
jsonResp["message"] = "Not support completion for embedding model";
auto resp = nitro_utils::nitroHttpJsonResponse(jsonResp);
resp->setStatusCode(drogon::k400BadRequest);
callback(resp);
Expand Down Expand Up @@ -429,7 +428,8 @@ void llamaCPP::InferenceImpl(

// Since this is an async task, we will wait for the task to be
// completed
while (state->inference_status != FINISHED && retries < 10) {
while (state->inference_status != FINISHED && retries < 10 &&
state->instance->llama.model_loaded_external) {
// Should wait chunked_content_provider lambda to be called within
// 3s
if (state->inference_status == PENDING) {
Expand Down Expand Up @@ -748,9 +748,10 @@ void llamaCPP::StopBackgroundTask() {
if (llama.model_loaded_external) {
llama.model_loaded_external = false;
llama.condition_tasks.notify_one();
LOG_INFO << "Background task stopped! ";
LOG_INFO << "Stopping background task! ";
if (backgroundThread.joinable()) {
backgroundThread.join();
}
LOG_INFO << "Background task stopped! ";
}
}