System modules
System modules are modules enabled across JAICP as a whole. System modules can be imported as dependencies into all bots without any extra setup.
Available system modules
The cloud version of JAICP provides the zb-common
and zfl-common
system modules.
They contain a number of universal and frequently used script elements:
- Named patterns.
- Named entity dictionaries and converters.
- JavaScript functions and libraries.
- Ready-made script fragments.
You can view the contents of all system modules in the script editor.
How to use
To import a file from a system module to the script, use the require
tag in one of the script files:
require: offtopic/fallback.sc
module = sys.zb-common
Here,
zb-common
is the name of the system module.offtopic/fallback.sc
is the path to the imported file.
The system module name should be prepended with sys
, separated by a period.
Custom system modules On-premise
On JAICP On-premise you can create system modules of your own.
- Set up the absolute path to their parent directory in your BotServer configuration:
bot:
systemModulesFolder: /opt/sys-modules
- Populate this directory with projects that will be imported to other projects as system modules:
├── common
│ └── src
│ ├── catchAll
│ │ ├── catchAllClassifier.js
│ │ └── catchAll.sc
│ └── offtopic
│ ├── fallback.sc
│ ├── greetings.sc
│ └── offtopic.sc
└── javascript
└── src
├── moment.min.js
└── underscore.min.js
How to use
Files from custom system modules can be imported to the necessary scripts in the same way as on the JAICP cloud version:
require: moment.min.js
module = sys.javascript
The system module name is the same as the directory name, and file paths are relative to the src
subdirectory.