在用回声测试我的技能时,我遇到了以下行为:
当由非意向请求和此响应调用时:
public SpeechletResponse onLaunch(LaunchRequest request, Session session) throws SpeechletException {
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("Welcome");
PlainTextOutputSpeech repromtSpeech = new PlainTextOutputSpeech();
speech.setText("Repromt");
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(repromtSpeech);
SimpleCard card = new SimpleCard();
card.setTitle("Welcome");
card.setContent("Test");
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Alexa 只输出 repromt 文本。
实际交互是:
- 用户:亚历克萨问"技能">
- 亚历克萨:重新"等待答案">
我期望/想要的交互将是:
- 用户:亚历克萨问"技能">
- Alexa:欢迎"等待答案">
- 用户:"未正确响应">
- 亚历克萨:重新"等待答案">
如何获得预期的行为?如果语音文本未(从不?(包含在响应中,则它有什么用?
我认为你的代码有错误。您正在设置 speech.setText 两次。我想你的意思是第二次设置repromptSpeech.setText。