You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Dialog Flow应用请求后Google Assistant麦克风未关闭,如何解决?

解决Google Assistant麦克风持续开启的问题

嘿,我懂你现在的困扰——Dialogflow对接Google Assistant后,文本能正常显示,但麦克风一直处于开启状态,哪怕试了expectUserResponse参数也没效果对吧?

问题出在你的响应格式上。Google Assistant需要遵循Actions on Google的特定响应结构,而不是只使用Dialogflow的基础字段。你之前把expectUserResponse放在了错误的层级,所以助手根本没读取到这个配置。

试试把你的代码改成这样:

$text = "Something";
$data = array(
  "source" => $text,
  "speech" => $text,
  "displayText" => $text,
  "contextOut" => array(),
  // 关键:添加Actions on Google专属的payload配置
  "payload" => array(
    "google" => array(
      "expectUserResponse" => false,
      "richResponse" => array(
        "items" => array(
          array(
            "simpleResponse" => array(
              "textToSpeech" => $text,
              "displayText" => $text
            )
          )
        )
      )
    )
  )
);
header('Content-Type: application/json');
echo json_encode($data);

核心原因是:expectUserResponse必须嵌套在payload.google这个层级下,Google Assistant才会识别这个参数。设置为false后,助手就知道不需要等待用户输入,会自动关闭麦克风。

另外,richResponse里的simpleResponse是为了确保语音和文本都能正常展示,和你原来的speech、displayText功能对应,但符合Actions on Google的规范。

内容的提问来源于stack exchange,提问作者Gowri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:38:50