Alexa 询问响应 onLaunch:语音和报告的预期行为是什么?
Alexa ask response onLaunch: What is the expected behavior for the speech and repromt?
在使用回声测试我的技能时,我遇到了以下行为:
当由非意图请求和此响应调用时:
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 只输出提示文本。
实际互动为:
- 用户:alexa 问 "Skill"
- Alexa:重新提示 "waiting for answer"
我的 expected/wanted 互动是:
- 用户:alexa 问 "Skill"
- Alexa:欢迎"waiting for answer"
- 用户:"doesn't respond correctly"
- Alexa:重新提示 "waiting for answer"
如何获得预期的行为?如果响应中没有(从不?)包含什么语音文本?
我认为您的代码有误。您正在设置 speech.setText 两次。我想你是想第二次设置 repromptSpeech.setText。
在使用回声测试我的技能时,我遇到了以下行为:
当由非意图请求和此响应调用时:
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 只输出提示文本。
实际互动为:
- 用户:alexa 问 "Skill"
- Alexa:重新提示 "waiting for answer"
我的 expected/wanted 互动是:
- 用户:alexa 问 "Skill"
- Alexa:欢迎"waiting for answer"
- 用户:"doesn't respond correctly"
- Alexa:重新提示 "waiting for answer"
如何获得预期的行为?如果响应中没有(从不?)包含什么语音文本?
我认为您的代码有误。您正在设置 speech.setText 两次。我想你是想第二次设置 repromptSpeech.setText。