zoukankan      html  css  js  c++  java
  • Syn Bot /OSCOVA Fallback Intents(7)

    顾名思义就是找不到匹配的意图时,就使用它。

    从2.6版本支持全局和上下文相关的fallback

    全局的:

    [FallBack]
    public void GlobalFallback(Context context, Result result)
    {
        result.SendResponse("I am sorry. Could you please rephrase that for me?");
    }
    

     

     

    上下文相关的:

    public class LogoutDialog : Dialog
    {
        [Expression("{log out}")]
        [Expression("{logout}")]
        [Expression("please {log out}")]
        [Entity("logout")]
        public void Logout(Context context, Result result)
        {
            context.Add("in-logout", 1);
            result.SendResponse("Are you sure?");
        }
    
        [Expression("@sys.positive")]
        [Context("in-logout")]
        public void LogoutYes(Context context, Result result)
        {
            context.Remove("in-logout");
            //Do something here.
        }
    
        [Expression("@sys.negative")]
        [Context("in-logout")]
        public void LogoutNo(Context context, Result result)
        {
            context.Remove("in-logout");
            //Do something here.
        }
    
        [FallBack(Context = "in-logout")]
        public void LogoutFallback(Context context, Result result)
        {
            context.Remove("in-logout");
            result.SendResponse("Logout canceled.");
        }
    }
    

     

    如果使用情况与预期不一致,请注意以下配置

    Context handling by fallbacks

    By default on every contextual fallback OSCOVA removes the specified context name from context container. To let the context specified in Fallback stay active for the specified lifespan instead of getting automatically removed you can manually set the value to false in Bot configuration for the RemoveContextOnFallback property.

    OscovaBot.Configuration.RemoveContextOnFallback = false;

     

  • 相关阅读:
    C++学习之【使用位操作符求素数分析】
    LeetCodeOJ刷题之13【Roman to Integer】
    QT学习之文件系统读写类
    让免费版MarkdownPad2使用Pro版本的功能
    QT学习之窗口右键菜单
    react 16.3+ 新生命周期 作业
    react 16.3+ 新生命周期
    node层设置proxy不生效的原因
    Javascript权威指南——读书笔记
    react踩坑
  • 原文地址:https://www.cnblogs.com/mrtiny/p/9081964.html
Copyright © 2011-2022 走看看