]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
fix #1224 reverse prompt and multi line (#1297)
authorTomas <redacted>
Thu, 4 May 2023 10:02:30 +0000 (17:02 +0700)
committerGitHub <redacted>
Thu, 4 May 2023 10:02:30 +0000 (03:02 -0700)
* fix reverse prompt and multi line

* Code Formatting

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
examples/main/main.cpp

index 125c189a38b34523677ec6a8d92e05f86c2f64c3..17a5a90d167c83e931e2df38d2443de7b22bb747 100644 (file)
@@ -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