diff --git a/src/endpoints/backends/text-completions.js b/src/endpoints/backends/text-completions.js index fa7cd089a..618bad832 100644 --- a/src/endpoints/backends/text-completions.js +++ b/src/endpoints/backends/text-completions.js @@ -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; } diff --git a/src/endpoints/characters.js b/src/endpoints/characters.js index 8e6f831d9..ca99bf266 100644 --- a/src/endpoints/characters.js +++ b/src/endpoints/characters.js @@ -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 diff --git a/src/endpoints/chats.js b/src/endpoints/chats.js index e72542789..a237b3109 100644 --- a/src/endpoints/chats.js +++ b/src/endpoints/chats.js @@ -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. diff --git a/src/endpoints/settings.js b/src/endpoints/settings.js index de4afd36f..2f31b82f3 100644 --- a/src/endpoints/settings.js +++ b/src/endpoints/settings.js @@ -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; diff --git a/src/plugin-loader.js b/src/plugin-loader.js index ed497c257..7d7053025 100644 --- a/src/plugin-loader.js +++ b/src/plugin-loader.js @@ -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.