明树Git Lab

Commit 12c53dfd authored by zfp1's avatar zfp1

3

parent dd5f291d
...@@ -34,13 +34,15 @@ app.post('/', async (req, res) => { ...@@ -34,13 +34,15 @@ app.post('/', async (req, res) => {
// API调用 [5]() // API调用 [5]()
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: "user", role: "user",
content: message content: message
}], }],
stream: false stream: false
}); });
console.log("completion:::", completion);
// 响应构造 // 响应构造
const responseXML = ` const responseXML = `
<xml> <xml>
...@@ -53,6 +55,7 @@ app.post('/', async (req, res) => { ...@@ -53,6 +55,7 @@ app.post('/', async (req, res) => {
`; `;
res.set('Content-Type', 'text/xml'); res.set('Content-Type', 'text/xml');
console.log(responseXML)
res.send(responseXML); res.send(responseXML);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
...@@ -60,4 +63,4 @@ app.post('/', async (req, res) => { ...@@ -60,4 +63,4 @@ app.post('/', async (req, res) => {
} }
}); });
app.listen(3001, () => console.log(' 服务运行在3000端口')); app.listen(3001, () => console.log(' 服务运行在3001端口'));
\ No newline at end of file \ No newline at end of file
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