تم إيقاف إجراءات المحادثات نهائيًا في 13 حزيران (يونيو) 2023. لمزيد من المعلومات، يُرجى الاطّلاع على
إنهاء إجراءات المحادثة.
ConditionalEvent
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
لتسجيل الأحداث التي يتم تشغيلها كنتيجة لشرط صحيح.
تمثيل YAML |
condition: string
transitionToScene: string
handler:
object (EventHandler ) |
الحقول |
condition |
string
مطلوب. شرط الفلتر لتشغيل هذا الحدث إذا تم تقييم الشرط على "صحيح"، سيتم تشغيل سمة handler المرتبطة. يُسمح باستخدام مراجع المتغيّرات التالية: $session - للإشارة إلى البيانات في مساحة تخزين الجلسة. $user : للإشارة إلى البيانات في مساحة تخزين المستخدم يمكن استخدام عوامل التشغيل المنطقية التالية (مع أمثلة): && - session.params.counter > 0 && session.params.counter < 100 || - session.params.foo == "John" || session.params.counter == "Adam" ! - !(session.params.counter == 5) المقارنات التالية متاحة: == و!= و< و> و<= و>= ويمكن استخدام القائمة التالية وعوامل السلسلة (مع أمثلة): in - "البطيخ" في session.params.fruitList size - size(session.params.fruitList) > 2 substring - session.params.fullName.contains("John")
|
transitionToScene |
string
اختياريّ. مشهد الوجهة الذي يجب أن تنتقل المحادثة إليه عندما يتم تقييم الشرط المرتبط على أنه "صحيح". يتم تدمير حالة المشهد الحالي عند الانتقال.
|
handler |
object (EventHandler )
اختياريّ. معالج الحدث الذي يتم تشغيله عند تقييم الشرط المرتبط إلى true يجب تنفيذه قبل الانتقال إلى مشهد الوجهة. يمكن الاستفادة من إنشاء الطلبات استجابةً للأحداث.
|
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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. |"]]