Skip to content

Commit

Permalink
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engine/commands/chat_cmd.cc
Original file line number Diff line number Diff line change
@@ -26,7 +26,11 @@ struct ChunkParser {
if (s.find("[DONE]") != std::string::npos) {
is_done = true;
} else {
content = nlohmann::json::parse(s)["choices"][0]["delta"]["content"];
try {
content = nlohmann::json::parse(s)["choices"][0]["delta"]["content"];
} catch (const nlohmann::json::parse_error& e) {
CTL_WRN("JSON parse error: " << e.what());
}
}
}
}

0 comments on commit 97176fd

Please sign in to comment.