對話動作已於 2023 年 6 月 13 日淘汰。詳情請參閱「
對話動作已淘汰」。
Storage
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
為了讓系統更自訂使用者體驗,您可以在對話之間或與使用者的多個對話之間儲存資料。儲存的資料可在單一對話中提供實用的回覆提示、儲存不同工作階段的遊戲分數,或為使用者記住少量資訊。
對話期間,可以透過多種方式儲存資料。在單一對話中,您可以使用「類型」為意圖中的訓練詞組加註,或是在運算單元填充期間儲存使用者的資訊。
您也可以使用下列儲存方法,使用 Webhook 建立動作儲存庫值:
請搭配使用這些儲存方法,以最符合您想在動作叫用內或不同叫用之間保留資訊的方式。
工作階段儲存
當您想保留單一對話的值,但不想保留另一個對話的值時,請使用「工作階段儲存空間」。在對話期間,使用 types 收集的任何資料都會儲存在工作階段儲存空間。
使用者儲存空間
如果您要針對單一已驗證的使用者,在對話間保留值,請使用使用者儲存空間。舉例來說,遊戲可以將使用者最高分儲存在使用者儲存空間中,並在使用者每次開始新對話時,在歡迎訊息中顯示最高分。
住家儲存空間
當您想為單一家庭中的裝置在對話間保留某個值 (根據 Home Graph 而定),請使用住家儲存空間。住家儲存空間並非與任何特定使用者有關,因此住家中的所有使用者都能提供專屬儲存空間。使用家用儲存空間時,Google 還會在通過驗證的使用者每次叫用時,傳送一次通知;訪客使用者每 10 分鐘叫用一次 (最多每 10 分鐘一次)。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eActions on Google can save data to customize user experiences, enabling features like reprompts and storing information across conversations.\u003c/p\u003e\n"],["\u003cp\u003eData can be saved within a single conversation using types or across conversations with session, user, or home storage, depending on the desired persistence.\u003c/p\u003e\n"],["\u003cp\u003eSession storage retains data for a single conversation, user storage saves data for a specific user across conversations, and home storage persists data for all users on devices in a household.\u003c/p\u003e\n"]]],["Data in user interactions can be saved within single or multiple conversations to enhance user experience. Data can be stored through types in intents or via webhook storage methods: session storage for single conversation data, user storage for data across conversations of a specific user, and home storage for data across conversations for all users in a household. These methods can be used in conjunction to manage how information persists.\n"],null,["To better customize a user's experience with your Action, you can save data\nbetween turns of a conversation or across multiple conversations with that user.\nSaved data can provide helpful reprompts in a single conversation, store game\nscores across sessions, or remember small pieces of information for a user.\n\nData can be stored in multiple ways during a conversation. In a single\nconversation, you can use [types](/assistant/conversational/types) to annotate training phrases in intents or\nto store information from the user during slot filling.\n\nYou can also have your Action store values using your webhook with the following\nstorage methods:\n\n- Session storage\n- User storage\n- Home storage\n\nUse these storage methods in combination with each other to best match how you\nwant to persist information within or between invocations of your Action.\n\nSession storage\n\nUse [session storage](/assistant/conversational/storage-session) when you want to persist a value for a single\nconversation, but not from one conversation to another. During a conversation,\nany data collected using [types](/assistant/conversational/types) is stored in session storage.\n\nUser storage\n\nUse [user storage](/assistant/conversational/storage-user) when you want to persist a value across conversations for a\nsingle verified user. For example, a game can save a user's high score in user\nstorage and present the high score in the welcome message each time the user\nstarts a new conversation.\n\nHome storage\n\nUse [home storage](/assistant/conversational/storage-home) when you want to persist a value across conversations for\ndevices in a single household (based on [Home Graph](/assistant/smarthome/concepts/homegraph)). Home storage isn't\nspecific to any particular user, so any user in the household can contribute\ntowards it. When using home storage, Google additionally presents a notification\nonce to verified users, and on each invocation by guest users (up to once per 10\nminutes)."]]