Cov txheej txheem:

Ua Alexa Kev Txawj Ntse nrog Cloud9- Tsis muaj daim npav rho nyiaj lossis yuav tsum tau kho vajtse: 7 Kauj Ruam (nrog Duab)
Ua Alexa Kev Txawj Ntse nrog Cloud9- Tsis muaj daim npav rho nyiaj lossis yuav tsum tau kho vajtse: 7 Kauj Ruam (nrog Duab)

Video: Ua Alexa Kev Txawj Ntse nrog Cloud9- Tsis muaj daim npav rho nyiaj lossis yuav tsum tau kho vajtse: 7 Kauj Ruam (nrog Duab)

Video: Ua Alexa Kev Txawj Ntse nrog Cloud9- Tsis muaj daim npav rho nyiaj lossis yuav tsum tau kho vajtse: 7 Kauj Ruam (nrog Duab)
Video: Google Colab — интерфейс командной строки Amazon Web Services (AWS CLI) 2024, Kaum ib hlis
Anonim
Ua Alexa Kev Txawj Ntse nrog Cloud9- Tsis tas yuav muaj daim npav rho nyiaj lossis kho vajtse xav tau
Ua Alexa Kev Txawj Ntse nrog Cloud9- Tsis tas yuav muaj daim npav rho nyiaj lossis kho vajtse xav tau

Nyob zoo, hnub no kuv yuav los qhia koj yuav ua li cas tsim koj tus kheej Amazon Alexa txuj ci siv Cloud9. Rau cov uas koj tsis paub, Cloud9 yog online IDE txhawb nqa ntau yam lus sib txawv thiab nws yog ib puas feem pua dawb - tsis xav tau daim npav rho nyiaj. Kev txawj Alexa zoo li app tab sis rau Alexa cov cuab yeej.

Kuv ib txwm nyiam cov phiaj xwm thiab tus pab lub suab tab sis nyuam qhuav nyuam qhuav pib ua txoj haujlwm Amazon Echo. Kuv cov teeb meem yog kuv tsis paub ntau ntawm node.js, yog li kuv yuav ua haujlwm hauv nab hab sej rau qhov kev qhia no thiab, ua tsev kawm theem nrab kuv tsis muaj daim npav rho nyiaj, txhais tau tias kuv tsis tuaj yeem siv AWS lamda. Txoj kev kuv daws qhov teeb meem no yog siv Cloud9.

Kuv vam tias koj txaus siab rau qhov kev qhia no. Yog tias koj tau daig nyob qhov twg sim cov duab raws li kuv tau sim ntxiv cov lus qhia hauv qhov chaw raug thiab yog tias koj tseem nyam thov koj xav ntxiv lus nug lossis tawm tswv yim.

(Ua tsaug rau HeikoAL ntawm Pixabay rau daim npog)

Kauj Ruam 1: Kos Npe Rau Hauv Cloud9 thiab Amazon Developer Console

Kos Npe Rau Hauv Cloud9 thiab Amazon Tus Tsim Kho Console
Kos Npe Rau Hauv Cloud9 thiab Amazon Tus Tsim Kho Console
Kos Npe Rau Hauv Cloud9 thiab Amazon Tus Tsim Kho Console
Kos Npe Rau Hauv Cloud9 thiab Amazon Tus Tsim Kho Console
Kos Npe Rau Hauv Cloud9 thiab Amazon Tus Tsim Kho Console
Kos Npe Rau Hauv Cloud9 thiab Amazon Tus Tsim Kho Console

Txhawm rau ua peb cov txuj ci, peb yuav tsum tsim lub ntsiab lus tseem ceeb rau kev txawj ntse hauv nab nab ntawm Cloud9 thiab txoj hauv kev nws ua ke nrog Alexa ntawm Amazon Developer Console.

1. Huab 9

Koj yuav zoo li xav tau Cloud9 tus lej twb tau ua tiav rau qhov no los ua haujlwm tam sim no Amazon tau ua dua Cloud9, koom ua ke rau hauv AWS, txawm li cas los nws zoo li tuaj yeem nkag mus nrog Github, Bitbucket lossis Google ntawm lub platform qub uas yog yam peb xav tau ua.

Mus ntsib lub vev xaib no: https://c9.io/login thiab nkag mus.

2. Amazon Developer Console

Tam sim no mus ntsib https://developer.amazon.com thiab kos npe rau ntawm lub kaum sab xis saum toj. Tam sim no nyem rau ntawm Alexa thiab tom qab ntawd Koj Alexa Dashboards nyob rau sab xis saum toj. Koj yuav tsum pom lub vijtsam qub saib zoo li qhov saum toj no. Tam sim no peb yuav tsum nyem rau Pib Pib hauv Alexa Skills Kit box.

Kauj Ruam 2: Teeb Alexa Skill hauv Amazon Dev Console

Teeb Alexa Skill hauv Amazon Dev Console
Teeb Alexa Skill hauv Amazon Dev Console

Tam sim no peb tab tom teeb tsa cov txuj ci hauv Amazon server. Yog tias koj twb paub yuav ua li cas lawm, koj tsis tas yuav nyeem qhov no thiab koj tuaj yeem hla mus rau qib tom ntej.

Nyem rau Ntxiv Kev Txawj Ntse Tshiab thiab koj yuav tsum tau nthuav tawm nrog lub vijtsam zoo li qhov saum toj no.

Hauv cov xov tooj cua khawm saum toj kawg nkaus, peb yuav tsum xaiv Tus Qauv Kev Sib Tham

Tam sim no xaiv cov lus ntawm koj qhov txuj ci. Nws yog qhov tseem ceeb los xaiv Askiv Askiv yog tias koj tus as khauj amazon muaj UK chaw nyob raws li kev sim yuav tsis ua haujlwm ntawm lub cuab yeej siv lub suab tiag yog tias koj xaiv Asmeskas. Nws tseem tuaj yeem ua haujlwm ntawm Echoism txawm hais tias.

Tam sim no koj yuav tsum sau lub npe thiab lub npe ntawm koj qhov txuj ci. Kuv xav kom cov no zoo ib yam rau kev yooj yim. Lub npe yog dab tsi tus neeg siv yuav pom hauv Alexa app thiab lub npe thov yog dab tsi tus neeg siv yuav hais thaum ua rau muaj kev txawj ntse, piv txwv: Alexa, nug "Invocation name" txog huab cua. Rau kuv thawj qhov txuj ci kuv tau teev lawv ob qhov Test.

Peb cov txuj ci yuav tsis siv peb yam kawg kom lawv tuaj yeem nyob ib leeg.

Tam sim no koj yuav tsum nyem tseg thiab tom ntej. Dev console tuaj yeem hloov kho me ntsis ntawm no tab sis nws yuav tsis poob cov ntaub ntawv.

Kauj Ruam 3: Tus Qauv Sib Txheeb

Kev Sib Tham Qauv
Kev Sib Tham Qauv
Kev Sib Tham Qauv
Kev Sib Tham Qauv
Kev Sib Tham Qauv
Kev Sib Tham Qauv

Tam sim no koj yuav tsum nyob ntawm tus qauv sib cuam tshuam tab ntawm lub console. Nov yog qhov uas peb qhia Alexa li cas peb xav kom nws txhais peb cov lus txib. Xaiv Launch Skill Builder Beta xaiv.

Tam sim no peb yuav tsum teeb tsa lub hom phiaj rau peb cov txuj ci uas zoo li lub luag haujlwm nws ua. Nyem rau Ntxiv lub hom phiaj khawm thiab sau lub npe tsim nyog. Qhov no tuaj yeem yog txhua yam thiab tsis tas yuav tsum tau paub los ntawm tus neeg siv, txawm li cas los xij peb yuav xav tau nws rau cov phiaj xwm tom qab. Kuv tau hu kuv lub npe HelloWorld.

Tam sim no peb yuav tsum ntxiv qee cov lus hais uas yog yam uas tus neeg siv yuav hais yog tias lawv xav thov qhov no. Kuv tau ntaus "rau kev tos txais" thiab "rau kev nyob zoo" rau hauv lub thawv no. Nco ntsoov nias nkag mus nruab nrab. Txhawm rau qhib lub hom phiaj no, ib tus neeg siv yuav hais "Alexa, nug kev xeem rau kev txais tos."

Thaum qhov no tau ua tiav, tam sim no peb yuav tsum nias tseg tus qauv thiab tsim qauv nyob rau saum toj. Nco ntsoov txuag ua ntej thiab tom qab ntawd tsim. Lub tsev yuav siv ob peb feeb.

Thaum kawg, peb yuav tsum nyem lub pob teeb tsa nyob rau sab saud.

Kauj ruam 4: Mus rau Cloud9

Mus rau Cloud9
Mus rau Cloud9
Mus rau Cloud9
Mus rau Cloud9

Txog tam sim no peb yuav tsum rov qab mus rau Cloud9 thiab tsim qhov kawg rau peb qhov txuj ci.

Hauv koj lub dashboard tsim chaw ua haujlwm tshiab thiab sau lub npe tsis nco. Koj tuaj yeem ntxiv cov lus piav qhia yog tias koj xav tau tab sis nws tsis tsim nyog. Koj kuj yuav tsum xaiv Python ua cov lus. Tam sim no nias tsim chaw ua haujlwm. Nws yuav siv qee lub sijhawm los thauj khoom tab sis thaum kawg koj yuav tsum tau nthuav tawm nrog lub vijtsam zoo li saum toj no. Nov yog koj chaw ua haujlwm.

Cloud9 chaw ua haujlwm yog ubuntu linux tshuab uas ua haujlwm zoo ib yam li raspberry pi. Lawv muaj qhov zoo ib yam uas lawv tau tuav. Ua ntej peb tuaj yeem sau peb cov cai rau hauv ib puag ncig no, peb yuav tsum tau ua ob peb lus txib kom nws npaj tau.

1. Hloov kho pip: sudo -H pip2 nruab -hloov kho pip

2. Nruab Flask: sudo pip install flask

3. Nruab Flask-Ask, lub tsev qiv ntawv uas cuam tshuam nrog Alexa: sudo pip nruab lub raj mis-nug

Tam sim no peb tuaj yeem sau peb qhov program. Nyem rau ntsuab ntxiv rau saum thiab xaiv Cov Ntawv Tshiab. Nias Cov Ntaub Ntawv, Txuag thiab sau lub npe tsim nyog nrog.py thaum kawg piv txwv HelloAlexa.py. Tam sim no nias tseg. Hauv qib tom ntej peb yuav nkag mus rau qhov chaws ntawm peb qhov program.

Kauj ruam 5: Txoj Cai

Txoj Cai!
Txoj Cai!

Tam sim no nws yog qhov tsim nyog kom nkag mus rau cov cai hauv qab no, hloov ntawm HelloWorld, siv koj lub npe lub hom phiaj uas koj tau tsim ua ntej:

los ntawm lub raj mis ntshuam Flask, render_templatefrom flask_ask ntshuam nug, nqe lus

import os

app = Flask (_ npe_)

nug = Nug (app, '/')

@ask.intent ('Nyob Zoo')

def nyob zoo ():

nqe lus rov qab ("Nyob zoo, ntiaj teb.")

yog _name_ == "_main_":

host = os.getenv ('IP', '0.0.0.0')

chaw nres nkoj = int (os.getenv ('PORT', 8080))

app.debug = Tseeb

app.run (host = host, chaw nres nkoj = chaw nres nkoj)

Cia peb ua raws txoj cai:

Thawj peb kab ntshuam peb cov qauv tsim nyog, Flask-Ask, rau amazon Alexa thiab Flask uas yog qhov yuav tsum tau ua ntej ntawm Flask-Ask. Ob kab tom ntej no tsim app thiab nug uas zoo li tus qauv tseem ceeb ntawm peb qhov haujlwm. Txhawm rau nkag mus rau cov khoom peb xav nkag mus peb xav tau lawv. Kab 6 yog tus kho kom zoo nkauj. Nws hais tias thaum peb tau txais kev hu xov tooj mus rau lub vev xaib uas peb qhov haujlwm tau ua, yog tias qhov url muaj "HelloWorld" ces cov cai hauv qab no yuav thaiv. Kev ua haujlwm hauv qab tus kws kho kom zoo nkauj tsis ua haujlwm ib tus lej, nws tsuas yog rov qab tus nqi Nyob zoo, ntiaj teb. Cov lus () hais kom ua yuav tsum tau hloov txoj hlua mus rau hauv daim ntawv uas Alexa tuaj yeem nkag siab. Thaum kawg, qhov seem ntawm txoj cai yog ib txoj hauv kev ua kom ntseeg tau tias peb txoj haujlwm ua haujlwm tau zoo ntawm Cloud9. Nws pib hais tias: yog tias peb siv txoj cai no ncaj qha, zoo li tsis yog tus qauv, tom qab ntawd tus lej yuav mloog ntawm chaw nres nkoj 8080. Kab app.debug ua kom lub chaws tsis nres ua ntej. Yog tias koj puas tau ua lwm daim ntawv thov zoo li no ntawm Cloud9, koj yuav tsum nco ntsoov 5 kab kawg lossis lwm yam koj yuav tau txais "Tsis muaj daim ntawv thov zoo li yuav ua haujlwm ntawm no" yuam kev. Cov chaw nres nkoj Cloud9 siv yog 8080, 8081 thiab 8082 yog li ib qho ntawm cov no yuav zoo.

Nco ntsoov khaws koj cov cai thiab tom qab txuas mus rau kauj ruam tom ntej.

Kauj Ruam 6: Txuas Cloud9 rau Alexa

Txuas Cloud9 rau Alexa
Txuas Cloud9 rau Alexa
Txuas Cloud9 rau Alexa
Txuas Cloud9 rau Alexa

Tam sim no peb yuav tsum txuas peb Cloud9 code rau peb Alexa app hauv Dev portal.

Nias lub pob ntsuab khiav ntawm lub ces kaum. Tam sim no theej thiab muab qhov txuas txuas rau saum koj lub davhlau ya nyob twg rau hauv koj lub web browser. Saib daim duab yog tias koj tsis pom nws. Yog tias koj pom lub vijtsam txiv kab ntxwv nrog Qhib Daim Ntawv Thov, koj yuav tsum nyem rau nws. Koj yuav tsum pom lub vijtsam dawb uas hais tias Txoj Cai Tsis Tso Cai rau nws. Qhov no yuav suab tsis zoo, txawm li cas los xij txhua qhov no txhais tau tias Flask-Ask tau teeb tsa kom raug kom tsuas yog Alexa cov kev pabcuam tuaj yeem mus ntsib nplooj ntawv ntawd. Yog tias qhov no ua haujlwm tau zoo, rov qab mus rau Dev Console hauv Amazon thiab xyuas kom tseeb tias koj nyob hauv kab ntawv teeb tsa. Tam sim no nias HTTPS thiab muab tshuaj txhuam URL koj nyuam qhuav muaj rau hauv lub npov ntawv uas tshwm tuaj. Koj tuaj yeem tsis quav ntsej lwm qhov chaw, tsuas yog nyem Txuag thiab Tom ntej. Tam sim no koj yuav tsum pom lub thawv me me nug koj txog Cov Ntawv Pov Thawj. Xaiv qhov kev xaiv thib ob, "Kuv qhov kev txhim kho qhov kawg yog ib pawg ntawm cov npe uas muaj daim ntawv pov thawj tsiaj qus los ntawm daim ntawv pov thawj" thiab tam sim no nias Txuag thiab tom qab ntawd Tom ntej.

Koj yuav tsum tau mus rau theem Xeem tam sim no. Yog tias koj yog, qhov kev vam meej zoo rau qib tom ntej. Yog tsis yog, xyuas koj tau ua raws cov lus qhia kom raug.

Kauj ruam 7: Kuaj

Kev Xeem!
Kev Xeem!
Kev Xeem!
Kev Xeem!

Tam sim no koj yuav tsum pom nplooj ntawv zoo li ib qho saum toj no. Yog tias kuv lub npov uas nws hais Thov Thov Ua Tus Qauv Sib Cais raug teeb tsa rau Xiam Oob Qhab, tom qab ntawd qhib nws. Peb tuaj yeem pib los ntawm kev sim cov txuj ci ntawm no thiab tom qab ntawd peb tuaj yeem sim nrog lub cuab yeej ncha tiag. Nqes mus rau ntu kev pabcuam simulation thiab nkag mus rau ib qho ntawm cov lus koj tau tsim ua ntej. Tam sim no nias Nug Test. Koj yuav tsum pom qee cov ntawv xiav ntawm ob sab. Sab tes xis yuav tsum muaj cov lus "Nyob Zoo, Ntiaj Teb" lossis qee cov ntawv uas koj teeb tsa koj cov txuj ci los teb nrog. Yog tias koj sab tes xis muaj qhov ua yuam kev, txheeb xyuas tias koj tus lej tseem ua haujlwm thiab koj tau ntaus nws kom raug.

Thaum qhov ntawd ua haujlwm, koj tuaj yeem txav mus sim nws nrog lub cuab yeej ncha tiag. Xyuas kom tseeb tias lub ncha ntaus ntawv tau kos npe nrog tib tus as khauj thiab tom qab ntawd koj yuav tsum muaj peev xwm sim nws. Nco ntsoov hais "Alexa, nug Test" thiab tom qab ntawd koj cov lus hais. Yog tias koj tsis muaj lub tshuab ncha ces koj tuaj yeem siv lub echo simulator https://echosim.io/welcome Koj yuav tsum tau kos npe nrog koj tus lej Amazon Tus Tsim Kho.

Ua tsaug rau koj nyeem Kuv Cov Lus Qhia. Kuv vam tias nws ua haujlwm rau koj. Yog tias koj muaj lus nug nco ntsoov tso tawm cov lus pom thiab yog tias koj nyiam nws thov pov npav rau kuv hauv Kev Tshaj Tawm Suab qhib thiab thawj zaug sau kev sib tw.

Ua tsaug!

Pom zoo: