明树Git Lab

Commit bf620c13 authored by zfp1's avatar zfp1

update

parent cd3a7b22
......@@ -46,7 +46,24 @@ app.post('/wechat', async (req, res) => {
fullContent += chunk.choices[0].message.content || '';
}
console.log("completion:::", fullContent);
const xmlEntities = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&apos;'
};
function escapeWechatContent(text) {
// 处理换行符[1]()[2]()
let escaped = text.replace(/\n/g, '&#10;');
// 转义XML特殊字符[3]()[5]()
escaped = escaped.replace(/[&<>"']/g, (char) => xmlEntities[char]);
return escaped;
}
fullContent = escapeWechatContent(fullContent);
// 响应构造
const responseXML = `
<xml>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment