Dialogflow textToSpeech实现未大声朗读文本

时间:2019-04-12 13:11:18

标签: dialogflow actions-on-google dialogflow-fulfillment

我正在为用户提供纯音频设备(例如google home)上的响应,当我在simpleResponse中使用textToSpeech字段进行响应时,不会在模拟器中读出语音。

有人经历过这种情况并且知道如何解决吗?

我尝试了不同的响应类型,但是没有一个读取textToSpeech字段。 还尝试在Dialogflow中勾选/取消勾选结束对话切换,并在使用JSON进行响应时无用的期望用户输入true / false。

该响应当前由一个Webhook来实现,该Webhook使用JSON v2实现blob进行响应,并且模拟器收到的响应没有错误,但并未读出。

响应-

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "Here are the 3 closest restaurants that match your criteria,"
            }
          }
        ]
      }
    }
  }
}

请求-

{
  "responseId": "404f3b65-73a5-47db-9c17-0fc8b31560a5",
  "queryResult": {
    "queryText": "actions_intent_NEW_SURFACE",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "outputContexts": [
      {
        "name": "projects/my-project/agent/sessions/sessionId/contexts/findrestaurantswithcuisineandlocation-followup",
        "lifespanCount": 98,
        "parameters": {
          "location.original": "Shoreditch",
          "cuisine.original": "international",
          "cuisine": "International",
          "location": {
            "subadmin-area": "Shoreditch",
            "subadmin-area.original": "Shoreditch",
            "subadmin-area.object": {}
          }
        }
      },
      {
        "name": "projects/my-project/agent/sessions/sessionId/contexts/actions_capability_account_linking"
      },
      {
        "name": "projects/my-project/agent/sessions/sessionId/contexts/actions_capability_audio_output"
      },
      {
        "name": "projects/my-project/agent/sessions/sessionId/contexts/google_assistant_input_type_voice"
      },
      {
        "name": "projects/my-project/agent/sessions/sessionId/contexts/actions_capability_media_response_audio"
      },
      {
        "name": "projects/my-project/agent/sessions/sessionId/contexts/actions_intent_new_surface",
        "parameters": {
          "text": "no",
          "NEW_SURFACE": {
            "@type": "type.googleapis.com/google.actions.v2.NewSurfaceValue",
            "status": "CANCELLED"
          }
        }
      }
    ],
    "intent": {
      "name": "projects/my-project/agent/intents/0baefc9d-689c-4c33-b2b8-4e130f626de1",
      "displayName": "Send restaurants to mobile"
    },
    "intentDetectionConfidence": 1,
    "languageCode": "en-us"
  },
  "originalDetectIntentRequest": {
    "source": "google",
    "version": "2",
    "payload": {
      "isInSandbox": true,
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.ACCOUNT_LINKING"
          }
        ]
      },
      "requestType": "SIMULATOR",
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "no",
              "inputType": "VOICE"
            }
          ],
          "arguments": [
            {
              "extension": {
                "@type": "type.googleapis.com/google.actions.v2.NewSurfaceValue",
                "status": "CANCELLED"
              },
              "name": "NEW_SURFACE"
            },
            {
              "rawText": "no",
              "textValue": "no",
              "name": "text"
            }
          ],
          "intent": "actions.intent.NEW_SURFACE"
        }
      ],
      "user": {
        "userStorage": "{\"data\":{}}",
        "lastSeen": "2019-04-12T14:31:23Z",
        "locale": "en-US",
        "userId": "userID"
      },
      "conversation": {
        "conversationId": "sessionId",
        "type": "ACTIVE",
        "conversationToken": "[\"defaultwelcomeintent-followup\",\"findrestaurantswithcuisineandlocation-followup\",\"findrestaurantswithcuisineandlocation-followup-2\"]"
      },
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            },
            {
              "name": "actions.capability.WEB_BROWSER"
            }
          ]
        }
      ]
    }
  },
  "session": "projects/my-project/agent/sessions/sessionId"
}

我希望模拟器能读出textToSpeech的结果,但目前不会。

0 个答案:

没有答案