用户注意力流 (attention.co)#
用于处理用户注意力的流。
- tracking user attention
为了自动处理用户注意力事件,您需要激活此流来跟踪用户在上次用户话语期间的注意力水平。此信息将用于更改所有
user said
流的功能,以便在用户注意力不集中时说话时,这些流将不再完成。示例
import core import attention flow main # Activate the flow at the beginning to make sure user attention events are tracked properly activate tracking user attention ...
- user said (overwritten)
当您在您的机器人文件夹中包含
attention.co
时,它会覆盖所有user said
相关流,以便这些流仅在用户注意力集中时才考虑用户话语。您可以通过覆盖下面解释的attention checks
流来覆盖默认的注意力检查。对于您的首次测试,默认实现应该可以与 Tokkio 设置良好配合。示例
import core import attention flow main activate tracking user attention # Since the attention module overwrites all user said related flows, this line will wait until the user says # something while being attentive. user said something bot say "I heard you and you are attentive"
- attention checks $event -> $is_attentive
attention checks
流在系统需要决定用户话语是否在用户注意力集中时完成时被调用。您可以通过在您的机器人脚本中覆盖此流来覆盖默认行为。示例
import core import attention @override flow attention checks $event -> $is_attentive # Implement your custom attention logic here $is_attentive = True return $is_attentive
- user said something inattentively
用户在注意力不集中时说了一些话。使用此流来告知用户,机器人假定用户注意力不集中,并且该话语将被忽略。
示例
import core import attention import avatar # Only needed for the optional bot gesture we use below flow main activate tracking user attention when user said something bot say "I hear you" or when user said something inattentively bot say "You seem distracted. Can you repeat?" and bot gesture "asking if something refers to them, being unsure if they're being addressed"