mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-25 01:31:47 +03:00
Merge branch 'develop' into feat/add-typebox-ajv
This commit is contained in:
commit
e50fadd142
@ -13,6 +13,7 @@ import getos from 'getos'
|
||||
|
||||
import { version } from '@@/package.json'
|
||||
import { LogHelper } from '@/helpers/log-helper'
|
||||
import { OSHelper } from '@/helpers/os-helper'
|
||||
import {
|
||||
PYTHON_BRIDGE_BIN_PATH,
|
||||
TCP_SERVER_BIN_PATH,
|
||||
@ -30,6 +31,7 @@ dotenv.config()
|
||||
try {
|
||||
const nodeMinRequiredVersion = '16'
|
||||
const npmMinRequiredVersion = '5'
|
||||
const minimumRequiredRAM = 4
|
||||
const flitePath = 'bin/flite/flite'
|
||||
const coquiLanguageModelPath = 'bin/coqui/huge-vocabulary.scorer'
|
||||
const amazonPath = 'core/config/voice/amazon.json'
|
||||
@ -129,7 +131,7 @@ dotenv.config()
|
||||
* Environment checking
|
||||
*/
|
||||
|
||||
LogHelper.info('OS')
|
||||
LogHelper.info('Environment')
|
||||
|
||||
const osInfo = {
|
||||
type: os.type(),
|
||||
@ -140,6 +142,16 @@ dotenv.config()
|
||||
osName: osName(),
|
||||
distro: null
|
||||
}
|
||||
const totalRAMInGB = OSHelper.getTotalRAM()
|
||||
|
||||
if (totalRAMInGB < minimumRequiredRAM) {
|
||||
report.can_run.v = false
|
||||
LogHelper.error(
|
||||
`Total RAM: ${totalRAMInGB} GB. Leon needs at least ${minimumRequiredRAM} GB of RAM`
|
||||
)
|
||||
} else {
|
||||
LogHelper.success(`Total RAM: ${totalRAMInGB} GB`)
|
||||
}
|
||||
|
||||
if (osInfo.platform === 'linux') {
|
||||
getos((e, os) => {
|
||||
@ -151,6 +163,7 @@ dotenv.config()
|
||||
}
|
||||
|
||||
pastebinData.environment.osDetails = osInfo
|
||||
pastebinData.environment.totalRAMInGB = totalRAMInGB
|
||||
;(
|
||||
await Promise.all([
|
||||
command('node --version', { shell: true }),
|
||||
|
@ -118,4 +118,12 @@ export class OSHelper {
|
||||
public static getNumberOfCPUCores(): number {
|
||||
return os.cpus().length
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total amount of memory (in GB) on your machine
|
||||
* @example getTotalRAM() // 4
|
||||
*/
|
||||
public static getTotalRAM(): number {
|
||||
return Number((os.totalmem() / (1_024 * 1_024 * 1_024)).toFixed(2))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user