summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authoranzz1 <anzz1@live.com>2023-03-25 14:03:19 +0200
committerGitHub <noreply@github.com>2023-03-25 14:03:19 +0200
commitfbd4d38c647f82b2598291ea9b8d0c09ac1ffb8c (patch)
tree8382932943e84ef338effde93df1f87ef0549d7e /main.cpp
parent58e6c9f36f97d0a3e287b97256dc5f6b0e9fb5ae (diff)
feat: '--in-prefix STRING' option (#426)
Prefix user inputs with a string
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 3f49ad99..143585bf 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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 {