【问题标题】:how to make 'i dont understant' story in wit.ai如何在 wit.ai 中制作“我不明白”的故事
【发布时间】:2017-01-08 07:49:40
【问题描述】:

我的故事很少,但如果我尝试输入 blah 之类的内容,wit.ai 使用 hello 故事。

但我需要类似*wildcard 的故事并回复I don't understantwitbotintents 很容易,但我不知道如何制作 node-witstories

【问题讨论】:

    标签: wit.ai


    【解决方案1】:

    如果下一步的置信度低于我设置的预定义阈值,我决定调整 wit.js 代码以调用特殊的 lowConfidence 方法。

    在我的智慧行动文件中:

    // Setting up our wit client
    const witClient = new Wit({
      accessToken: WIT_TOKEN,
      actions: witActions,
      lowConfidenceThreshold: LOW_CONFIDENCE_THRESHOLD,
      logger: new log.Logger(log.DEBUG)
    });
    

    以后

    lowConfidence({context}) {
          console.log("lowConfidenceConversationResponse");
          return new Promise(function(resolve) {
              context.lowConfidence=true;
              context.done=true;
              // now create a low_confidence story in wit.ai
              // and have the bot response triggered always
              // when context.lowConfidence is set 
              return resolve(context);
          });
      }
    

    在 wit.js 中

     else if (json.type === 'action') {
            let action = json.action;
            // json.confidence is confidence of next step and NOT
            // wit.ai intent identification confidence
            const confidence = json.entities && json.entities.intent &&
                        Array.isArray(json.entities.intent) &&
                        json.entities.intent.length > 0 &&
                        json.entities.intent[0].confidence;
    
            if ( confidence && confidence<lowConfidenceThreshold)
              action = 'lowConfidence'  ;
    

    【讨论】:

    • 正是我想要的。 :)
    猜你喜欢
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多