התכונה 'פעולות שיחה' הוצאה משימוש ב-13 ביוני 2023.
כאן תוכלו לקרוא מידע נוסף על ההוצאה משימוש של 'פעולות שיחה'.
ConditionalEvent
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מתעד אירועים שמופעלים כתוצאה מתנאי שמתקיים.
ייצוג YAML |
condition: string
transitionToScene: string
handler:
object (EventHandler ) |
שדות |
condition |
string
חובה. תנאי סינון כדי שהאירוע הזה יופעל. אם התנאי מקבל את הערך True, הפרמטר handler המשויך יופעל. ההפניות למשתנים הבאות נתמכות: $session - להפניה לנתונים באחסון של סשנים. $user – הפניה לנתונים באחסון של המשתמש. האופרטורים הבוליאניים הבאים נתמכים (עם דוגמאות): && - session.params.counter > 0 && session.params.counter < 100 || - session.params.foo == "John" || session.params.counter == "Adam" ! - !(session.params.counter == 5) ההשוואות הבאות נתמכות: == , != , < , > , <= , >= האופרטורים הבאים של רשימות ומחרוזות נתמכים (עם דוגמאות): in - "Watermelon" session.params.fruitList size - size(session.params.fruitList) > 2 substring - session.params.fullName.contains("John")
|
transitionToScene |
string
זה שינוי אופציונלי. הסצנה של היעד שאליו השיחה צריכה לקפוץ כשמעריכים את התנאי המשויך כ-True. המצב של הסצנה הנוכחית מושמד במהלך המעבר.
|
handler |
object (EventHandler )
זה שינוי אופציונלי. הגורם המטפל באירועים שמופעל כשהתנאי המשויך מוערך ל-true . צריך להתבצע לפני המעבר לסצנת היעד. האפשרות הזו שימושית ליצירת הנחיות בתגובה לאירועים.
|
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eYAML is used to represent events that are triggered based on a true condition.\u003c/p\u003e\n"],["\u003cp\u003eEvents can be triggered based on conditions using variables like \u003ccode\u003e$session\u003c/code\u003e and \u003ccode\u003e$user\u003c/code\u003e, boolean operators, and comparisons.\u003c/p\u003e\n"],["\u003cp\u003eOptionally, you can define a destination scene for the conversation to jump to when the condition is true.\u003c/p\u003e\n"],["\u003cp\u003eEvent handlers can be defined to execute before transitioning to a new scene, allowing for the generation of prompts.\u003c/p\u003e\n"]]],[],null,["# ConditionalEvent\n\n- [YAML representation](#SCHEMA_REPRESENTATION)\n\nRegisters events that trigger as the result of a true condition.\n\n| YAML representation ||\n|--------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` condition: string transitionToScene: string handler: object (/assistant/actionssdk/reference/rest/Shared.Types/EventHandler) ``` |\n\n| Fields ||\n|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `condition` | `string` Required. Filter condition for this event to trigger. If condition is evaluated to true then the associated `handler` will be triggered. The following variable references are supported: `$session` - To reference data in session storage. `$user` - To reference data in user storage. The following boolean operators are supported (with examples): `&&` - `session.params.counter \u003e 0 && session.params.counter \u003c 100` `||` - `session.params.foo == \"John\" || session.params.counter == \"Adam\"` `!` - `!(session.params.counter == 5)` The following comparisons are supported: `==`, `!=`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=` The following list and string operators are supported (with examples): `in` - \"Watermelon\" in `session.params.fruitList` `size` - `size(session.params.fruitList) \u003e 2` `substring` - `session.params.fullName.contains(\"John\")` |\n| `transitionToScene` | `string` Optional. Destination scene which the conversation should jump to when the associated condition is evaluated to true. 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 associated condition is evaluated to `true`. Should execute before transitioning to the destination scene. Useful to generate Prompts in response to events. |"]]