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

AMAZON.TIME槽位相对时间确认显示友好文本的实现方案问询

Absolutely, you can fix this issue and keep support for both relative and absolute times with a couple of straightforward approaches. Let’s break down how to make Alexa use friendly, natural language for confirmations instead of those cryptic codes:

Fixing Alexa TIME Slot Confirmation Text

1. Use Custom Slot Values & Synonyms (Easiest Fix)

This is the most streamlined way to handle relative time phrases. You can extend the AMAZON.TIME slot to map its internal codes to human-friendly terms:

  • Head to your Alexa Skill Developer Console, open the Interaction Model tab, and find your desiredTime slot (type AMAZON.TIME).
  • Add custom slot values with synonyms that cover both user phrases and Alexa's internal codes:
    • Value: morning, Synonyms: MO, early morning, first thing in the morning
    • Value: afternoon, Synonyms: AF, late afternoon, mid-afternoon
    • Value: evening, Synonyms: EV, late evening, night
  • Now when a user says "afternoon", Alexa will recognize the custom value and use "afternoon" in its confirmation prompt instead of "AF".

2. Manual Code Mapping in Your Skill Backend

If you need more control, you can add a simple mapping layer in your skill's code to convert Alexa's time codes to friendly text:

  • First, grab the raw user input and Alexa's resolved slot value:
    const desiredTimeSlot = handlerInput.requestEnvelope.request.intent.slots.desiredTime;
    const userInput = desiredTimeSlot.value; // The exact phrase the user said
    const resolvedCode = desiredTimeSlot.resolutions?.resolutionsPerAuthority[0]?.values[0]?.value.name; // e.g., "AF"
    
  • Create a mapping object for common time codes:
    const timeCodeMap = {
      'MO': 'morning',
      'AF': 'afternoon',
      'EV': 'evening',
      'NI': 'night'
    };
    
  • Use this map to generate your confirmation speech:
    const friendlyTime = timeCodeMap[resolvedCode] || userInput;
    const confirmationPrompt = `Have I understood ${friendlyTime} correctly?`;
    
  • This method works seamlessly for absolute times too—if a user says "3 PM", userInput will already be a friendly string, so it gets used directly.

3. Dynamic Confirmation Prompts

You can also set up dynamic confirmation for the desiredTime slot in the Alexa Console:

  • In the slot's settings, switch confirmation from "Static" to "Dynamic".
  • Then use the code mapping logic above to return a tailored confirmation message based on the resolved slot value.

Quick Notes

  • Alexa’s AMAZON.TIME uses standard codes like MO, AF, EV, NI for relative times—make sure your mapping covers these.
  • Absolute times (e.g., "October 5th at 2 PM") are returned as human-readable strings by default, so no extra work is needed for those.

With any of these approaches, Alexa will confirm relative times using natural language while still accepting absolute time inputs perfectly.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 07:27:37