mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-06-27 20:05:20 +00:00
* add system_prompt_file * add -sysf / --system-prompt-file * remove system_prompt_file
This commit is contained in:
@ -853,6 +853,20 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
).set_excludes({LLAMA_EXAMPLE_SERVER}));
|
).set_excludes({LLAMA_EXAMPLE_SERVER}));
|
||||||
|
add_opt(common_arg(
|
||||||
|
{"-sysf", "--system-prompt-file"}, "FNAME",
|
||||||
|
"a file containing the system prompt (default: none)",
|
||||||
|
[](common_params & params, const std::string & value) {
|
||||||
|
std::ifstream file(value);
|
||||||
|
if (!file) {
|
||||||
|
throw std::runtime_error(string_format("error: failed to open file '%s'\n", value.c_str()));
|
||||||
|
}
|
||||||
|
std::copy(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>(), back_inserter(params.system_prompt));
|
||||||
|
if (!params.system_prompt.empty() && params.system_prompt.back() == '\n') {
|
||||||
|
params.system_prompt.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).set_examples({LLAMA_EXAMPLE_MAIN}));
|
||||||
add_opt(common_arg(
|
add_opt(common_arg(
|
||||||
{"--in-file"}, "FNAME",
|
{"--in-file"}, "FNAME",
|
||||||
"an input file (repeat to specify multiple files)",
|
"an input file (repeat to specify multiple files)",
|
||||||
|
Reference in New Issue
Block a user