mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-28 04:04:58 +03:00
feat(scripts): add Node.js bridge on check script
This commit is contained in:
parent
3f556494c2
commit
8147d8423b
12
scripts/assets/nodejs-bridge-intent-object.json
Normal file
12
scripts/assets/nodejs-bridge-intent-object.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"lang": "en",
|
||||
"domain": "leon",
|
||||
"skill": "age",
|
||||
"action": "run",
|
||||
"utterance": "How old are you?",
|
||||
"slots": {},
|
||||
"entities": [],
|
||||
"current_entities": [],
|
||||
"resolvers": [],
|
||||
"current_resolvers": []
|
||||
}
|
@ -16,9 +16,11 @@ import { SystemHelper } from '@/helpers/system-helper'
|
||||
import {
|
||||
MINIMUM_REQUIRED_RAM,
|
||||
LEON_VERSION,
|
||||
NODEJS_BRIDGE_BIN_PATH,
|
||||
PYTHON_BRIDGE_BIN_PATH,
|
||||
TCP_SERVER_BIN_PATH,
|
||||
TCP_SERVER_VERSION,
|
||||
NODEJS_BRIDGE_VERSION,
|
||||
PYTHON_BRIDGE_VERSION,
|
||||
INSTANCE_ID
|
||||
} from '@/constants'
|
||||
@ -102,6 +104,13 @@ dotenv.config()
|
||||
skillsResolversModelState: null,
|
||||
mainModelState: null
|
||||
},
|
||||
nodeJSBridge: {
|
||||
version: null,
|
||||
executionTime: null,
|
||||
command: null,
|
||||
output: null,
|
||||
error: null
|
||||
},
|
||||
pythonBridge: {
|
||||
version: null,
|
||||
executionTime: null,
|
||||
@ -209,7 +218,41 @@ dotenv.config()
|
||||
})
|
||||
|
||||
/**
|
||||
* Skill execution checking
|
||||
* Skill execution checking with Node.js bridge
|
||||
*/
|
||||
|
||||
LogHelper.success(`Node.js bridge version: ${NODEJS_BRIDGE_VERSION}`)
|
||||
reportDataInput.nodeJSBridge.version = NODEJS_BRIDGE_VERSION
|
||||
LogHelper.info('Executing a skill...')
|
||||
|
||||
try {
|
||||
const executionStart = Date.now()
|
||||
const p = await command(
|
||||
`${NODEJS_BRIDGE_BIN_PATH} "${path.join(
|
||||
process.cwd(),
|
||||
'scripts',
|
||||
'assets',
|
||||
'nodejs-bridge-intent-object.json'
|
||||
)}"`,
|
||||
{ shell: true }
|
||||
)
|
||||
const executionEnd = Date.now()
|
||||
const executionTime = executionEnd - executionStart
|
||||
LogHelper.info(p.command)
|
||||
reportDataInput.nodeJSBridge.command = p.command
|
||||
LogHelper.success(p.stdout)
|
||||
reportDataInput.nodeJSBridge.output = p.stdout
|
||||
LogHelper.info(`Skill execution time: ${executionTime}ms\n`)
|
||||
reportDataInput.nodeJSBridge.executionTime = `${executionTime}ms`
|
||||
} catch (e) {
|
||||
LogHelper.info(e.command)
|
||||
report.can_run_skill.v = false
|
||||
LogHelper.error(`${e}\n`)
|
||||
reportDataInput.nodeJSBridge.error = JSON.stringify(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* Skill execution checking with Python bridge
|
||||
*/
|
||||
|
||||
LogHelper.success(`Python bridge version: ${PYTHON_BRIDGE_VERSION}`)
|
||||
@ -223,7 +266,7 @@ dotenv.config()
|
||||
process.cwd(),
|
||||
'scripts',
|
||||
'assets',
|
||||
'intent-object.json'
|
||||
'python-bridge-intent-object.json'
|
||||
)}"`,
|
||||
{ shell: true }
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user