Skip to content

Commit 6f04d0a

Browse files
committed
Fixed the issue where escape characters were not handled correctly in the code when executing it.
1 parent 0c2a04e commit 6f04d0a

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

include/Utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <string>
55
#include <tuple>
6+
#include <vector>
67

78
/**
89
* @brief 处理JSON流中的转义字符。

src/Utils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ std::string unescape_string(std::string s) {
1616
return s;
1717
}
1818

19-
2019
std::tuple<std::string, std::string> safe_print_with_escapes(const std::string& buffer) {
2120
if (buffer.empty()) {
2221
return {"", ""};

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void main_loop() {
9595
try {
9696
std::string tool_name = tool_call.function["name"];
9797
auto arguments = nlohmann::json::parse(tool_call.function["arguments"].get<std::string>());
98-
std::string code_to_run = unescape_string(arguments["code"]);
98+
std::string code_to_run = arguments["code"];
9999

100100
if (tool_name == "python") {
101101
result = python_executor.execute(code_to_run);

0 commit comments

Comments
 (0)