เรียกใช้โค้ดตัวอย่าง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ณ จุดนี้ คุณก็พร้อมที่จะเรียกใช้ตัวอย่างและทำการค้นหาแล้ว
ในคำสั่งต่อไปนี้
แทนที่ my-dev-project
ด้วย
รหัสโปรเจ็กต์ Google Cloud Platform สำหรับโปรเจ็กต์คอนโซล Actions ที่คุณ
สร้าง แล้ว วิธีค้นหารหัสโปรเจ็กต์ในคอนโซลการดำเนินการ
เลือกโครงการ คลิกไอคอนรูปเฟือง แล้วเลือกการตั้งค่าโปรเจ็กต์
แทนที่ my-model
ด้วยชื่อโมเดลที่คุณ
ที่สร้างในขั้นตอนก่อนหน้านี้
googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
กดปุ่ม Enter แล้วลองใช้ข้อความค้นหาต่อไปนี้
- ฉันคือใคร
- ตอนนี้กี่โมงแล้ว
- สภาพอากาศในซานฟรานซิสโกเป็นอย่างไร
หาก Assistant ไม่ตอบสนอง ให้ทำตามวิธีการแก้ปัญหา
ถ้าจะเปลี่ยนภาษาสำหรับ Google Assistant หรือเปิดใช้ผลการค้นหาเฉพาะบุคคล ให้ทำดังนี้
ใช้แอป Google Assistant
ค้นหารหัสอินสแตนซ์ของอุปกรณ์
เมื่อคุณเรียกใช้ตัวอย่างเป็นครั้งแรก จะสร้างอินสแตนซ์อุปกรณ์สำหรับ
อุปกรณ์ที่ต้องการ อินสแตนซ์ของอุปกรณ์นี้จะเชื่อมโยงกับรุ่นอุปกรณ์
ที่คุณระบุให้เรียกใช้ตัวอย่าง นอกจากนี้ คุณยังสร้างอินสแตนซ์ด้วยตัวเองได้
โดยใช้เครื่องมือการลงทะเบียน
ตัวอย่างจะบันทึกทั้งรหัสโมเดลและอินสแตนซ์ หากคุณเรียกใช้ตัวอย่างโดยไม่ระบุ
รายการเหล่านี้เป็นอาร์กิวเมนต์ ระบบจะใช้รหัสที่บันทึกไว้เป็นค่าเริ่มต้น
ค้นหารหัสอินสแตนซ์ของอุปกรณ์ในเอาต์พุตสำหรับตัวอย่าง
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: '/home/pi/.config/googlesamples-assistant/device_config.json'
INFO:root:Registering device
INFO:root:Device registered: 0eea18ae-d17e-11e7-ac7a-b827ebb8010f # Device instance ID
Press Enter to send a new request...
ขั้นตอนถัดไป
เมื่อคุณมี Google Assistant ทำงานในอุปกรณ์แล้ว ต่อไปก็ถึงเวลา
ขยายระยะเวลานั้น คุณสามารถดูขั้นตอนถัดไปที่ทำได้ที่นี่
หรือสร้างการดำเนินการของอุปกรณ์ต่อไป
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-09-07 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2024-09-07 UTC"],[[["Run the provided command, replacing placeholders with your project and model IDs, to initiate a sample query."],["Test the setup with example queries like \"Who am I?\", \"What time is it?\", or weather-related questions."],["Locate the device instance ID within the sample's output for future use and potential troubleshooting."],["Refer to provided resources for troubleshooting, language settings, and next steps in extending device functionality."]]],["To run the sample, replace placeholders in the provided command with your Google Cloud project ID and model name. Execute the command and try example queries. If no response, consult troubleshooting. The first run generates a unique device instance ID, displayed in the output, and saves it for future use. The command can be run without arguments if the ID was saved. You can change the language or add personal settings through the Google Assistant app. Further steps like extending or adding device actions are possible.\n"]]