Kể từ ngày 13 tháng 6 năm 2023, Hành động trò chuyện không còn được dùng nữa. Để biết thêm thông tin, hãy xem phần Hành động trò chuyện ngừng hoạt động.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Các câu trả lời đơn giản sẽ có dạng bong bóng trò chuyện một cách trực quan và chuyển văn bản sang lời nói
(TTS) hoặc Ngôn ngữ đánh dấu tổng hợp lời nói (SSML) cho âm thanh. Người này nên sử dụng đoạn mã
câu trả lời đơn giản trong cuộc trò chuyện, bạn có thể thu hút người dùng bằng hình ảnh rõ ràng
và giao diện âm thanh có thể ghép nối
với các thành phần trò chuyện khác.
Nội dung bong bóng trò chuyện trong câu trả lời đơn giản phải là tập con ngữ âm hoặc hoàn chỉnh
bản sao của đầu ra TTS/SSML. Điều này giúp người dùng chỉ ra những gì Hành động của bạn
và tăng mức độ hiểu bài trong nhiều điều kiện.
Trong câu lệnh, văn bản bạn cung cấp trong các đối tượng first_simple và last_simple
sử dụng các thuộc tính của phản hồi đơn giản. Trợ lý Google gửi tất cả thông tin đơn giản
câu trả lời trong câu lệnh, sau đó gửi câu trả lời nhiều định dạng cuối cùng trong hàng đợi câu lệnh.
Thuộc tính
Loại phản hồi đơn giản có các thuộc tính sau:
Thuộc tính
Loại
Yêu cầu
Mô tả
speech
string
Không bắt buộc
Biểu thị các từ được nói với người dùng trong SSML hoặc chuyển văn bản sang lời nói.
Nếu trường override trong câu lệnh chứa giá trị là "true",
thì lời nói được xác định trong trường này sẽ thay thế lời nói đơn giản trước đó
lời nhắc.
text
string
Không bắt buộc
Văn bản hiển thị trong bong bóng trò chuyện. Chuỗi dài hơn 640 ký tự
được cắt bớt ở dấu ngắt từ đầu tiên (hoặc khoảng trắng) trước 640
ký tự. Bạn nên sử dụng dưới 300 ký tự để tránh
mở rộng ra khỏi màn hình, đặc biệt là khi ghép nối với
thẻ hoặc phần tử hình ảnh khác.
Nếu không được cung cấp, Trợ lý sẽ hiển thị một phiên bản màn hình của
Thay vào đó, trường speech. Nếu trường override trong
câu lệnh chứa là "false", thì văn bản được xác định trong trường này là
thêm vào văn bản của câu lệnh đơn giản trước đó.
Mã mẫu
YAML
candidates:-first_simple:variants:-speech:This is the first simple response.text:This is the 1st simple response.last_simple:variants:-speech:This is the last simple response.text:This is the last simple response.
JSON
{"candidates":[{"first_simple":{"variants":[{"speech":"This is the first simple response.","text":"This is the 1st simple response."}]},"last_simple":{"variants":[{"speech":"This is the last simple response.","text":"This is the last simple response."}]}}]}
Node.js
app.handle('Simple',conv=>{conv.add(newSimple({speech:'This is the first simple response.',text:'This is the 1st simple response.'}));conv.add(newSimple({speech:'This is the last simple response.',text:'This is the last simple response.'}));});
JSON
{"responseJson":{"session":{"id":"session_id","params":{}},"prompt":{"override":false,"firstSimple":{"speech":"This is the first simple response.","text":"This is the 1st simple response."},"lastSimple":{"speech":"This is the last simple response.","text":"This is the last simple response."}}}}
SSML và âm thanh
Hãy dùng SSML và âm thanh trong câu trả lời của bạn để câu trả lời trau chuốt hơn cũng như cải thiện
trải nghiệm người dùng. Xem tài liệu SSML để biết thêm thông tin.
Thư viện âm thanh
Chúng tôi cung cấp nhiều âm thanh ngắn, miễn phí trong thư viện âm thanh của mình. Các
âm thanh được lưu trữ cho bạn, nên bạn chỉ cần thêm âm thanh đó vào SSML.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eSimple responses use chat bubbles with text-to-speech or SSML for audio, keeping users engaged with a clear interface.\u003c/p\u003e\n"],["\u003cp\u003eChat bubble content should be a phonetic subset or a complete transcript of the audio output for better user comprehension.\u003c/p\u003e\n"],["\u003cp\u003eSimple responses are sent before the final rich response, and some surfaces may only display the rich response.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003espeech\u003c/code\u003e property defines what the Assistant says, while the \u003ccode\u003etext\u003c/code\u003e property defines what's displayed in the chat bubble.\u003c/p\u003e\n"],["\u003cp\u003eSSML and sounds can be used to enhance simple responses, with a sound library available for use.\u003c/p\u003e\n"]]],[],null,["Simple responses take the form of a chat bubble visually and use text-to-speech\n(TTS) or Speech Synthesis Markup Language (SSML) for sound. By using short\nsimple responses in conversation, you can keep users engaged with a clear visual\nand audio interface that can be paired with other conversational elements.\n\nChat bubble content in a simple response must be a phonetic subset or a complete\ntranscript of the TTS/SSML output. This helps users map out what your Action\nsays and increases comprehension in various conditions.\n\nIn a prompt, text you provide in the `first_simple` and `last_simple` objects\nuse the properties of a simple response. Google Assistant sends all simple\nresponses in a prompt, then sends the final rich response in the prompt queue.\n| **Note:** Some surfaces (like smart displays) only display one piece of content at a time instead of using the chat bubble format. As a result, only the rich response appears when you provide both a simple and a rich response.\n\nProperties\n\nThe simple response type has the following properties:\n\n| Property | Type | Requirement | Description |\n|----------|--------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `speech` | string | Optional | Represents the words to be spoken to the user in SSML or text-to-speech. If the `override` field in the containing prompt is \"true\", then speech defined in this field replaces the previous simple prompt's speech. |\n| `text` | string | Optional | Text to display in the chat bubble. Strings longer than 640 characters are truncated at the first word break (or whitespace) before 640 characters. We recommend using less than 300 characters to prevent content from extending past the screen, especially when paired with a card or other visual element. If not provided, Assistant renders a display version of the `speech` field instead. If the `override` field in the containing prompt is \"false\", then text defined in this field is appended to the previous simple prompt's text. |\n\nSample code \n\nYAML \n\n```yaml\ncandidates:\n - first_simple:\n variants:\n - speech: This is the first simple response.\n text: This is the 1st simple response.\n last_simple:\n variants:\n - speech: This is the last simple response.\n text: This is the last simple response.\n```\n\nJSON \n\n```gdscript\n{\n \"candidates\": [\n {\n \"first_simple\": {\n \"variants\": [\n {\n \"speech\": \"This is the first simple response.\",\n \"text\": \"This is the 1st simple response.\"\n }\n ]\n },\n \"last_simple\": {\n \"variants\": [\n {\n \"speech\": \"This is the last simple response.\",\n \"text\": \"This is the last simple response.\"\n }\n ]\n }\n }\n ]\n}\n```\n\nNode.js \n\n```javascript\napp.handle('Simple', conv =\u003e {\n conv.add(new Simple({\n speech: 'This is the first simple response.',\n text: 'This is the 1st simple response.'\n }));\n conv.add(new Simple({\n speech: 'This is the last simple response.',\n text: 'This is the last simple response.'\n }));\n});\n```\n\nJSON \n\n```carbon\n{\n \"responseJson\": {\n \"session\": {\n \"id\": \"session_id\",\n \"params\": {}\n },\n \"prompt\": {\n \"override\": false,\n \"firstSimple\": {\n \"speech\": \"This is the first simple response.\",\n \"text\": \"This is the 1st simple response.\"\n },\n \"lastSimple\": {\n \"speech\": \"This is the last simple response.\",\n \"text\": \"This is the last simple response.\"\n }\n }\n }\n}\n```\n\nSSML and sounds\n\nUse SSML and sounds in your responses to give them more polish and enhance the\nuser experience. See the [SSML documentation](/assistant/conversational/ssml) for more information.\n\nSound library\n\nWe provide a variety of free, short sounds in our [sound library](/assistant/tools/sound-library). These\nsounds are hosted for you, so all you need to do is include them in your SSML."]]