fixes legacy compat endpoint

This commit is contained in:
nai-degen 2024-03-05 01:38:39 -06:00
parent 2643dfea61
commit 055d650c5d
1 changed files with 7 additions and 8 deletions

View File

@ -283,11 +283,14 @@ export function handleCompatibilityRequest(
) {
const alreadyInChatFormat = Boolean(req.body.messages);
const alreadyUsingClaude3 = req.body.model?.includes("claude-3");
if (!alreadyInChatFormat && !alreadyUsingClaude3) {
return next();
if (!alreadyUsingClaude3) {
req.body.model = CLAUDE_3_COMPAT_MODEL;
}
if (alreadyInChatFormat) {
if (!alreadyInChatFormat) {
return next();
} else {
sendErrorToClient({
req,
res,
@ -299,11 +302,7 @@ export function handleCompatibilityRequest(
statusCode: 400,
reqId: req.id,
},
});
}
if (!alreadyUsingClaude3) {
req.body.model = CLAUDE_3_COMPAT_MODEL;
})
}
next();
}