System projects
System projects are projects enabled across the whole JAICP. Modules from system projects can be imported as dependencies into all bots without prior declaration.
Common system projects
The cloud version of JAICP provides the zb-common
system project.
It contains a number of universal and frequently used script elements:
- Named patterns.
- Named entity dictionaries and converters.
- JavaScript functions and libraries.
- Ready-made script fragments.
How to use
To import a file from a system project 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 project.offtopic/fallback.sc
is the path to the imported file.
sys.
.Custom system projects
On-premise
If JAICP is installed in your own infrastructure, your employees can create system projects that will be available to all users of your installation.
There are two ways to add system projects:
- Add the repository settings to the configuration of the EditorBE component.
- Connect the projects from the host where the BotServer component is installed.
Projects from remote repositories
-
Developers create a remote repository with a JAICP project that is going to be imported into other projects as a system project.
-
System administrators should add the repository settings to the overriding configuration of the EditorBE component, then restart the component:
configs/hosts/{env_name}/editorbe/application-override.ymlsystem-projects:
projects:
# Default system projects…
- url: https://gitlab.custom.com/custom-tags # Repository URL.
project-id: custom-tags # Project ID.
branch: main # Branch in the project repository, master by default.
module: true # This flag indicates that this is a system project. -
Users of your JAICP installation will be able to import files from the system project using
require
. The system project name corresponds to theproject-id
parameter value:require: patterns.sc
module = sys.custom-module
Projects from a local directory
-
System administrators should add the directory path where system projects will be stored to the overriding configuration of the BotServer component:
configs/hosts/{env_name}/botserver/application-override.ymlbot:
systemModulesFolder: /opt/sys-modules -
Projects that will be imported to other projects as system projects should be placed in this directory:
└── opt
└── sys-modules
├── custom-module
│ └── src
│ └── patterns.sc
└── js-packages
└── src
├── moment.min.js
└── underscore.min.js -
Users of your JAICP installation will be able to import files from the system project using
require
. The system project name corresponds to the name of the subdirectory insidebot.systemModulesFolder
:require: patterns.sc
module = sys.custom-module