| 
3 | 3 | #include <time.h>  | 
4 | 4 | #include <iostream>  | 
5 | 5 | #include <random>  | 
 | 6 | +#include <iomanip>  | 
 | 7 | +#include <sstream>  | 
6 | 8 | #include <string>  | 
7 | 9 | #include <vector>  | 
8 | 10 | 
 
  | 
@@ -387,20 +389,21 @@ std::string clean_input_prompt(const std::string& input) {  | 
387 | 389 |     return result;  | 
388 | 390 | }  | 
389 | 391 | 
 
  | 
390 |  | -static std::string get_image_params(const SDParams& params) {  | 
391 |  | -    std::string parameter_string = "";  | 
392 |  | -    parameter_string += "Prompt: " + params.prompt + " | ";  | 
393 |  | -    parameter_string += "NegativePrompt: " + params.negative_prompt + " | ";  | 
394 |  | -    parameter_string += "Steps: " + std::to_string(params.sample_steps) + " | ";  | 
395 |  | -    parameter_string += "CFGScale: " + std::to_string(params.cfg_scale) + " | ";  | 
396 |  | -    parameter_string += "Guidance: " + std::to_string(params.guidance) + " | ";  | 
397 |  | -    parameter_string += "Seed: " + std::to_string(params.seed) + " | ";  | 
398 |  | -    parameter_string += "Size: " + std::to_string(params.width) + "x" + std::to_string(params.height) + " | ";  | 
399 |  | -    parameter_string += "Sampler: " + std::to_string((int)sd_params->sample_method) + " | ";  | 
400 |  | -    parameter_string += "Clip skip: " + std::to_string((int)sd_params->clip_skip) + " | ";  | 
401 |  | -    parameter_string += "Model: " + sdmodelfilename + " | ";  | 
402 |  | -    parameter_string += "Version: KoboldCpp";  | 
403 |  | -    return parameter_string;  | 
 | 392 | +static std::string get_image_params(const sd_img_gen_params_t & params) {  | 
 | 393 | +    std::stringstream parameter_string;  | 
 | 394 | +    parameter_string << std::setprecision(3)  | 
 | 395 | +        <<    "Prompt: " << params.prompt  | 
 | 396 | +        << " | NegativePrompt: " << params.negative_prompt  | 
 | 397 | +        << " | Steps: " << params.sample_steps  | 
 | 398 | +        << " | CFGScale: " << params.guidance.txt_cfg  | 
 | 399 | +        << " | Guidance: " << params.guidance.distilled_guidance  | 
 | 400 | +        << " | Seed: " << params.seed  | 
 | 401 | +        << " | Size: " << params.width << "x" << params.height  | 
 | 402 | +        << " | Sampler: " << sd_sample_method_name(params.sample_method)  | 
 | 403 | +        << " | Clip skip: " << params.clip_skip  | 
 | 404 | +        << " | Model: " << sdmodelfilename  | 
 | 405 | +        << " | Version: KoboldCpp";  | 
 | 406 | +    return parameter_string.str();  | 
404 | 407 | }  | 
405 | 408 | 
 
  | 
406 | 409 | static inline int rounddown_64(int n) {  | 
@@ -930,7 +933,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)  | 
930 | 933 |         }  | 
931 | 934 | 
 
  | 
932 | 935 |         int out_data_len;  | 
933 |  | -        unsigned char * png = stbi_write_png_to_mem(results[i].data, 0, results[i].width, results[i].height, results[i].channel, &out_data_len, get_image_params(*sd_params).c_str());  | 
 | 936 | +        unsigned char * png = stbi_write_png_to_mem(results[i].data, 0, results[i].width, results[i].height, results[i].channel, &out_data_len, get_image_params(params).c_str());  | 
934 | 937 |         if (png != NULL)  | 
935 | 938 |         {  | 
936 | 939 |             recent_data = kcpp_base64_encode(png,out_data_len);  | 
 | 
0 commit comments