Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/server/routes_openai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static bool build_openai_generation_request(const httplib::Request& req,
std::string size = j.value("size", "");
std::string output_format = j.value("output_format", "png");
int output_compression = j.value("output_compression", 100);
int steps = j.value("steps", -1);
int width = runtime.default_gen_params->width > 0 ? runtime.default_gen_params->width : 512;
int height = runtime.default_gen_params->width > 0 ? runtime.default_gen_params->height : 512;
if (!size.empty()) {
Expand Down Expand Up @@ -62,6 +63,9 @@ static bool build_openai_generation_request(const httplib::Request& req,
request.gen_params.width = width;
request.gen_params.height = height;
request.gen_params.batch_count = n;
if (steps > 0) {
request.gen_params.sample_params.sample_steps = steps;
}

std::string sd_cpp_extra_args_str = extract_and_remove_sd_cpp_extra_args(request.gen_params.prompt);
if (!sd_cpp_extra_args_str.empty() && !request.gen_params.from_json_str(sd_cpp_extra_args_str)) {
Expand Down