明树Git Lab

Commit 28506bce authored by zfp1's avatar zfp1

update

parent 6d7b69a1
...@@ -35,14 +35,14 @@ app.post('/wechat', async (req, res) => { ...@@ -35,14 +35,14 @@ app.post('/wechat', async (req, res) => {
const completion = await openai.chat.completions.create({ const completion = await openai.chat.completions.create({
model: "deepseek-chat", model: "deepseek-chat",
messages: [ messages: [
{ role: "system", content: "你是一个微信服务号智能助手, 限制你的字符输出要低于2048个字节。" }, { { role: "system", content: "你是一个微信服务号智能助手,限制你的字符输出要低于2048个字节。" },{
role: "user", role: "user",
content: message content: message
}], }],
stream: false stream: false
}); });
let fullContent = completion.choices[0].message.content|| '';
console.log("completion:::", completion);
const xmlEntities = { const xmlEntities = {
'&': '&', '&': '&',
'<': '&lt;', '<': '&lt;',
...@@ -60,13 +60,13 @@ app.post('/wechat', async (req, res) => { ...@@ -60,13 +60,13 @@ app.post('/wechat', async (req, res) => {
return escaped; return escaped;
} }
fullContent = escapeWechatContent(fullContent); let fullContent = escapeWechatContent(completion.choices[0].message.content);
// 响应构造 // 响应构造
const responseXML = ` const responseXML = `
<xml> <xml>
<ToUserName><![CDATA[${fromUser}]]></ToUserName> <ToUserName><![CDATA[${fromUser}]]></ToUserName>
<FromUserName><![CDATA[${result.xml.ToUserName[0]}]]></FromUserName> <FromUserName><![CDATA[${result.xml.ToUserName[0]}]]></FromUserName>
<CreateTime>${Math.floor(Date.now() / 1000)}</CreateTime> <CreateTime>${Math.floor(Date.now()/1000)}</CreateTime>
<MsgType><![CDATA[text]]></MsgType> <MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[${fullContent}]]></Content> <Content><![CDATA[${fullContent}]]></Content>
</xml> </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