从语音交互式画布中补足文字?

问题描述 投票:0回答:1

我正在使用Interactive Canvas设计Web屏幕。我想从用户在输入框中说出的语音中捕获文本。它类似于functions / index.js中的conv.input.raw,但我不知道在public / index.html中该做什么。enter image description here

javascript dialogflow actions-on-google
1个回答
1
投票

一旦函数/ index.js中的conv.input.raw中包含文本,您需要使用interactiveCanvas api将其传递到网站。

conv.ask(new HtmlResponse({
  data: {
    userEnteredData: conv.input.raw
  }
}));

并且从网站上,您将在交互式画布的回调中获得它

interactiveCanvas.ready({
   onUpdate(data) {
       console.log('user entered text = ', data.userEnteredData);
       document.getElementById("textBox").value = data.userEnteredData;
   }
});
© www.soinside.com 2019 - 2024. All rights reserved.