From: Sam Pullara Date: Thu, 16 Nov 2023 08:34:05 +0000 (-0800) Subject: talk-llama : improve quote and backtick handling (#1364) X-Git-Tag: upstream/1.7.4~1253 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=7883d1cae47d3e4d5fc8b60612f15ff8f05d250e;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp talk-llama : improve quote and backtick handling (#1364) * 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. --- diff --git a/examples/talk-llama/talk-llama.cpp b/examples/talk-llama/talk-llama.cpp index 925f9b61..aae392bd 100644 --- a/examples/talk-llama/talk-llama.cpp +++ b/examples/talk-llama/talk-llama.cpp @@ -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__); }