fetchModels ouput are only the gpt- models ordered by id desc

This commit is contained in:
mic 2024-07-22 23:35:54 +02:00
parent 2576800e94
commit 59ec47b2e8

View file

@ -45,7 +45,10 @@ export class OpenAI {
console.log(err_msg);
throw new Error(err_msg);
}
return await response.json();
let output = await response.json();
return output.data.filter(item => item.id.startsWith('gpt-')).sort((a, b) => b.id.localeCompare(a.id));
}
fetchResponse = async (model, messages, maxTokens = 0) => {