perf: 优化系统提示消息

This commit is contained in:
Archer
2023-03-17 00:53:27 +08:00
parent 1e770088d0
commit d85b4c0945
6 changed files with 26 additions and 28 deletions

View File

@@ -49,21 +49,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
error;
}
const defaultContent = model.systemPrompt
? [
{
obj: 'SYSTEM',
value: model.systemPrompt
}
]
: [];
if (!history) {
// 没有记录,创建一个
const response = await ChatWindow.create({
chatId,
updateTime: Date.now(),
content: defaultContent
content: []
});
responseId = response._id;
}
@@ -78,7 +69,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
secret: model.security,
chatModel: model.service.chatModel
},
history: history ? history.content : defaultContent
history: history ? history.content : []
}
});
} catch (err) {