本文整理汇总了Java中com.amazon.speech.speechlet.LaunchRequest类的典型用法代码示例。如果您正苦于以下问题:Java LaunchRequest类的具体用法?Java LaunchRequest怎么用?Java LaunchRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LaunchRequest类属于com.amazon.speech.speechlet包,在下文中一共展示了LaunchRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Test
public void onLaunch() throws Exception {
IntrospectionData data = registry.getDataForPath("/invoked").orElseThrow(RuntimeException::new);
final ArrayListMultimap<String, InvokableMethod> methods = ArrayListMultimap.create();
data.getMethods().forEach(m->methods.put(m.getName(), m));
InvokedTestSkill skill = new InvokedTestSkill();
DynamicSpeechlet speechlet = new DynamicSpeechlet(methods, data, new FormatterMappings(),
registry, skill, new DefaultTypeFactory());
LaunchRequest request = LaunchRequest.builder()
.withRequestId("id")
.withTimestamp(new Date()).build();
SpeechletResponse response = speechlet.onLaunch(request, session);
assertTrue(skill.onLaunch.get());
assertEquals("launch", ((PlainTextOutputSpeech) response.getOutputSpeech()).getText());
}
示例2: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
throws SpeechletException {
log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
session.getSessionId());
return getWelcomeResponse();
}
示例3: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
public SpeechletResponse onLaunch(LaunchRequest request, Session session) throws SpeechletException {
LOGGER.info("onLaunch requestId={}, sessionId={}", request.getRequestId(), session.getSessionId());
RequestHandlerFactory factory = GetRequestHandlerFactory.FUNCTION.apply(LAUNCH_HANDLER);
if (factory != null) {
return factory.create(context).onRequest(request, session);
} else {
throw new SpeechletException("Could not find RequestHandler for: "+LOGGER);
}
}
示例4: getWelcomeResponse
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
/**
* Creates and returns a {@code SpeechletResponse} with a welcome message.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
@OnLaunch
public SpeechletResponse getWelcomeResponse(final LaunchRequest request) {
final OutputSpeech speech = speechService.speechWelcomeMessage(request.getLocale());
return SpeechletResponse.newAskResponse(speech, new Reprompt());
}
示例5: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
throws SpeechletException {
log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
session.getSessionId());
String welcomeStr = "Welcome to Template test skill. Try asking me things.";
PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech();
outputSpeech.setText(welcomeStr);
return SpeechletResponse.newTellResponse(outputSpeech);
}
示例6: constructLaunchInputAndGetMembers
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Test
public void constructLaunchInputAndGetMembers() throws Exception {
final LaunchRequest request = ModelFactory.givenLaunchRequest();
final Session session = ModelFactory.givenSession();
final Context context = ModelFactory.givenAlexaContext();
final AlexaInput input = new AlexaInput(request, session, LOCALE, context);
Assert.assertEquals(request, input.getRequest());
Assert.assertNotNull(input.getSessionStateHandler());
Assert.assertEquals(session, input.getSessionStateHandler().getSession());
}
示例7: testGetIntentName
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Test
public void testGetIntentName() throws Exception {
final IntentRequest request = ModelFactory.givenIntentRequest("intentName");
final Session session = ModelFactory.givenSession();
final Context context = ModelFactory.givenAlexaContext();
final AlexaInput input = new AlexaInput(request, session, LOCALE, context);
Assert.assertEquals("intentName", input.getIntentName());
final LaunchRequest launchRequest = ModelFactory.givenLaunchRequest();
final AlexaInput input2 = new AlexaInput(launchRequest, session, LOCALE, context);
Assert.assertNull(input2.getIntentName());
}
示例8: getSpeechletRequest
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletRequest getSpeechletRequest() {
return LaunchRequest.builder()
.withLocale(session.getClient().getLocale())
.withRequestId(generateRequestId())
.withTimestamp(session.getClient().getCurrentTimestamp())
.build();
}
示例9: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
throws SpeechletException {
provideSessionForRequest(session);
return dispatchIntent("CommonIntentsWelcomeIntent", null, session);
}
示例10: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
throws SpeechletException {
log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
session.getSessionId());
return getWelcomeResponse();
}
示例11: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
throws SpeechletException {
log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
session.getSessionId());
// Here we are setting shouldEndSession to false to not end the session and
// prompt the user for input
return buildSpeechletResponse("Welcome", introSpeechOutput, false);
}
示例12: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
throws SpeechletException {
log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
session.getSessionId());
String speechOutput =
"The house is here to help. What can I help you with?";
// If the user either does not reply to the welcome message or says
// something that is not understood, they will be prompted again with this text.
String repromptText = "For instructions on what you can say, please say help me.";
// Here we are prompting the user for input
return newAskResponse(speechOutput, repromptText);
}
示例13: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(
final LaunchRequest request, final Session session)
throws SpeechletException {
log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
session.getSessionId());
return Response.welcome(session);
}
示例14: onRequest
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onRequest(LaunchRequest request, Session session) throws SpeechletException {
return getWelcomeResponse();
}
示例15: onLaunch
import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session) throws SpeechletException {
logger.info("onLaunch requestId={}, sessionId={}", request.getRequestId(), session.getSessionId());
return getWelcomeResponse();
}