]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
talk-llama : improve quote and backtick handling (#1364)
authorSam Pullara <redacted>
Thu, 16 Nov 2023 08:34:05 +0000 (00:34 -0800)
committerGitHub <redacted>
Thu, 16 Nov 2023 08:34:05 +0000 (10:34 +0200)
* ISSUE-1329: replace " with ' so it doesn't try to execute code in backticks.

* Typo

* Update to keep possessives in the output

Closes the ' then puts a ' in quotes then reopens the ' to escape the ' characters.

examples/talk-llama/talk-llama.cpp

index 925f9b610b1d5fc802d999fb49bdf82dae110b3a..aae392bdc0054b9c6fa9084bc16a8ae46068da03 100644 (file)
@@ -686,8 +686,8 @@ int main(int argc, char ** argv) {
                     }
                 }
 
-                text_to_speak = ::replace(text_to_speak, "\"", "");
-                int ret = system((params.speak + " " + std::to_string(voice_id) + " \"" + text_to_speak + "\"").c_str());
+                text_to_speak = ::replace(text_to_speak, "'", "'\"'\"'");
+                int ret = system((params.speak + " " + std::to_string(voice_id) + " '" + text_to_speak + "'").c_str());
                 if (ret != 0) {
                     fprintf(stderr, "%s: failed to speak\n", __func__);
                 }