1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-18 14:21:32 +03:00

feat(bridge/nodejs): add leon.getVersions

This commit is contained in:
Divlo 2023-05-07 21:38:09 +02:00
parent 2c2f49290a
commit ec819e1765
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
2 changed files with 22 additions and 1 deletions

View File

@ -1,9 +1,15 @@
import type { AnswerData, AnswerInput, AnswerOutput } from '@sdk/types'
import type {
AnswerData,
AnswerInput,
AnswerOutput,
Versions
} from '@sdk/types'
import {
INTENT_OBJECT,
SKILL_CONFIG,
SKILL_SRC_CONFIG
} from '@bridge/constants'
import { VERSION } from '@bridge/version'
class Leon {
private static instance: Leon
@ -107,6 +113,16 @@ class Leon {
console.error('Error while creating answer:', e)
}
}
/**
* Get the versions of the core and the bridge.
*/
public async getVersions(): Promise<Versions> {
return {
core: process.env['npm_package_version'] ?? 'unknown',
'nodejs-bridge': VERSION
}
}
}
export const leon = new Leon()

View File

@ -7,6 +7,11 @@ export type { ActionParams, IntentObject }
export type ActionFunction = (params: ActionParams) => Promise<void>
export interface Versions {
core: string
'nodejs-bridge': string
}
/**
* Answer types
*/