fix server hangs on empty prompt (#5733)

This commit is contained in:
Xuan Son Nguyen 2024-02-26 23:15:48 +01:00 committed by GitHub
parent a33e6a0d2a
commit b11a93df41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1336,6 +1336,10 @@ struct llama_server_context
split_multiprompt_task(task_id, task); split_multiprompt_task(task_id, task);
} }
} else { } else {
// an empty prompt can make slot become buggy
if (task.data.contains("prompt") && task.data["prompt"].is_string() && task.data["prompt"].get<std::string>().empty()) {
task.data["prompt"] = " "; // add a space so that we have one token
}
queue_tasks.post(task); queue_tasks.post(task);
} }
} }