Return type casts where they were
| @@ -372,8 +372,8 @@ router.post('/generate', jsonParser, async function (request, response) { | |||
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | if (request.body.api_type === TEXTGEN_TYPES.OLLAMA) { | 374 | if (request.body.api_type === TEXTGEN_TYPES.OLLAMA) { |
| 375 | const keepAlive = getConfigValue('ollama.keepAlive', -1, 'number'); | 375 | const keepAlive = Number(getConfigValue('ollama.keepAlive', -1, 'number')); |
| 376 | const numBatch = getConfigValue('ollama.batchSize', -1, 'number'); | 376 | const numBatch = Number(getConfigValue('ollama.batchSize', -1, 'number')); |
| 377 | if (numBatch > 0) { | 377 | if (numBatch > 0) { |
| 378 | request.body['num_batch'] = numBatch; | 378 | request.body['num_batch'] = numBatch; |
| 379 | } | 379 | } |
| @@ -24,7 +24,7 @@ import { importRisuSprites } from './sprites.js'; | |||
| 24 | const defaultAvatarPath = './public/img/ai4.png'; | 24 | const defaultAvatarPath = './public/img/ai4.png'; |
| 25 | 25 | ||
| 26 | // KV-store for parsed character data | 26 | // KV-store for parsed character data |
| 27 | const cacheCapacity = getConfigValue('cardsCacheCapacity', 100, 'number'); // MB | 27 | const cacheCapacity = Number(getConfigValue('cardsCacheCapacity', 100, 'number')); // MB |
| 28 | // With 100 MB limit it would take roughly 3000 characters to reach this limit | 28 | // With 100 MB limit it would take roughly 3000 characters to reach this limit |
| 29 | const characterDataCache = new MemoryLimitedMap(1024 * 1024 * cacheCapacity); | 29 | const characterDataCache = new MemoryLimitedMap(1024 * 1024 * cacheCapacity); |
| 30 | // Some Android devices require tighter memory management | 30 | // Some Android devices require tighter memory management |
| @@ -19,9 +19,9 @@ import { | |||
| 19 | formatBytes, | 19 | formatBytes, |
| 20 | } from '../util.js'; | 20 | } from '../util.js'; |
| 21 | 21 | ||
| 22 | const isBackupEnabled = getConfigValue('backups.chat.enabled', true, 'boolean'); | 22 | const isBackupEnabled = !!getConfigValue('backups.chat.enabled', true, 'boolean'); |
| 23 | const maxTotalChatBackups = getConfigValue('backups.chat.maxTotalBackups', -1, 'number'); | 23 | const maxTotalChatBackups = Number(getConfigValue('backups.chat.maxTotalBackups', -1, 'number')); |
| 24 | const throttleInterval = getConfigValue('backups.chat.throttleInterval', 10_000, 'number'); | 24 | const throttleInterval = Number(getConfigValue('backups.chat.throttleInterval', 10_000, 'number')); |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * Saves a chat to the backups directory. | 27 | * Saves a chat to the backups directory. |
| @@ -11,9 +11,9 @@ import { jsonParser } from '../express-common.js'; | |||
| 11 | import { getAllUserHandles, getUserDirectories } from '../users.js'; | 11 | import { getAllUserHandles, getUserDirectories } from '../users.js'; |
| 12 | import { getFileNameValidationFunction } from '../middleware/validateFileName.js'; | 12 | import { getFileNameValidationFunction } from '../middleware/validateFileName.js'; |
| 13 | 13 | ||
| 14 | const ENABLE_EXTENSIONS = getConfigValue('extensions.enabled', true, 'boolean'); | 14 | const ENABLE_EXTENSIONS = !!getConfigValue('extensions.enabled', true, 'boolean'); |
| 15 | const ENABLE_EXTENSIONS_AUTO_UPDATE = getConfigValue('extensions.autoUpdate', true, 'boolean'); | 15 | const ENABLE_EXTENSIONS_AUTO_UPDATE = !!getConfigValue('extensions.autoUpdate', true, 'boolean'); |
| 16 | const ENABLE_ACCOUNTS = getConfigValue('enableUserAccounts', false, 'boolean'); | 16 | const ENABLE_ACCOUNTS = !!getConfigValue('enableUserAccounts', false, 'boolean'); |
| 17 | 17 | ||
| 18 | // 10 minutes | 18 | // 10 minutes |
| 19 | const AUTOSAVE_INTERVAL = 10 * 60 * 1000; | 19 | const AUTOSAVE_INTERVAL = 10 * 60 * 1000; |
| @@ -7,8 +7,8 @@ import { default as git, CheckRepoActions } from 'simple-git'; | |||
| 7 | import { sync as commandExistsSync } from 'command-exists'; | 7 | import { sync as commandExistsSync } from 'command-exists'; |
| 8 | import { getConfigValue, color } from './util.js'; | 8 | import { getConfigValue, color } from './util.js'; |
| 9 | 9 | ||
| 10 | const enableServerPlugins = getConfigValue('enableServerPlugins', false, 'boolean'); | 10 | const enableServerPlugins = !!getConfigValue('enableServerPlugins', false, 'boolean'); |
| 11 | const enableServerPluginsAutoUpdate = getConfigValue('enableServerPluginsAutoUpdate', true, 'boolean'); | 11 | const enableServerPluginsAutoUpdate = !!getConfigValue('enableServerPluginsAutoUpdate', true, 'boolean'); |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * Map of loaded plugins. | 14 | * Map of loaded plugins. |