Parcourir la source

[Doc] #203 Global variables

monf il y a 8 ans
Parent
commit
5442882605
2 fichiers modifiés avec 40 ajouts et 0 suppressions
  1. 11 0
      Docs/neurons.md
  2. 29 0
      Docs/settings.md

+ 11 - 0
Docs/neurons.md

@@ -47,6 +47,7 @@ Full list of [available neuron here](neuron_list.md)
 
 Neurons require some **parameters** from the synapse declaration to work. Those parameters, also called arguments, can be passed to the neuron in two way:
 - from the neuron declaration
+- from global variables
 - from the captured order
 
 From the neuron declaration:
@@ -57,6 +58,16 @@ neurons:
         parameter2: "value2"
 ```
 
+From global variables: (cf: [settings.md](settings.md))
+```yml
+  - name: "run-simple-sleep"
+    signals:
+      - order: "Wait for me "
+    neurons:
+      - sleep:
+          seconds: {{variable}}
+```
+
 From the captured order:
 ```yml
   - name: "run-neuron-with-parameter-in-order"

+ 29 - 0
Docs/settings.md

@@ -289,5 +289,34 @@ resource_directory:
   trigger: "/full/path/to/trigger"
 ```
 
+
+## Global Variables
+
+The Global Variables paths list where to load the global variables.
+Those variables can be reused in neuron parameters within double brackets.
+
+E.g
+```yml
+var_files:
+  - variables.yml
+  - variables2.yml
+```
+
+In the files the variables are defined by key/value:
+```yml
+variable: 60
+variable2: "http://"
+```
+
+And use variables in your neurons:
+```yml
+  - name: "run-simple-sleep"
+    signals:
+      - order: "Wait for me "
+    neurons:
+      - sleep:
+          seconds: {{variable}}
+```
+
 ## Next: configure the brain of Kalliope
 Now your settings are ok, you can start creating the [brain](brain.md) of your assistant.