[
 
  {
    "id": "9a1dc226-eb54-4ad9-aef6-638f532d75ff",
    "name": "ai_tax_bot",
    "code": "ai_tax_bot",
    "kind_name": "chat",
    "debugEnabled": false,
    "components": [
      {
        "id": "8e68b5c7-1dbc-dded-c6a3-7567a831a79b",
        "name": "Старт",
        "kind_name": "start",
        "properties": {
          "branch": "92eef6c1-73df-fac9-8ced-8774d531933d"
        }
      },
      {
        "id": "92eef6c1-73df-fac9-8ced-8774d531933d",
        "name": "Отправить сообщение",
        "kind_name": "sendMessage",
        "properties": {
          "branch": "fe0bbe77-a1dc-7955-3772-de8793186b7f",
          "text": "Добрый день! Вы обратились к чат-помощнику ООО \"Рога и Копыта\". Сейчас вы будете переключены на консультационного робота."
        }
      },
      {
        "id": "31837aab-0405-0ea2-376a-18bcd3096444",
        "name": "Стоп",
        "kind_name": "stop",
        "properties": {}
      },
      {
        "id": "fe0bbe77-a1dc-7955-3772-de8793186b7f",
        "name": "ИИ-ассистент старт",
        "kind_name": "AIAssistantStart",
        "properties": {
          "answer": "BotAnswer",
          "bot_code": "taxconsultant",
          "branch": "bd12e272-1031-db57-5b98-ec3fae8755d5",
          "dialog_link": "DialogLink",
          "question": "Добрый день!"
        }
      },
      {
        "id": "bd12e272-1031-db57-5b98-ec3fae8755d5",
        "name": "Отправить сообщение бота",
        "kind_name": "sendMessage",
        "properties": {
          "branch": "5c12b9b4-6dc2-bcad-aaaa-fa7d8f3ec25a",
          "text": "[BotAnswer]"
        }
      },
      {
        "id": "5c12b9b4-6dc2-bcad-aaaa-fa7d8f3ec25a",
        "name": "Получить сообщение",
        "kind_name": "receiveMessage",
        "properties": {
          "branch": "b92f6705-a2b8-9986-5d11-4890f6c8c37e",
          "branchTimeout": "b33ca7a1-9c47-981b-e1c7-52a0894ee50b",
          "timeout": 60,
          "variable": "UserQuestion"
        }
      },
      {
        "id": "b33ca7a1-9c47-981b-e1c7-52a0894ee50b",
        "name": "Таймаут",
        "kind_name": "sendMessage",
        "properties": {
          "branch": "31837aab-0405-0ea2-376a-18bcd3096444",
          "text": "Бот завершает свою работу по таймауту"
        }
      },
      {
        "id": "b92f6705-a2b8-9986-5d11-4890f6c8c37e",
        "name": "ИИ-ассистент продолжение",
        "kind_name": "AIAssistantContinue",
        "properties": {
          "answer": "BotAnswer",
          "branch": "3154d158-b09f-5d75-d8a5-7a2a63fc4e51",
          "branchError": "fb86e733-1772-e982-70b3-d1d44758d9a7",
          "dialog_link": "DialogLink",
          "question": "[UserQuestion]"
        }
      },
      {
        "id": "fb86e733-1772-e982-70b3-d1d44758d9a7",
        "name": "Ошибка",
        "kind_name": "sendMessage",
        "properties": {
          "branch": "2d7e1217-81c3-4a26-99cd-0ced52b83b94",
          "text": "Возникла ошибка при работе бота. Переключаем вас на оператора"
        }
      },
      {
        "id": "3154d158-b09f-5d75-d8a5-7a2a63fc4e51",
        "name": "Условие",
        "kind_name": "condition",
        "properties": {
          "branchFalse": "bd12e272-1031-db57-5b98-ec3fae8755d5",
          "branchTrue": "87b63bec-83d3-2a2a-1496-3ae47384d332",
          "expression": "BotAnswer == \"{FORWARD_AGENT}\""
        }
      },
      {
        "id": "87b63bec-83d3-2a2a-1496-3ae47384d332",
        "name": "Переключение на опера",
        "kind_name": "sendMessage",
        "properties": {
          "branch": "2d7e1217-81c3-4a26-99cd-0ced52b83b94",
          "text": "Поиск свободного оператора"
        }
      },
      {
        "id": "2d7e1217-81c3-4a26-99cd-0ced52b83b94",
        "name": "Переключить на очередь",
        "kind_name": "transferToACD",
        "properties": {
          "acd_code": "test_chat_queue",
          "branch": "31837aab-0405-0ea2-376a-18bcd3096444",
          "branchError": "4cc015d5-b449-74d5-429f-950bcbc62e94",
          "priority": 1,
          "weight": 1
        }
      },
      {
        "id": "4cc015d5-b449-74d5-429f-950bcbc62e94",
        "name": "Оператор не найден",
        "kind_name": "sendMessage",
        "properties": {
          "branch": "fe0bbe77-a1dc-7955-3772-de8793186b7f",
          "text": "Свободный оператор не был найден. Возвращаем вас к боту"
        }
      }
    ],
    "variables": [
      {
        "id": "713aab69-8c0a-11a9-8089-4b317ec63a03",
        "name": "AssistantId",
        "scope": "local"
      },
      {
        "id": "e8c69d6d-d808-56d8-1c84-938136b1f0df",
        "name": "BotAnswer",
        "scope": "local"
      },
      {
        "id": "1a0e52b1-9127-8a6e-c5b9-f05ec40e1e76",
        "name": "DialogLink",
        "scope": "local"
      },
      {
        "id": "b8da7d81-7042-65a6-4759-5dee3010e239",
        "name": "UserQuestion",
        "scope": "local"
      }
    ],
    "design": {
      "connectors": [
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "0",
          "customData": {
            "branchName": null
          },
          "dataKey": "3c062659-74b3-9697-6b9a-5735bb6f1dd4",
          "endConnectionPointIndex": -1,
          "endItemKey": "1",
          "key": "3",
          "locked": false,
          "points": [
            {
              "x": 6061,
              "y": 8304
            },
            {
              "x": 6062,
              "y": 9699
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 2,
          "beginItemKey": "1",
          "customData": {
            "branchName": null
          },
          "dataKey": "583d5db7-1078-b145-0aa4-93145aeaa4c5",
          "endConnectionPointIndex": 0,
          "endItemKey": "5",
          "key": "6",
          "locked": false,
          "points": [
            {
              "x": 6062,
              "y": 10449
            },
            {
              "x": 6063,
              "y": 11374
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 2,
          "beginItemKey": "5",
          "customData": {
            "branchName": null
          },
          "dataKey": "b3ba963b-d025-0496-f559-84b263c7b26d",
          "endConnectionPointIndex": 0,
          "endItemKey": "7",
          "key": "8",
          "locked": false,
          "points": [
            {
              "x": 6063,
              "y": 12124
            },
            {
              "x": 6012,
              "y": 12805
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 1,
          "beginItemKey": "7",
          "customData": {
            "branchName": null
          },
          "dataKey": "e239676a-4507-e6bd-fe1c-1ebbc507ea3c",
          "endConnectionPointIndex": 3,
          "endItemKey": "9",
          "key": "10",
          "locked": false,
          "points": [
            {
              "x": 6387,
              "y": 13180
            },
            {
              "x": 8350,
              "y": 13263
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "9",
          "customData": {
            "branchName": "branchTimeout"
          },
          "dataKey": "5c12b9b4-6dc2-bcad-aaaa-fa7d8f3ec25a/branchTimeout",
          "endConnectionPointIndex": -1,
          "endItemKey": "11",
          "key": "12",
          "locked": false,
          "points": [
            {
              "x": 8725,
              "y": 13638
            },
            {
              "x": 8688,
              "y": 15499
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "texts": {
            "0.5": "Таймаут"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "11",
          "customData": {
            "branchName": null
          },
          "dataKey": "8c48d2bf-9953-b2c8-bcb8-98ebb6116fea",
          "endConnectionPointIndex": -1,
          "endItemKey": "2",
          "key": "13",
          "locked": false,
          "points": [
            {
              "x": 8313,
              "y": 15874
            },
            {
              "x": 6317,
              "y": 15887
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "9",
          "customData": {
            "branchName": null
          },
          "dataKey": "b23bc1cc-524d-c546-9a2c-8eee85373c19",
          "endConnectionPointIndex": -1,
          "endItemKey": "14",
          "key": "15",
          "locked": false,
          "points": [
            {
              "x": 9100,
              "y": 13263
            },
            {
              "x": 10578,
              "y": 13211
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "14",
          "customData": {
            "branchName": null
          },
          "dataKey": "93d69b2e-0688-ce12-46d2-7c93a2d7e829",
          "endConnectionPointIndex": -1,
          "endItemKey": "18",
          "key": "19",
          "locked": false,
          "points": [
            {
              "x": 11328,
              "y": 13211
            },
            {
              "x": 12566,
              "y": 13204
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "14",
          "customData": {
            "branchName": "branchError"
          },
          "dataKey": "b92f6705-a2b8-9986-5d11-4890f6c8c37e/branchError",
          "endConnectionPointIndex": -1,
          "endItemKey": "16",
          "key": "20",
          "locked": false,
          "points": [
            {
              "x": 10953,
              "y": 13586
            },
            {
              "x": 10968,
              "y": 16392
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "texts": {
            "0.5": "Ошибка"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "18",
          "customData": {
            "branchName": "branchTrue"
          },
          "dataKey": "3154d158-b09f-5d75-d8a5-7a2a63fc4e51/branchTrue",
          "endConnectionPointIndex": -1,
          "endItemKey": "21",
          "key": "22",
          "locked": false,
          "points": [
            {
              "x": 13691,
              "y": 13766.5
            },
            {
              "x": 13616,
              "y": 15206
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "texts": {
            "0.5": "Да"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "16",
          "customData": {
            "branchName": null
          },
          "dataKey": "0868ea12-5e9e-5695-45d1-aafffda604c6",
          "endConnectionPointIndex": -1,
          "endItemKey": "28",
          "key": "29",
          "locked": false,
          "points": [
            {
              "x": 11343,
              "y": 16767
            },
            {
              "x": 13251,
              "y": 16819
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 2,
          "beginItemKey": "21",
          "customData": {
            "branchName": null
          },
          "dataKey": "9e24877b-0eef-5145-03bd-63d27818ec93",
          "endConnectionPointIndex": 0,
          "endItemKey": "28",
          "key": "30",
          "locked": false,
          "points": [
            {
              "x": 13616,
              "y": 15956
            },
            {
              "x": 13626,
              "y": 16444
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 2,
          "beginItemKey": "28",
          "customData": {
            "branchName": null
          },
          "dataKey": "cb6a3b0e-66d1-d725-81dd-6796b21ca9a9",
          "endConnectionPointIndex": 2,
          "endItemKey": "2",
          "key": "31",
          "locked": false,
          "points": [
            {
              "x": 13626,
              "y": 17194
            },
            {
              "x": 13620,
              "y": 18000
            },
            {
              "x": 5940,
              "y": 18000
            },
            {
              "x": 5942,
              "y": 16262
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": -1,
          "beginItemKey": "28",
          "customData": {
            "branchName": "branchError"
          },
          "dataKey": "2d7e1217-81c3-4a26-99cd-0ced52b83b94/branchError",
          "endConnectionPointIndex": -1,
          "endItemKey": "32",
          "key": "33",
          "locked": false,
          "points": [
            {
              "x": 14001,
              "y": 16819
            },
            {
              "x": 15644,
              "y": 16766
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "texts": {
            "0.5": "Ошибка"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 0,
          "beginItemKey": "32",
          "customData": {
            "branchName": null
          },
          "dataKey": "de95d66f-dd51-10bd-d195-46e2e4036169",
          "endConnectionPointIndex": 1,
          "endItemKey": "5",
          "key": "34",
          "locked": false,
          "points": [
            {
              "x": 16019,
              "y": 16391
            },
            {
              "x": 6438,
              "y": 11749
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "zIndex": 10
        },
        {
          "beginConnectionPointIndex": 0,
          "beginItemKey": "18",
          "customData": {
            "branchName": "branchFalse"
          },
          "dataKey": "3154d158-b09f-5d75-d8a5-7a2a63fc4e51/branchFalse",
          "endConnectionPointIndex": 3,
          "endItemKey": "7",
          "key": "36",
          "locked": false,
          "points": [
            {
              "x": 13691,
              "y": 12641.5
            },
            {
              "x": 13695,
              "y": 12405
            },
            {
              "x": 5280,
              "y": 12405
            },
            {
              "x": 5637,
              "y": 13180
            }
          ],
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "texts": {
            "0.5": "Нет"
          },
          "zIndex": 10
        }
      ],
      "ext": {
        "defaultLineType": "orthogonal"
      },
      "page": {
        "height": 23812,
        "pageColor": -1,
        "pageHeight": 11906,
        "pageLandscape": false,
        "pageWidth": 8391,
        "width": 16782
      },
      "shapes": [
        {
          "customData": {
            "caption": "Старт",
            "properties": {}
          },
          "dataKey": "8e68b5c7-1dbc-dded-c6a3-7567a831a79b",
          "height": 750,
          "key": "0",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "text": "",
          "type": "start",
          "width": 750,
          "x": 5686,
          "y": 7554,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Отправить сообщение",
            "properties": {
              "text": "Добрый день! Вы обратились к чат-помощнику ООО \"Рога и Копыта\". Сейчас вы будете переключены на консультационного робота."
            }
          },
          "dataKey": "92eef6c1-73df-fac9-8ced-8774d531933d",
          "height": 750,
          "key": "1",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Отправить_сообщение",
          "type": "sendMessage",
          "width": 750,
          "x": 5687,
          "y": 9699,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Стоп",
            "properties": {}
          },
          "dataKey": "31837aab-0405-0ea2-376a-18bcd3096444",
          "height": 750,
          "key": "2",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "text": "",
          "type": "stop",
          "width": 750,
          "x": 5567,
          "y": 15512,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "ИИ-ассистент старт",
            "properties": {
              "answer": "BotAnswer",
              "bot_code": "taxconsultant",
              "dialog_link": "DialogLink",
              "question": "Добрый день!"
            }
          },
          "dataKey": "fe0bbe77-a1dc-7955-3772-de8793186b7f",
          "height": 750,
          "key": "5",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "ИИ-ассистент_старт",
          "type": "AIAssistantStart",
          "width": 750,
          "x": 5688,
          "y": 11374,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Отправить сообщение бота",
            "properties": {
              "text": "[BotAnswer]"
            }
          },
          "dataKey": "bd12e272-1031-db57-5b98-ec3fae8755d5",
          "height": 750,
          "key": "7",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Отправить_сообщение_бота",
          "type": "sendMessage",
          "width": 750,
          "x": 5637,
          "y": 12805,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Получить сообщение",
            "properties": {
              "timeout": 60,
              "variable": "UserQuestion"
            }
          },
          "dataKey": "5c12b9b4-6dc2-bcad-aaaa-fa7d8f3ec25a",
          "height": 750,
          "key": "9",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Получить_сообщение",
          "type": "receiveMessage",
          "width": 750,
          "x": 8350,
          "y": 12888,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Таймаут",
            "properties": {
              "text": "Бот завершает свою работу по таймауту"
            }
          },
          "dataKey": "b33ca7a1-9c47-981b-e1c7-52a0894ee50b",
          "height": 750,
          "key": "11",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Таймаут",
          "type": "sendMessage",
          "width": 750,
          "x": 8313,
          "y": 15499,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "ИИ-ассистент продолжение",
            "properties": {
              "answer": "BotAnswer",
              "dialog_link": "DialogLink",
              "question": "[UserQuestion]"
            }
          },
          "dataKey": "b92f6705-a2b8-9986-5d11-4890f6c8c37e",
          "height": 750,
          "key": "14",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "ИИ-ассистент_продолжение",
          "type": "AIAssistantContinue",
          "width": 750,
          "x": 10578,
          "y": 12836,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Ошибка",
            "properties": {
              "text": "Возникла ошибка при работе бота. Переключаем вас на оператора"
            }
          },
          "dataKey": "fb86e733-1772-e982-70b3-d1d44758d9a7",
          "height": 750,
          "key": "16",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Ошибка",
          "type": "sendMessage",
          "width": 750,
          "x": 10593,
          "y": 16392,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Условие",
            "properties": {
              "expression": "BotAnswer == \"{FORWARD_AGENT}\""
            }
          },
          "dataKey": "3154d158-b09f-5d75-d8a5-7a2a63fc4e51",
          "height": 1125,
          "key": "18",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "text": "BotAnswer ==...",
          "type": "condition",
          "width": 2250,
          "x": 12566,
          "y": 12641.5,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Переключение на опера",
            "properties": {
              "text": "Поиск свободного оператора"
            }
          },
          "dataKey": "87b63bec-83d3-2a2a-1496-3ae47384d332",
          "height": 750,
          "key": "21",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Переключение_на_опера",
          "type": "sendMessage",
          "width": 750,
          "x": 13241,
          "y": 15206,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Переключить на очередь",
            "properties": {
              "acd_code": "test_chat_queue",
              "priority": 1,
              "weight": 1
            }
          },
          "dataKey": "2d7e1217-81c3-4a26-99cd-0ced52b83b94",
          "height": 750,
          "key": "28",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Переключить_на_очередь",
          "type": "transferToACD",
          "width": 750,
          "x": 13251,
          "y": 16444,
          "zIndex": 20
        },
        {
          "customData": {
            "caption": "Оператор не найден",
            "properties": {
              "text": "Свободный оператор не был найден. Возвращаем вас к боту"
            }
          },
          "dataKey": "4cc015d5-b449-74d5-429f-950bcbc62e94",
          "height": 750,
          "key": "32",
          "locked": false,
          "style": {
            "font-weight": "bold",
            "stroke-width": "1"
          },
          "styleText": {
            "baseline-shift": "sub",
            "paint-order": "stroke",
            "stroke": "#ffffff",
            "stroke-width": "3px"
          },
          "text": "Оператор_не_найден",
          "type": "sendMessage",
          "width": 750,
          "x": 15644,
          "y": 16391,
          "zIndex": 20
        }
      ]
    },
    "sourceCode": "// 23.07.2025 12:36:35 - time of last scenario code generated\n\nconst that = this;\nlet AssistantId = undefined; // local\nlet BotAnswer = undefined; // local\nlet DialogLink = undefined; // local\nlet UserQuestion = undefined; // local\n\nconst getAllVariables = (extra_) => {\n    const result = extra_ === false ? {} : (this.getExtraVariables() ?? {});\n    result['AssistantId'] = AssistantId;\n    result['BotAnswer'] = BotAnswer;\n    result['DialogLink'] = DialogLink;\n    result['UserQuestion'] = UserQuestion;\n    return result;\n}\n\nconst setVariable = (name_, value_) => {\n    if (name_ === 'AssistantId') { AssistantId = value_; return true; }\n    if (name_ === 'BotAnswer') { BotAnswer = value_; return true; }\n    if (name_ === 'DialogLink') { DialogLink = value_; return true; }\n    if (name_ === 'UserQuestion') { UserQuestion = value_; return true; }\n    return false;\n}\n\nconst getSessionVariables = () => {\n    const result = this.getExtraVariables() ?? {};\n    return result;\n}\n\nconst setSessionVariables = (values_) => {\n    if (!values_) return;\n}\n\nconst Start = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Старт\");\n\t{ if (!this.stopped) await Otpravit__soobshchenie(); }\n}\n\nconst Otpravit__soobshchenie = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Отправить сообщение\");\n\tawait this.sendText('Добрый день! Вы обратились к чат-помощнику ООО \"Рога и Копыта\". Сейчас вы будете переключены на консультационного робота.');\n\t{ if (!this.stopped) await II_assistent_start(); }\n}\n\nconst Stop = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Стоп\");\n\tthis.stop(); // scenario finished by stop component;\n}\n\nconst II_assistent_start = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"ИИ-ассистент старт\");\n\ttry {\n\t                const result = await this.aiCreateDialog(\"taxconsultant\", \"Добрый день!\");\n\t    BotAnswer = result?.answer;\n\t    DialogLink = result?.dialog_link;\n\t    { if (!this.stopped) await Otpravit__soobshchenie_bota(); }\n\t}\n\tcatch (e) {\n\t    { this.setBranchInfo(\"Error\"); { if (!this.stopped) await Otpravit__soobshchenie_bota(); } }\n\t}\n}\n\nconst Otpravit__soobshchenie_bota = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Отправить сообщение бота\");\n\tawait this.sendText(this.expr(\"[BotAnswer]\", getAllVariables()));\n\t{ if (!this.stopped) await Poluchit__soobshchenie(); }\n}\n\nconst Poluchit__soobshchenie = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Получить сообщение\");\n\tUserQuestion = await this.waitForMessage(60*1000);\n\tif (UserQuestion)\n\t\t{ if (!this.stopped) await II_assistent_prodolghenie(); }\n\telse\n\t\t{ this.setBranchInfo(\"Timeout\"); { if (!this.stopped) await Taymaut(); } }\n}\n\nconst Taymaut = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Таймаут\");\n\tawait this.sendText(\"Бот завершает свою работу по таймауту\");\n\t{ if (!this.stopped) await Stop(); }\n}\n\nconst II_assistent_prodolghenie = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"ИИ-ассистент продолжение\");\n\ttry {\n\t                const result = await this.aiContinueDialog(DialogLink, this.expr(\"[UserQuestion]\", getAllVariables()));\n\t    BotAnswer = result?.answer;\n\t    { if (!this.stopped) await Uslovie(); }\n\t}\n\tcatch (e) {\n\t    { this.setBranchInfo(\"Error\"); { if (!this.stopped) await Oshibka(); } }\n\t}\n}\n\nconst Oshibka = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Ошибка\");\n\tawait this.sendText(\"Возникла ошибка при работе бота. Переключаем вас на оператора\");\n\t{ if (!this.stopped) await Perekljuchit__na_ochered_(); }\n}\n\nconst Uslovie = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Условие\");\n\tif (eval('BotAnswer == \"{FORWARD_AGENT}\"'))\n\t\t{ this.setBranchInfo(\"True\"); { if (!this.stopped) await Perekljuchenie_na_opera(); } }\n\telse\n\t\t{ this.setBranchInfo(\"False\"); { if (!this.stopped) await Otpravit__soobshchenie_bota(); } }\n}\n\nconst Perekljuchenie_na_opera = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Переключение на опера\");\n\tawait this.sendText(\"Поиск свободного оператора\");\n\t{ if (!this.stopped) await Perekljuchit__na_ochered_(); }\n}\n\nconst Perekljuchit__na_ochered_ = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Переключить на очередь\");\n\tconst result = await this.transferToACD(`test_chat_queue`, 1, 1);\n\tif (result == 'accepted')\n\t\t{ if (!this.stopped) await Stop(); }\n\telse if (result == 'error')\n\t\t{ this.setBranchInfo(\"Error\"); { if (!this.stopped) await Otpravit__soobshchenie_1(); } }\n\telse\n\t\t{ this.setBranchInfo(\"Error\"); { if (!this.stopped) await Otpravit__soobshchenie_1(); } }\n}\n\nconst Otpravit__soobshchenie_1 = async () => {\n\tthis.setComponentInfo(\"ai_tax_bot\", \"Отправить сообщение 1\");\n\tawait this.sendText(\"Свободный оператор не был найден. Возвращаем вас к боту\");\n\t{ if (!this.stopped) await II_assistent_start(); }\n}\n\nawait Start();\nreturn getSessionVariables();"
  }
]