第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在生成引出槽響應(yīng)時(shí)遇到問(wèn)題

在生成引出槽響應(yīng)時(shí)遇到問(wèn)題

慕碼人8056858 2022-01-05 11:28:27
我想為某個(gè)插槽創(chuàng)建一個(gè) dialogHook,而不是說(shuō)驗(yàn)證類型的事情。如果插槽返回 true,那么只有我會(huì)觸發(fā)我的誘導(dǎo)插槽,否則它會(huì)照常進(jìn)行。請(qǐng)幫助我的方法是什么。我是對(duì) lex 來(lái)說(shuō)相對(duì)較新。我試圖在 childExists 上創(chuàng)建一個(gè)對(duì)話鉤子,但它不起作用。def lambda_handler(event,context):    os.environ['TZ']='America/New_York'    time.tzset();    logger.debug('event.bot.name={}'.format(event['bot']['name']))    return dispatch(event);def dispatch(intent_request):    intent_name=intent_request['currentIntent']['name']    if intent_name=='HotelReservation':        return book_hotel(intent_request)def book_hotel(intent_request):    slots=intent_request['currentIntent']['slots']    welcome=intent_request['currentIntent']['slots']['welcome']    location=intent_request['currentIntent']['slots']['Location']    fromDate=intent_request['currentIntent']['slots']['FromDate']    adultCount=intent_request['currentIntent']['slots']['adultCount']    nights=intent_request['currentIntent']['slots']['nights']    childExists=intent_request['currentIntent']['slots']['childExists']    source=intent_request['invocationSource']    session_attributes={}    if source=='DialogCodeHook'and childExists.lower()=='yes':        session_attributes={}        return elicit_slot (        session_attributes,            'HotelReservation',            'childCount',             'AMAZON.NUMBER',                        {            'contentType':'PlainText',            'content':'Please enter number of Children'            }        )    elif source=='DialogCodeHook':        output_session_attributes = intent_request['sessionAttributes'] if intent_request['sessionAttributes'] is not None else {}        return delegate(output_session_attributes, intent_request['currentIntent']['slots'])    else:        return close (            session_attributes,                'Fulfilled',{                'contentType':'PlainText',                'content':'Here is the temparature in'                }            )實(shí)際上我的插槽應(yīng)該像往常一樣運(yùn)行,但是在 childExists 插槽之后我想發(fā)送一個(gè) elicit 響應(yīng) 這是可用插槽的圖像
查看完整描述

1 回答

?
慕哥9229398

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超6個(gè)贊

根據(jù)我的理解,您正在詢問(wèn)用戶Do you have any children并將響應(yīng)存儲(chǔ)在childExists插槽中,如果答案是肯定的,那么您想詢問(wèn)孩子的數(shù)量。


所以根據(jù)我的說(shuō)法,你需要有一個(gè)額外的插槽childCount來(lái)存儲(chǔ)孩子的數(shù)量。由于此插槽并非總是必需的,因此請(qǐng)勿在 amazon lex 控制臺(tái)中將其標(biāo)記為必需。


現(xiàn)在,您將在您的 中檢查這一點(diǎn)DialogCodeHook,并僅childExists == 'yes'在childCount. 我們使用這些條件的組合是為了確保它不會(huì)無(wú)限期地運(yùn)行。


def book_hotel(intent_request):

    slots = intent_request['currentIntent']['slots']

    welcome = slots['welcome']

    location = slots['Location']

    fromDate = slots['FromDate']

    adultCount = slots['adultCount']

    nights = slots['nights']

    childExists = slots['childExists']

    childCount = slots['childCount']

    source = intent_request['invocationSource']

    if source == 'DialogCodeHook':

        output_session_attributes = intent_request['sessionAttributes'] if intent_request['sessionAttributes'] is not None else {}

        if childExists.lower() == 'yes':

            if not childCount:

                return elicit_slot (

                    output_session_attributes,

                    'HotelReservation',

                    slots,

                    'childCount',            

                        {

                            'contentType':'PlainText',

                            'content':'Please enter number of Children'

                        }

                    )

        return delegate(output_session_attributes, intent_request['currentIntent']['slots'])


    if source == 'FulfillmentCodeHook':

        return close (

            output_session_attributes,

                'Fulfilled',{

                'contentType':'PlainText',

                'content':'Here is the temparature in'

                }

            )

希望能幫助到你。


查看完整回答
反對(duì) 回復(fù) 2022-01-05
  • 1 回答
  • 0 關(guān)注
  • 137 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)