mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Implicit variables to explicit
This commit is contained in:
16
server.js
16
server.js
@@ -2966,19 +2966,13 @@ app.post("/getstatus_openai", jsonParser, function (request, response_getstatus_
|
|||||||
response_getstatus_openai.send(data);
|
response_getstatus_openai.send(data);
|
||||||
if (request.body.use_openrouter) {
|
if (request.body.use_openrouter) {
|
||||||
let models = [];
|
let models = [];
|
||||||
data.data.forEach(model =>
|
data.data.forEach(model => {
|
||||||
{
|
const context_length = model.context_length;
|
||||||
context_length = model.context_length;
|
const prompt_max_price = parseFloat(model.pricing.prompt) * context_length;
|
||||||
prompt_max_price = parseFloat(model.pricing.prompt) * context_length;
|
const price_rounded = (Math.round(prompt_max_price * 1000) / 1000).toFixed(3);
|
||||||
price_rounded = (Math.round(prompt_max_price * 1000)/1000).toFixed(3);
|
|
||||||
// completion_price = parseFloat(model.pricing.completion) * 1000;
|
|
||||||
models[model.id] = {
|
models[model.id] = {
|
||||||
// prompt_max_price: { text: price_rounded,
|
|
||||||
// val: prompt_max_price },
|
|
||||||
// completion_price: { text: (Math.round(completion_price * 1000)/1000).toFixed(3),
|
|
||||||
// val: completion_price },
|
|
||||||
prompt_max_price: price_rounded,
|
prompt_max_price: price_rounded,
|
||||||
context_length: model.context_length,
|
context_length: context_length,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log('Available OpenRouter models:', models);
|
console.log('Available OpenRouter models:', models);
|
||||||
|
Reference in New Issue
Block a user