💾 Archived View for gmi.bacardi55.io › blog › 2017 › 01 › 04 › available-commands-on-kalliope-neuron captured on 2023-07-22 at 16:47:36. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Posted on 2017-01-04
And we keep going with the blog post series about Kalliope[1] :)
1: https://github.com/kalliope-project/kalliope
Let's introduce here a simple neuron I developed that let you know what you can ask.
I know it might sound dumb, but it can be handy when other people leaving with you don't know as much as you your kalliope setup :) (Or as well, to make Kalliope answer when friends ask why i use it, I can make kalliope answers with the list of available orders).
This is why I developed the small neuron list_available_orders[2].
2: https://github.com/bacardi55/kalliope-list-available-orders
As per the previous neuron, kalliope let you install via the command line the neuron:
kalliope install --git-url https://github.com/bacardi55/kalliope-list-available-orders.git
No additional library are required for this neuron.
Create you brain file, eg:
--- - name: "All-orders" signals: - order: "what can I ask" neurons: - list_available_orders: query_replace_text: "and the argument" ignore_machine_name: 1 file_template: "templates/en_all_available_orders.j2"
The query_replace_text option is the text you want instead of "{{ query }}" (or any arguments). I put this option because otherwise Kalliope says open/close bracket which is a bit weird :)
You can use 2 variables in the template, nb_orders for the number of available orders and orders, a list of order. More description about the order here[3].
3: https://github.com/bacardi55/kalliope-list-available-orders#return-values
This template will simply make Kalliope speak out loud the number of orders and then all of them If no order are found, a simple "order not found" sentence will be said by Kalliope.
{% raw %} {% if nb_orders > 0 %} You have {{ nb_orders }} available orders: {% for order in orders %} {{ order }} {% endfor %} {% else %} No order found. {% endif %} {% endraw %}