ck-dialogflow
v0.1.0
Published
SOVA dialog module
Downloads
31
Readme
ck-dialogflow is separate module that connects to the widget. It is used to describe scripts and dialog rules.
Install
For install ck-dialogflow
enter next command:
npm i ck-dialogflow
Quick start
For quick start ck-dialogflow
enter next command:
import ckModuleInit from 'ck-dialogflow'
const DialogflowModule = ckDialogflowInit(dialogflowConfig)
Description
Dialogflow config
Configuration file includes:
const rasaConfig = {
info: {
projectId: string
sessionId: string
}
api?: {
infApiUrl: string,
},
events?: {
ready?: string,
},
moduleEvents?: ModuleEvents
uiEvents?: UiEventsList
}
moduleEvents?: {
chatInit: (module: DialogflowModule, data: ChatInitData) => void
chatRequest: (module: DialogflowModule, data: ChatRequestData) => void
chatEvent: (module: DialogflowModule, data: ChatEventData) => void
setInfo: (module: DialogflowModule, data: SetInfoData) => void
reset: (module: DialogflowModule, data: ResetData) => 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-dialogflow
has next API methods:
| API method | | |-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| | chatInit | Dialog Initialization | | chatRequest | Sending user messages | | chatEvent | Chat events | | setInfo | Settings information | | reset | Reset dialogue |
Dialogflow.ModuleDispatcher
moduleDispatcher
- method of event management.moduleDispatcher
select method and transmits necessary data to it.
For example:
import moduleInit from 'ck-dialogflow'
const ckDialogflow = moduleInit(dlConfig)
ckDialogflow.moduleDispatcher('chatInit', { clientConfig: { siteLang: 'ru' } })