Skip to content

Commit

Permalink
fix server hangs on empty prompt (#5733)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxson committed Feb 26, 2024
1 parent a33e6a0 commit b11a93d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/server/server.cpp
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit b11a93d

Please sign in to comment.