GlobalIntentEvent
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
定义一个全局 intent 处理程序。全局 intent 事件的作用域限定为整个 Actions 项目,并可能会被场景中的 intent 处理程序替换。intent 名称在 Actions 项目中必须是唯一的。
在会话期间可随时匹配全局意图,从而允许用户访问“获取帮助”等常用流程或“返回首页”还可用于在用户调用 Action 时,通过深层链接将用户引导至特定流程。
请注意,intent 名称在文件的名称中指定。
YAML 表示法 |
transitionToScene: string
handler:
object (EventHandler ) |
字段 |
transitionToScene |
string
可选。对话应跳转到的目标场景。当前场景的状态会在转场时被销毁。
|
handler |
object (EventHandler )
可选。匹配 intent 时触发的事件处理脚本。应在过渡到目标场景之前执行。可用于生成提示以响应事件。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eGlobal intent handlers are defined in YAML and manage intents for the entire Actions project, potentially overridden by scene-specific handlers.\u003c/p\u003e\n"],["\u003cp\u003eThese intents enable users to access universal flows like help or home and facilitate deep linking into specific parts of the Action.\u003c/p\u003e\n"],["\u003cp\u003eA global intent handler can optionally transition to a specified scene, discarding the current scene's state, and trigger an event handler for prompt generation.\u003c/p\u003e\n"]]],[],null,["# GlobalIntentEvent\n\n- [YAML representation](#SCHEMA_REPRESENTATION)\n\nDefines a global intent handler. Global intent events are scoped to the entire Actions project and may be overridden by intent handlers in a scene. Intent names must be unique within an Actions project.\n\nGlobal intents can be matched anytime during a session, allowing users to access common flows like \"get help\" or \"go back home.\" They can also be used to deep link users into specific flows when they invoke an Action.\n\nNote, the intent name is specified in the name of the file.\n\n| YAML representation ||\n|--------------------------------------------------------------------------------------------------------------------|---|\n| ``` transitionToScene: string handler: object (/assistant/actionssdk/reference/rest/Shared.Types/EventHandler) ``` |\n\n| Fields ||\n|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `transitionToScene` | `string` Optional. Destination scene which the conversation should jump to. The state of the current scene is destroyed on the transition. |\n| `handler` | `object (`[EventHandler](/assistant/actionssdk/reference/rest/Shared.Types/EventHandler)`)` Optional. Event handler which is triggered when the intent is matched. Should execute before transitioning to the destination scene. Useful to generate Prompts in response to events. |"]]