aboutsummaryrefslogtreecommitdiff
path: root/examples/main
diff options
context:
space:
mode:
authorTomas <tom.tomas.36478119@gmail.com>2023-05-04 17:02:30 +0700
committerGitHub <noreply@github.com>2023-05-04 03:02:30 -0700
commitf647ce040ff06348d2ceaa5443a6a7a8b80c70c9 (patch)
treeae3dffa29d15716d885e02e840db3a3859d06f7f /examples/main
parent799fdc1b5d888b8a8682baf112e1c2a2df0df1c4 (diff)
fix #1224 reverse prompt and multi line (#1297)
* fix reverse prompt and multi line * Code Formatting Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'examples/main')
-rw-r--r--examples/main/main.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index 125c189..17a5a90 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