mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 21:06:22 +00:00
fix(ai): convert \n escape sequences to actual newlines in LLM responses
This commit is contained in:
@@ -608,6 +608,9 @@ _parse_ai_response(const gchar* response_json)
|
|||||||
if (*in == '\\' && *(in + 1) == '"') {
|
if (*in == '\\' && *(in + 1) == '"') {
|
||||||
*out++ = '"';
|
*out++ = '"';
|
||||||
in += 2;
|
in += 2;
|
||||||
|
} else if (*in == '\\' && *(in + 1) == 'n') {
|
||||||
|
*out++ = '\n';
|
||||||
|
in += 2;
|
||||||
} else {
|
} else {
|
||||||
*out++ = *in++;
|
*out++ = *in++;
|
||||||
}
|
}
|
||||||
@@ -646,6 +649,9 @@ _parse_ai_response(const gchar* response_json)
|
|||||||
if (*in == '\\' && *(in + 1) == '"') {
|
if (*in == '\\' && *(in + 1) == '"') {
|
||||||
*out++ = '"';
|
*out++ = '"';
|
||||||
in += 2;
|
in += 2;
|
||||||
|
} else if (*in == '\\' && *(in + 1) == 'n') {
|
||||||
|
*out++ = '\n';
|
||||||
|
in += 2;
|
||||||
} else {
|
} else {
|
||||||
*out++ = *in++;
|
*out++ = *in++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user