feat: '--in-prefix STRING' option (#426)

Prefix user inputs with a string
This commit is contained in:
anzz1 2023-03-25 14:03:19 +02:00 committed by GitHub
parent 58e6c9f36f
commit fbd4d38c64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -300,6 +300,10 @@ int main(int argc, char ** argv) {
fprintf(stderr, "Reverse prompt: '%s'\n", antiprompt.c_str());
}
}
if (!params.input_prefix.empty()) {
fprintf(stderr, "Input prefix: '%s'\n", params.input_prefix.c_str());
}
}
fprintf(stderr, "sampling parameters: temp = %f, top_k = %d, top_p = %f, repeat_last_n = %i, repeat_penalty = %f\n", params.temp, params.top_k, params.top_p, params.repeat_last_n, params.repeat_penalty);
fprintf(stderr, "\n\n");
@ -472,6 +476,11 @@ int main(int argc, char ** argv) {
}
std::string buffer;
if (!params.input_prefix.empty()) {
buffer += params.input_prefix;
printf(buffer.c_str());
}
std::string line;
bool another_line = true;
do {