Skip to content

Adding global predefined custom sentences and answers

Florian Quirin edited this page Feb 18, 2020 · 4 revisions

Adding predefined sentences and answers via server files

In the previous section you've learned a bit about the Teach-UI and SDK and how to use them to add custom commands and services to SEPIA. If you use the 'assistant' user-account (default ID: uid1005) to upload SDK services or commands they will even be available to all your users which makes it possible to manage a custom set of global voice actions.
Maybe you've also noticed that custom answers can be given as 'reply' parameter in any command defined via the Teach-UI or inside services as demonstrated in several SDK examples. There is even a 3rd way using the SEPIA Control-HUB that works if you switch the answer-module from 'file' to 'elasticsearch'.
This section is about an additional way of creating custom commands and answers. If you check the folder sepia-assist-server\Xtensions\Assistant in your SEPIA-Home base folder you will see the folders 'answers' and 'commands'. These folders contain several text files that are loaded during server start-up. Let's take a closer look at both folders.

Answers

Quick start:

  • Add your own answers by creating files called 'answers_[code]_custom.txt'

Files in the 'answers' folder are typically called answers_de.txt or answers_en.txt where 'de' and 'en' are ISO-639-1 language codes. This means each supported language in SEPIA has its own file with predefined answers that can be used in services. Here are a few simple answer examples:

chat_hello_0a;; rep=0|mood=5;; Hello <user_name> ;;char=neutral
chat_hello_0a;; rep=1|mood=8;; Hello again! ;;char=neutral,polite
chat_hello_0a;; rep=2|mood=2;; Whatttt??? ;;char=rude
smart_home_0a;; rep=0|mood=5;; Switching on <1> in room <2> ;;char=rude

A rough explanation:

  • The fist part 'chat_hello_0a' is the answer tag that can be used inside a custom command or SEPIA service. You are free to choose any name. Answers with the same tag will be chosen randomly.
  • 2nd part is the repetition index (rep=1 means use this when the previous answer was from the same tag) and the mood index (mood=5 means neutral, 1 is worst and 10 is best).
  • 3rd part is the actual answer. The answer can contain certain 'variables' given in brackets and parameters like <1>, <2>, ... that can be defined by a service.
  • Finally there is a 'character' type given for each answer, simply to classify it for possible upcoming features.

Add your own answer file

You can edit the given files as needed, but if you update SEPIA you will need to restore your changes manually. The better way to add your own answers is to create a new file called answers_en_custom.txt (simply add '_custom' before the '.txt') and add them in the same format as seen above.

Predefined sentences for custom commands

Quick start:

  • Add your own sentences and commands by creating files called 'chats_[code]custom.txt' or 'teachIt[code]_custom.txt'

Files in the 'commands' folder are typically called chats_en.txt or teachIt_en.txt (en=English) and serve two slightly different purposes.