Return type casts where they were

This commit is contained in:
Cohee
2025-02-25 22:12:22 +02:00
parent 11d56a407d
commit 861c502e44
5 changed files with 11 additions and 11 deletions

View File

@@ -372,8 +372,8 @@ router.post('/generate', jsonParser, async function (request, response) {
}
if (request.body.api_type === TEXTGEN_TYPES.OLLAMA) {
const keepAlive = getConfigValue('ollama.keepAlive', -1, 'number');
const numBatch = getConfigValue('ollama.batchSize', -1, 'number');
const keepAlive = Number(getConfigValue('ollama.keepAlive', -1, 'number'));
const numBatch = Number(getConfigValue('ollama.batchSize', -1, 'number'));
if (numBatch > 0) {
request.body['num_batch'] = numBatch;
}

View File

@@ -24,7 +24,7 @@ import { importRisuSprites } from './sprites.js';
const defaultAvatarPath = './public/img/ai4.png';
// KV-store for parsed character data
const cacheCapacity = getConfigValue('cardsCacheCapacity', 100, 'number'); // MB
const cacheCapacity = Number(getConfigValue('cardsCacheCapacity', 100, 'number')); // MB
// With 100 MB limit it would take roughly 3000 characters to reach this limit
const characterDataCache = new MemoryLimitedMap(1024 * 1024 * cacheCapacity);
// Some Android devices require tighter memory management

View File

@@ -19,9 +19,9 @@ import {
formatBytes,
} from '../util.js';
const isBackupEnabled = getConfigValue('backups.chat.enabled', true, 'boolean');
const maxTotalChatBackups = getConfigValue('backups.chat.maxTotalBackups', -1, 'number');
const throttleInterval = getConfigValue('backups.chat.throttleInterval', 10_000, 'number');
const isBackupEnabled = !!getConfigValue('backups.chat.enabled', true, 'boolean');
const maxTotalChatBackups = Number(getConfigValue('backups.chat.maxTotalBackups', -1, 'number'));
const throttleInterval = Number(getConfigValue('backups.chat.throttleInterval', 10_000, 'number'));
/**
* Saves a chat to the backups directory.

View File

@@ -11,9 +11,9 @@ import { jsonParser } from '../express-common.js';
import { getAllUserHandles, getUserDirectories } from '../users.js';
import { getFileNameValidationFunction } from '../middleware/validateFileName.js';
const ENABLE_EXTENSIONS = getConfigValue('extensions.enabled', true, 'boolean');
const ENABLE_EXTENSIONS_AUTO_UPDATE = getConfigValue('extensions.autoUpdate', true, 'boolean');
const ENABLE_ACCOUNTS = getConfigValue('enableUserAccounts', false, 'boolean');
const ENABLE_EXTENSIONS = !!getConfigValue('extensions.enabled', true, 'boolean');
const ENABLE_EXTENSIONS_AUTO_UPDATE = !!getConfigValue('extensions.autoUpdate', true, 'boolean');
const ENABLE_ACCOUNTS = !!getConfigValue('enableUserAccounts', false, 'boolean');
// 10 minutes
const AUTOSAVE_INTERVAL = 10 * 60 * 1000;

View File

@@ -7,8 +7,8 @@ import { default as git, CheckRepoActions } from 'simple-git';
import { sync as commandExistsSync } from 'command-exists';
import { getConfigValue, color } from './util.js';
const enableServerPlugins = getConfigValue('enableServerPlugins', false, 'boolean');
const enableServerPluginsAutoUpdate = getConfigValue('enableServerPluginsAutoUpdate', true, 'boolean');
const enableServerPlugins = !!getConfigValue('enableServerPlugins', false, 'boolean');
const enableServerPluginsAutoUpdate = !!getConfigValue('enableServerPluginsAutoUpdate', true, 'boolean');
/**
* Map of loaded plugins.