]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
run: allow to customize prompt by env var LLAMA_PROMPT_PREFIX (#12041)
authorFlorent BENOIT <redacted>
Sun, 23 Feb 2025 17:15:51 +0000 (18:15 +0100)
committerGitHub <redacted>
Sun, 23 Feb 2025 17:15:51 +0000 (17:15 +0000)
Signed-off-by: Florent Benoit <redacted>
examples/run/run.cpp

index de736c7d5a3d98df760f84ecd5f6596dc867b322..38407d5190923c193e4657b857ccae4238da4dac 100644 (file)
@@ -977,7 +977,8 @@ static int generate(LlamaData & llama_data, const std::string & prompt, std::str
 }
 
 static int read_user_input(std::string & user_input) {
-    static const char * prompt_prefix = "> ";
+    static const char * prompt_prefix_env = std::getenv("LLAMA_PROMPT_PREFIX");
+    static const char * prompt_prefix     = prompt_prefix_env ? prompt_prefix_env : "> ";
 #ifdef WIN32
     printf("\r" LOG_CLR_TO_EOL LOG_COL_DEFAULT "%s", prompt_prefix);