Fix non streaming

This commit is contained in:
NWilson
2024-02-19 09:46:56 -06:00
parent c6c73fedad
commit 90d5fbc182

View File

@ -294,6 +294,11 @@ router.post('/generate', jsonParser, async function (request, response) {
data['choices'] = [{ text }];
}
// Map InfermaticAI response to OAI completions format
if (request.body.api_type === TEXTGEN_TYPES.INFERMATICAI) {
data['choices'] = (data?.choices || []).map(choice => ({ text: choice.message.content }));
}
return response.send(data);
} else {
const text = await completionsReply.text();