Cov txheej txheem:

Google Assistant rau PC/Mac/Linux: 5 Kauj Ruam
Google Assistant rau PC/Mac/Linux: 5 Kauj Ruam

Video: Google Assistant rau PC/Mac/Linux: 5 Kauj Ruam

Video: Google Assistant rau PC/Mac/Linux: 5 Kauj Ruam
Video: Xiaomi Smart Speaker - Глобальная версия умного динамика, Ок Google! Озвучка Home Assistant 2024, Hlis ntuj nqeg
Anonim
Google Assistant rau PC/Mac/Linux
Google Assistant rau PC/Mac/Linux

Google Assistant yog Google cov lus teb rau Amazon's Alexa tus pab tsev ntse. Thaum pib tsuas yog muaj nrog kev ua haujlwm tsawg hauv Google Allo daim ntawv thov, Google Assistant tom qab nthuav tawm nrog Google Tsev thiab Pixel smartphones kom coj lub zog tag nrho ntawm Google tus pabcuam rau cov neeg siv khoom.

Tom qab ob peb lub hlis ntawm kev tos, cov xov tooj siv Android 6.0+ kuj tau txais Google Assistant, thiab tsuas yog ob peb hnub dhau los Google tau tshaj tawm Google Assistant SDK uas tso cai rau Assistant ua haujlwm ntawm txhua lub platform. Hnub no, peb yuav qhia koj yuav ua li cas rau nruab Google Assistant rau koj lub Windows, Mac, lossis Linux tshuab siv Python.

Kauj ruam 1: Yuav tsum tau ua

Yuav tsum muaj
Yuav tsum muaj
Yuav tsum muaj
Yuav tsum muaj

Nab hab sej 3

Koj yuav tsum muaj Python teeb tsa txawm hais tias koj tab tom siv Windows, macOS, lossis GNU/Linux kev faib khoom. Kev teeb tsa yog yooj yim haum. Tsuas yog qhib cov ntawv teeb tsa thiab xaiv kev teeb tsa kev teeb tsa. Hauv cov kauj ruam tom ntej nyem tom ntej, xaiv Ntxiv Python rau ib puag ncig hloov pauv lub thawv thiab tom qab ntawd txav mus rau cov kauj ruam tom ntej thiab teeb tsa Python.

Koj tuaj yeem lees paub Python ua haujlwm los ntawm qhib lub davhlau ya nyob twg/hais kom sai thiab tom qab ntawd yooj yim ntaus nab hab sej. Yog tias koj pom lub davhlau ya nyob twg/hais kom sai rov qab Python tam sim no ntawm koj lub khoos phis tawj, tom qab ntawd koj yog kub!

Kauj ruam 2: Kho Google Assistant API

Kho lub Google Assistant API
Kho lub Google Assistant API
Kho lub Google Assistant API
Kho lub Google Assistant API
Kho lub Google Assistant API
Kho lub Google Assistant API

Cov hauv qab no yog cov lus qhia ib qib zuj zus taug kev koj los ntawm cov txheej txheem txhawm rau pab Google Assistant API hauv Cloud Platform Console yog li koj tuaj yeem nkag mus rau Google Assistant los ntawm txoj haujlwm Python. Txhua ntawm cov kauj ruam no yog platform ywj siab, txhais tau tias cov kauj ruam yog tib yam rau Windows, macOS, thiab GNU/Linux OS.

  1. Mus rau nplooj ntawv Projects hauv Google Cloud Platform Console.
  2. Nyem rau ntawm "Tsim qhov project" saum toj.
  3. Npe lub Project "Kuv Google Assistant" thiab nyem "Tsim."
  4. Tos ob peb feeb rau Console los tsim koj li Project tshiab. Koj yuav tsum pom lub cim kev hloov pauv ntawm lub kaum sab xis saum toj. Tom qab nws ua tiav tsim koj Txoj Haujlwm, koj yuav raug coj mus rau koj li Project nplooj ntawv teeb tsa.
  5. Nyem qhov txuas no mus ncaj nraim rau Google Assistant API nplooj ntawv. Nyob rau sab saum toj, nyem "Enable."
  6. Google yuav ceeb toom koj tias koj yuav tsum tsim daim ntawv pov thawj los siv API no. Nyem "Tsim daim ntawv pov thawj" nyob rau sab xis saum toj. Qhov no yuav coj koj mus rau nplooj ntawv teeb tsa qhov chaw uas Google pab koj txheeb xyuas seb hom ntawv pov thawj twg uas koj xav tau siv API no.
  7. Hauv qab "koj yuav hu rau API los ntawm", xaiv "Lwm UI (piv txwv li Windows, CLI cuab yeej)". Txog "cov ntaub ntawv twg koj yuav nkag mus" xaiv "Cov neeg siv cov ntaub ntawv" lub voj voog. Tam sim no coj mus rhaub "Kuv xav tau daim ntawv pov thawj dab tsi?"

  8. Google yuav tsum pom zoo tias koj tsim OAuth 2.0 tus lej ID. Lub npe Client ID txhua yam koj xav tau, piv txwv li, koj lub npe + Desktop. Thaum ua tiav xaiv lub npe, nyem "tsim tus lej ID."
  9. Hauv qab "cov npe khoom qhia rau cov neeg siv" nkag mus "Kuv Google Assistant." Nyem txuas ntxiv.
  10. Nyem "ua tiav." Tsis tas yuav tsum nyem rub tawm ntawm no vim peb tsuas xav tau tus neeg siv khoom zais, uas peb yuav rub tawm tom ntej.
  11. Tam sim no nyob hauv cov npe ntawm OAuth 2.0 tus lej ID, koj yuav tsum pom tus lej ID koj nyuam qhuav ua. Txhua txoj kev mus rau sab xis, nyem rau ntawm lub cim rub tawm los rub cov ntaub ntawv client_secret_XXX.json, qhov twg 'XXX' yog koj tus lej ID. Txuag cov ntaub ntawv no nyob txhua qhov chaw hauv koj lub khoos phis tawj, tshwj xeeb hauv daim nplaub tshev tshiab hu ua "googleassistant."
  12. Mus rau nplooj ntawv Kev Tswj Xyuas Haujlwm rau koj tus lej Google thiab xyuas kom tseeb tias "Web & App Activity", "Location History", "Device Information", thiab "Voice & Audio Activity" tau qhib. Qhov no yog li Google Assistant tuaj yeem nyeem koj cov ntaub ntawv tus kheej.

Tam sim no peb tau tsim cov txheej txheem rau cov neeg siv khoom, hauv qhov no peb lub Windows/Mac/Linux tshuab, nkag mus rau Google Assistant API hauv qab peb tus lej Google. Tom ntej no peb yuav tsum teeb tsa tus neeg siv khoom uas yuav nkag tau rau Google Assistant API.

Kauj Ruam 3: Nruab Google Assistant Qauv Python Project

Nruab Google Assistant Qauv Python Project
Nruab Google Assistant Qauv Python Project
Nruab Google Assistant Qauv Python Project
Nruab Google Assistant Qauv Python Project
Nruab Google Assistant Qauv Python Project
Nruab Google Assistant Qauv Python Project

Qhib lub davhlau ya nyob twg/hais kom ua qhov rai thiab mus raws cov theem hauv qab no. Ua ntej tshaj, sau cov lus txib no:

nab hab sej -m pip nruab google-assistant-sdk [kuaj]

Koj yuav tsum pom tag nrho pawg ntawm kev vam khom tau rub tawm thiab teeb tsa thaum koj nkag mus rau cov lus txib no. Cov no xav tau rau qhov piv txwv Python txoj haujlwm los ua haujlwm. Tos kom nws ua tiav.

Thaum nws ua tiav, tom ntej no nkag mus rau cov lus txib hauv qab no (nco ntsoov kho txoj hauv kev):

pip nruab-hloov kho google-auth-oauthlib [tool] google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

(Raws li hauv kuv qhov xwm txheej, nws yog: pip nruab-hloov kho google-auth-oauthlib [cuab yeej] google-oauthlib-tool --client-secrets "C: / Users / Arya Bhushan / Documents / GAssistant / ntxiv / client_id.json "--cov https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless)

Hauv qhov hais kom ua sai sai, koj yuav pom cov lus teb qhia koj kom mus ntsib URL txhawm rau tso cai rau daim ntawv thov.

Luam thiab muab qhov URL no tso rau hauv koj tus browser. Xaiv tib tus lej Google uas koj siv los teeb tsa Google Assistant API. Ntawm nplooj ntawv tom ntej, koj yuav pom lub thawv ntawv uas muaj koj tus neeg siv Access Token.

Luam qhov Access token thiab muab nws tso rau hauv qhov hais kom ua qhov uas nws nug koj txog cov cai tso cai. Yog ua tiav kom raug, koj yuav pom cov lus teb uas koj daim ntawv pov thawj tau raug cawm.

Kauj ruam 4: Kuaj Google Assistant

Kuaj Google Assistant
Kuaj Google Assistant
Kuaj Google Assistant
Kuaj Google Assistant

nkag mus rau cov lus txib no kom pib tham nrog Google Assistant:

pib nab nab -m googlesamples.assistant.grpc.pushtotalk

Tos rau qhov kev hais kom ua tam sim hais tias "nias Enter kom xa daim ntawv thov tshiab", tom qab ntawd nyem Enter kom pib tham nrog Google Assistant. Tom qab koj ua tiav kev hais lus, qhov hais kom sai yuav pom cov ntawv sau ntawm yam koj nyuam qhuav tau hais thiab tom qab ntawd rov ua cov lus teb. Yog tias koj pom cov lus ceeb toom tom qab, tsuas yog tsis quav ntsej nws.

Muaj kev lom zem ua si nrog Google Assistant ntawm koj lub Windows, macOS, lossis GNU/Linux tshuab! Nws tsis muaj txiaj ntsig tshwj xeeb hauv hom ntawv no, tab sis nws yog qhov qhia tau sai heev ntawm qhov muaj peev xwm uas Google Assistant SDK tshiab sawv cev. Tej zaum peb yuav pom cov duab desktop lossis browser txuas ntxiv kom tau txais txiaj ntsig ntawm kev ua haujlwm no yav tom ntej.

Kauj Ruam 5: Cov Lus Qhia Ntxiv

Cov Lus Qhia Ntxiv
Cov Lus Qhia Ntxiv

Zoo qhov no yog kuv thawj cov lus qhia thiab yog tias muaj qhov ua yuam kev lossis teeb meem, xav tawm tswv yim thiab kuv yuav sim txhim kho nws!

Tsis tas li kuv tab tom txuas tus pdf version ntawm cov lus qhia hauv cov kauj ruam no kom txaus siab:)

PS Yog tias koj nyob ntawm Ubuntu, koj yuav tsum teeb tsa qhov tsis muaj kev vam khom, piv txwv li pob sej3-pyaudio. Ua tsaug rau PeterB480

Tau qhov twg los: XDA

Pom zoo: