fix string escaping

This commit is contained in:
end-4
2025-05-07 23:48:24 +02:00
parent 47a8149968
commit 0a331061c3
3 changed files with 21 additions and 14 deletions
+3 -3
View File
@@ -249,7 +249,7 @@ Singleton {
+ ` ${headerString}`
+ ' -H "Authorization: Bearer ${API_KEY}"'
+ ` -d '${StringUtils.shellSingleQuoteEscape(JSON.stringify(data))}'`
// console.log("Request command: ", requestCommandString);
console.log("Request command: ", requestCommandString);
requester.command = baseCommand.concat([requestCommandString]);
/* Reset vars and make the request */
@@ -302,7 +302,7 @@ Singleton {
if (dataJson.done) requester.message.done = true;
} catch (e) {
console.log("Could not parse response: ", e);
console.log("[AI] Could not parse response from stream: ", e);
requester.message.content += cleanData;
}
}
@@ -314,7 +314,7 @@ Singleton {
const parsedResponse = JSON.parse(requester.message.content + "]");
requester.message.content = `\`\`\`json\n${JSON.stringify(parsedResponse, null, 2)}\n\`\`\``;
} catch (e) {
console.log("Could not parse response: ", e);
console.log("[AI] Could not parse response on exit: ", e);
}
}
}