Add null checks for OR pricing

This commit is contained in:
Cohee
2023-11-12 13:07:57 +02:00
parent 86caffb1c6
commit 4c0b3fb7ae
2 changed files with 2 additions and 2 deletions

View File

@ -1242,7 +1242,7 @@ function saveModelList(data) {
$('#model_openrouter_select').empty();
$('#model_openrouter_select').append($('<option>', { value: openrouter_website_model, text: 'Use OpenRouter website setting' }));
model_list.forEach((model) => {
let tokens_dollar = Number(1 / (1000 * model.pricing.prompt));
let tokens_dollar = Number(1 / (1000 * model.pricing?.prompt));
let tokens_rounded = (Math.round(tokens_dollar * 1000) / 1000).toFixed(0);
let model_description = `${model.id} | ${tokens_rounded}k t/$ | ${model.context_length} ctx`;
$('#model_openrouter_select').append(