首页 > 解决方案 > Bixby 函数中收到未定义的参数

问题描述

我正在尝试处理格式为“从弹劾圣人获取新闻”的话语,其中弹劾圣人对应于出版物名称的枚举。Bixby 成功地理解了话语并试图调用我的目标 (GetNewsByName),但经过训练的值没有到达函数。(这是基于用户持久性数据示例)。

在此处输入图像描述

因此,函数的操作部分是:

function getNewsByName(altBrainsNames) {
  // const name = "Impeachment Sage" //hard coded for testing

  const url = properties.get("config", "baseUrl") + "altbrains"
  console.log("i got to restdb.js and the url is ", url);
  console.log("AltBrainsNames is", altBrainsNames)
  const query = {
    apikey: properties.get("secret", "apiKey"),
     q: "{\"" + "name" + "\":\"" + name + "\"}"
    // q: "{}"
  }
  console.log("query", query)
  const options = {
    format: "json",
    query: query,
    cacheTime: 0
  }
  const response = http.getUrl(url, options) 
  if (response) {
    const content1 = response
    // const altBrainsData = response[0][properties.get("config", "altbrainsName")]
    // altbrainsData.$id = response[0]["_id"]
    console.log('content1', content1);
    console.log('identifier', content1)
    return content1
  } else {
    // Doesn't exist
    console.log('doesnae exist');
    return
  }
}

值没有达到函数的地方发生了什么?

动作模型是:

action (GetNewsByName) {
  description ("Get news  data from remote Content db by searching on AltBrain name")
  type (Calculation)
  output (Content)
  collect {
   input (altBrainsNames) {
      type (AltBrainsNames)
      min (Required) max (One) //this means js must catch error when multiple names offered

    }
}
}

标签: bixby

解决方案


我们离线解决了这个问题,只是想在公共频道上跟进看到这个问题的任何 Bixby 开发人员。调用“getNewsByName”的函数需要接收输入参数。填充后,操作成功。 在此处输入图像描述

在此处输入图像描述


推荐阅读