diff options
author | Xuan Son Nguyen <thichthat@gmail.com> | 2024-02-26 23:15:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 23:15:48 +0100 |
commit | b11a93df41921846a10628a7c306d5c82a549939 (patch) | |
tree | c76a7c14379cbde6ccd554c6049daccb16403003 /examples/server | |
parent | a33e6a0d2a66104ea9a906bdbf8a94d050189d91 (diff) |
fix server hangs on empty prompt (#5733)
Diffstat (limited to 'examples/server')
-rw-r--r-- | examples/server/server.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 8aadc95a..846ef7e5 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -1336,6 +1336,10 @@ struct llama_server_context split_multiprompt_task(task_id, task); } } 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); } } |