1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-21 07:41:39 +03:00
leon/scripts/setup/setup.js
2022-09-26 21:29:56 +08:00

39 lines
1.1 KiB
JavaScript

import { LoaderHelper } from '@/helpers/loader-helper'
import { LogHelper } from '@/helpers/log-helper'
import train from '../train/train'
import generateHttpApiKey from '../generate/generate-http-api-key'
import setupDotenv from './setup-dotenv'
import setupCore from './setup-core'
import setupSkillsConfig from './setup-skills-config'
import setupPythonPackages from './setup-python-packages'
// Do not load ".env" file because it is not created yet
/**
* Main entry to set up Leon
*/
;(async () => {
try {
// Required env vars to setup
process.env.PIPENV_PIPFILE = 'bridges/python/Pipfile'
process.env.PIPENV_VENV_IN_PROJECT = 'true'
await setupDotenv()
LoaderHelper.start()
await Promise.all([setupCore(), setupSkillsConfig()])
await setupPythonPackages()
LoaderHelper.stop()
await generateHttpApiKey()
LoaderHelper.start()
await train()
LogHelper.default('')
LogHelper.success('Hooray! Leon is installed and ready to go!')
LoaderHelper.stop()
} catch (e) {
LogHelper.error(e)
LoaderHelper.stop()
}
})()