From: Tomas Date: Thu, 4 May 2023 10:02:30 +0000 (+0700) Subject: fix #1224 reverse prompt and multi line (#1297) X-Git-Tag: gguf-v0.4.0~805 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=f647ce040ff06348d2ceaa5443a6a7a8b80c70c9;p=pkg%2Fggml%2Fsources%2Fllama.cpp fix #1224 reverse prompt and multi line (#1297) * fix reverse prompt and multi line * Code Formatting Co-authored-by: Georgi Gerganov --------- Co-authored-by: Georgi Gerganov --- diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 125c189a..17a5a90d 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -551,12 +551,14 @@ int main(int argc, char ** argv) { return 0; } #endif - if (line.empty() || line.back() != '\\') { - another_line = false; - } else { - line.pop_back(); // Remove the continue character + if (!line.empty()) { + if (line.back() == '\\') { + line.pop_back(); // Remove the continue character + } else { + another_line = false; + } + buffer += line + '\n'; // Append the line to the result } - buffer += line + '\n'; // Append the line to the result } while (another_line); // done taking input, reset color