兼容 anthropic api system 格式

This commit is contained in:
Archeb
2024-04-08 17:53:00 +08:00
parent c1f4388372
commit ae75d1c3a6
+4
View File
@@ -49,6 +49,10 @@ app.post("/v1/messages", (req, res) => {
let userMessage = [{ question: "", answer: "" }];
let userQuery = "";
let lastUpdate = true;
if(jsonBody.system) {
// 把系统消息加入messages的首条
jsonBody.messages.unshift({role: "system", content: jsonBody.system});
}
jsonBody.messages.forEach((msg) => {
if (msg.role == "system" || msg.role == "user") {
if (lastUpdate) {