Skip to content

Commit e82fea8

Browse files
committed
fix the failing test case
1 parent 58100b3 commit e82fea8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/server/utils.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,12 @@ static json oaicompat_completion_params_parse(
633633
}
634634

635635
// get input files
636-
json messages = json_value(body, "messages", json::array());
636+
if (!body.contains("messages")) {
637+
throw std::runtime_error("'messages' is required");
638+
}
639+
json messages = body.at("messages");
637640
if (!messages.is_array()) {
638-
throw std::runtime_error("Expected 'messages' to be an array, got " + messages.dump());
641+
throw std::runtime_error("Expected 'messages' to be an array");
639642
}
640643
for (auto & msg : messages) {
641644
json & content = msg.at("content");

0 commit comments

Comments
 (0)