Skip to content

Commit b11a93d

Browse files
authored
fix server hangs on empty prompt (#5733)
1 parent a33e6a0 commit b11a93d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/server/server.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,10 @@ struct llama_server_context
13361336
split_multiprompt_task(task_id, task);
13371337
}
13381338
} else {
1339+
// an empty prompt can make slot become buggy
1340+
if (task.data.contains("prompt") && task.data["prompt"].is_string() && task.data["prompt"].get<std::string>().empty()) {
1341+
task.data["prompt"] = " "; // add a space so that we have one token
1342+
}
13391343
queue_tasks.post(task);
13401344
}
13411345
}

0 commit comments

Comments
 (0)