ck-rasa
v0.1.0
Published
SOVA dialog module opensoucre lib
Downloads
2
Readme
ck-rasa is separate module that connects to the widget. It is used to describe scripts and dialog rules.
Install
For install ck-rasa
enter next command:
npm i ck-rasa
Quick start
For quick start ck-rasa
enter next command:
import ckModuleInit from 'ck-rasa'
const rasaModule = ckRasaInit(rasaConfig)
Description
Rasa config
Configuration file includes:
const rasaConfig = {
info: {
greetingPhrase: string,
},
api?: {
rasaURL?: string,
},
moduleEvents?: {
chatInit: (module: RasaModule, data: ChatInitData) => void,
chatRequest: (module: RasaModule, data: ChatRequestData) => void,
reset: (module: RasaModule, data: ChatInitData) => void,
},
uiEvents?: {
sendMessage?: (data: SendMessageData) => void,
uiManagment?: (uiManagmentEvent: UIManagmentEvents, data: UIManagmentData) => void,
notifications?: (notificationsEvent: NotificationsEvents, data: NotificationsData) => void,
modules?: (modulesEvent: ModulesEvents , data: ModulesData)=> void,
}
}
API methods
ck-rasa
has next API methods:
| API method | | |-----------------------------------------------------------------------------------------------------------------------------------|----------------------------------| | chatInit | Dialog Initialization | | chatRequest | Sending user messages | | reset | Reset dialogue |
Rasa.ModuleDispatcher
moduleDispatcher
- method of event management.moduleDispatcher
select method and transmits necessary data to it.
For example:
import moduleInit from 'ck-rasa'
const ckRasa = moduleInit(dlConfig)
ckRasa.moduleDispatcher('chatInit', { clientConfig: { siteLang: 'ru' } })