Add null checks for OR pricing
This commit is contained in:
parent
86caffb1c6
commit
4c0b3fb7ae
|
@ -1242,7 +1242,7 @@ function saveModelList(data) {
|
||||||
$('#model_openrouter_select').empty();
|
$('#model_openrouter_select').empty();
|
||||||
$('#model_openrouter_select').append($('<option>', { value: openrouter_website_model, text: 'Use OpenRouter website setting' }));
|
$('#model_openrouter_select').append($('<option>', { value: openrouter_website_model, text: 'Use OpenRouter website setting' }));
|
||||||
model_list.forEach((model) => {
|
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 tokens_rounded = (Math.round(tokens_dollar * 1000) / 1000).toFixed(0);
|
||||||
let model_description = `${model.id} | ${tokens_rounded}k t/$ | ${model.context_length} ctx`;
|
let model_description = `${model.id} | ${tokens_rounded}k t/$ | ${model.context_length} ctx`;
|
||||||
$('#model_openrouter_select').append(
|
$('#model_openrouter_select').append(
|
||||||
|
|
|
@ -2743,7 +2743,7 @@ app.post("/getstatus_openai", jsonParser, async function (request, response_gets
|
||||||
|
|
||||||
data.data.forEach(model => {
|
data.data.forEach(model => {
|
||||||
const context_length = model.context_length;
|
const context_length = model.context_length;
|
||||||
const tokens_dollar = Number(1 / (1000 * model.pricing.prompt));
|
const tokens_dollar = Number(1 / (1000 * model.pricing?.prompt));
|
||||||
const tokens_rounded = (Math.round(tokens_dollar * 1000) / 1000).toFixed(0);
|
const tokens_rounded = (Math.round(tokens_dollar * 1000) / 1000).toFixed(0);
|
||||||
models[model.id] = {
|
models[model.id] = {
|
||||||
tokens_per_dollar: tokens_rounded + 'k',
|
tokens_per_dollar: tokens_rounded + 'k',
|
||||||
|
|
Loading…
Reference in New Issue