首页 > 解决方案 > IBM Watson Assistant:如何解决 web_action 错误“内部错误:无法检索内容类型。”

问题描述

我正在尝试将 IBM Cloud Functions 与 Watson Assistant 对话框连接为 web_action。所以我在 watson 对话框 json 编辑器中指定了 web_action 如下。

"actions": [
    {
      "name": "rajesh@heltha.co_dev/default/callKinvey",
      "type": "web_action",
      "parameters": {
      },
      "credentials": "$private.mycredential",
      "result_variable": "context.my_input_returned"
    }
  ]

现在,问题是在测试助手时出现以下错误

内部错误:无法检索内容类型。(并且日志中还有 1 个错误)

在此处输入图像描述

以下是我在 IBM-cloud 上创建并为Web Action启用的函数:

/**
  *
  * main() will be run when you invoke this action
  *
  * @param Cloud Functions actions accept a single parameter, which must be a JSON object.
  *
  * @return The output of this action, which must be a JSON object.
  *
  */
function main(params) {
    return { message: 'Hello World' };
}

我的函数的 CURL 是:

curl -u API-KEY -X POST https://us-south.functions.cloud.ibm.com/api/v1/namespaces/rajesh@heltha.co_dev/actions/callKinvey?blocking=true

标签: ibm-cloudibm-watsonwatson-assistantibm-cloud-functions

解决方案


解决此类错误的最简单方法是附加.json到您的端点。


推荐阅读