From 8826fb8e2f0c2e06f96a1e06f09278aa57d6ef6b Mon Sep 17 00:00:00 2001 From: Evan Jones Date: Tue, 9 May 2023 22:28:40 -0400 Subject: [PATCH] move the check for incompatible parameters to gpt_params_parse --- examples/common.cpp | 7 +++++++ examples/main/main.cpp | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/common.cpp b/examples/common.cpp index 9b8e2c39c65d0..f3085b08e5b25 100644 --- a/examples/common.cpp +++ b/examples/common.cpp @@ -344,6 +344,13 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) { gpt_print_usage(argc, argv, default_params); exit(1); } + if (params.prompt_cache_all && + (params.interactive || params.interactive_first || + params.instruct || params.antiprompt.size())) { + fprintf(stderr, "error: --prompt-cache-all not supported in interactive mode yet\n"); + gpt_print_usage(argc, argv, default_params); + exit(1); + } if (escape_prompt) { process_escapes(params.prompt); } diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 6604e60f20f0d..468ce30c78574 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -235,11 +235,6 @@ int main(int argc, char ** argv) { } if (params.interactive) { - if (params.prompt_cache_all) { - fprintf(stderr, "error: --prompt-cache-all not supported in interactive mode yet\n"); - return 1; - } - #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) struct sigaction sigint_action; sigint_action.sa_handler = sigint_handler;