我是新來的alexa。我學會了並開始構建天氣應用程序。在亞馬遜給出一個字符串插槽alexa
現在我能得到的氣象資料,但在以下條件下,
我craeated定製插槽(LIST_OF_CITIES)以如下舉行城市。
{
"intents": [
{
"intent": "WeatherIntent",
"slots": [
{
"name": "city",
"type": "LIST_OF_CITIES"
}
]
},
{
"intent": "AMAZON.HelpIntent"
},
]
}
並在我給出的自定義插槽中,如下所示。
Type Values
LIST_OF_CITIES Hyderabad | pune | london
以下是我的話語
WeatherIntent give me {city} climate
WeatherIntent {city}
WeatherIntent what's the climate in {city}
WeatherIntent what's the weather in {city}
WeatherIntent {city}
當我運行使用任何在上表中提到的三個城市,我的計劃,我能夠得到正確的。如果我使用除上述之外的任何內容,它將返回值爲-4。
如果我想獲得某個其他城市的特權,我需要在該列表中添加該城市。
請讓我知道我如何動態獲取vaues,我的意思是取決於LIST_OF_CITIES,如果輸入城市名稱,它應該返回結果。
此外,我嘗試添加類型爲LITERAL和AMAZON.LITERAL。當我救了它,我得到的異常,因爲
Error: There was a problem with your request: Unknown slot name '{city}'. Occurred in sample 'WeatherIntent get me weather of {city}' on line 1.
Please let me know where am I going wrong and how can I fix this.
感謝