Skip to main content

System projects

System projects are projects enabled across the whole Tovie Platform. Modules from system projects can be imported as dependencies into all bots without prior declaration.

Common system projects

The cloud version of Tovie Platform 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.
tip
You can view the contents of all system projects in the script editor. Their code is read-only.

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.
tip
The system project name should be prepended with sys..

Custom system projects

On-premise

If Tovie Platform 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.
tip
The recommended way is to connect repository projects to EditorBE. If a project with the same name is connected both ways, the one connected via a repository will be used.

Projects from remote repositories

  1. Developers create a remote repository with a Tovie Platform project that is going to be imported into other projects as a system project.

  2. 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.yml
    system-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.
  3. Users of your Tovie Platform installation will be able to import files from the system project using require. The system project name corresponds to the project-id parameter value:

    require: patterns.sc
    module = sys.custom-module

Projects from a local directory

  1. 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.yml
    bot:
    systemModulesFolder: /opt/sys-modules
  2. 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
  3. Users of your Tovie Platform installation will be able to import files from the system project using require. The system project name corresponds to the name of the subdirectory inside bot.systemModulesFolder:

    require: patterns.sc
    module = sys.custom-module