关闭 google 个助理麦克风

Turn off google assistant mic

我正在“Dialog Flow

中实现一个应用程序

我正在像这样向应用程序发送请求

$text = "Something";

$data = array(
         "source" =>  $text,
         "speech" =>  $text,
         "displayText" =>$text,
         "contextOut" => array()
     );
header('Content-Type: application/json');
echo json_encode($data);

应用中显示的文字。但是麦克风打开了我想关掉麦克风。

我尝试了 expectUserResponse 但没有用

array(
         "expectUserResponse" => false,
         "source" =>  $text,
         "speech" =>  $text,
         "displayText" =>$text,
         "contextOut" => array()
     )

请帮忙

expectUserResponse 参数不是 Dialogflow response JSON 的一部分。相反,它是 Actions on Google 响应的特定部分的一部分。如果您使用的是 Dialogflow v1,这将位于 data.google 对象中。如果您使用的是 Dialogflow v2,这将在 payload.google 对象中。

因此,如果您使用的是 Dialogflow v1,您的代码可能如下所示:

array(
  "speech" =>  $text,
  "displayText" =>$text,
  "contextOut" => array(),
  "data" => array(
    "google" => array(
      "expectUserResponse": false
    )
  )
)

而 v2 可能看起来像

array(
  "speech" =>  $text,
  "displayText" =>$text,
  "contextOut" => array(),
  "payload" => array(
    "google" => array(
      "expectUserResponse": false
    )
  )
)