salute-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 aaraevskiy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: salute-api
3
+ Version: 0.1.0
4
+ Summary: Shared FastAPI runtime for Salute NLP scenarios
5
+ Keywords: salute,fastapi,smartapp,nlp
6
+ Author: aaraevskiy
7
+ Author-email: aaraevskiy <aaraevskiy@sberdevices.ru>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Framework :: FastAPI
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Typing :: Typed
20
+ Requires-Dist: fastapi>=0.128.0
21
+ Requires-Dist: httpx>=0.28.1
22
+ Requires-Dist: pydantic>=2.13.5
23
+ Requires-Dist: redis>=7.0.0
24
+ Requires-Dist: sentry-sdk>=2.19.0
25
+ Requires-Python: >=3.14
26
+ Project-URL: Homepage, https://pypi.org/project/salute-api/
27
+ Description-Content-Type: text/markdown
28
+
29
+ # salute-api
30
+
31
+ Shared FastAPI runtime for Salute NLP scenarios: webhook, health, Pydantic message models, device-aware logging, and a MetricsSender protocol.
32
+
33
+ Install from PyPI:
34
+
35
+ ```bash
36
+ pip install salute-api
37
+ # or
38
+ uv add salute-api
39
+ ```
40
+
41
+ Quiz apps can still path-depend on a local checkout:
42
+
43
+ ```toml
44
+ dependencies = ["salute-api"]
45
+
46
+ [tool.uv.sources]
47
+ salute-api = { path = "../salute-api", editable = true }
48
+ ```
49
+
50
+ ## Layout
51
+
52
+ ```
53
+ src/salute_api/ FastAPI factory, models, logging, metrics, scenario walker
54
+ tests/ contract and logging tests
55
+ ci/pipeline.py release version and API compatibility checks
56
+ ```
57
+
58
+ Ruff and ty settings in this `pyproject.toml` are the shared baseline. Apps extend the ruff config with:
59
+
60
+ ```toml
61
+ [tool.ruff]
62
+ extend = "../salute-api/pyproject.toml"
63
+ ```
64
+
65
+ ## Checks
66
+
67
+ ```bash
68
+ uv sync
69
+ uv run ruff check .
70
+ uv run ruff format --check .
71
+ uv run ty check src tests
72
+ uv run pytest
73
+ uv run python ci/pipeline.py check
74
+ ```
75
+
76
+ ## Release
77
+
78
+ `version` in `pyproject.toml` and `__version__` in `src/salute_api/__init__.py` must be the same numeric `x.x.x`. On the default branch, GitLab CI lints, tests, classifies the API diff as patch, minor, or major, writes that version, rebuilds, and waits. The `deploy` job is manual. It tags `vX.Y.Z` and uploads `dist/` to PyPI.
79
+
80
+ Set masked CI variables before deploying:
81
+
82
+ - `UV_PUBLISH_TOKEN` — PyPI API token from <https://pypi.org/manage/account/token/>
83
+ - `GITLAB_TOKEN` — project token with `write_repository`, used to push the release commit and tag
84
+
85
+ Tag pipelines are skipped, so the tag push does not publish again.
86
+
87
+ Local build:
88
+
89
+ ```bash
90
+ uv build
91
+ uv publish
92
+ # or with an explicit token:
93
+ # uv publish --token $UV_PUBLISH_TOKEN
94
+ ```
@@ -0,0 +1,66 @@
1
+ # salute-api
2
+
3
+ Shared FastAPI runtime for Salute NLP scenarios: webhook, health, Pydantic message models, device-aware logging, and a MetricsSender protocol.
4
+
5
+ Install from PyPI:
6
+
7
+ ```bash
8
+ pip install salute-api
9
+ # or
10
+ uv add salute-api
11
+ ```
12
+
13
+ Quiz apps can still path-depend on a local checkout:
14
+
15
+ ```toml
16
+ dependencies = ["salute-api"]
17
+
18
+ [tool.uv.sources]
19
+ salute-api = { path = "../salute-api", editable = true }
20
+ ```
21
+
22
+ ## Layout
23
+
24
+ ```
25
+ src/salute_api/ FastAPI factory, models, logging, metrics, scenario walker
26
+ tests/ contract and logging tests
27
+ ci/pipeline.py release version and API compatibility checks
28
+ ```
29
+
30
+ Ruff and ty settings in this `pyproject.toml` are the shared baseline. Apps extend the ruff config with:
31
+
32
+ ```toml
33
+ [tool.ruff]
34
+ extend = "../salute-api/pyproject.toml"
35
+ ```
36
+
37
+ ## Checks
38
+
39
+ ```bash
40
+ uv sync
41
+ uv run ruff check .
42
+ uv run ruff format --check .
43
+ uv run ty check src tests
44
+ uv run pytest
45
+ uv run python ci/pipeline.py check
46
+ ```
47
+
48
+ ## Release
49
+
50
+ `version` in `pyproject.toml` and `__version__` in `src/salute_api/__init__.py` must be the same numeric `x.x.x`. On the default branch, GitLab CI lints, tests, classifies the API diff as patch, minor, or major, writes that version, rebuilds, and waits. The `deploy` job is manual. It tags `vX.Y.Z` and uploads `dist/` to PyPI.
51
+
52
+ Set masked CI variables before deploying:
53
+
54
+ - `UV_PUBLISH_TOKEN` — PyPI API token from <https://pypi.org/manage/account/token/>
55
+ - `GITLAB_TOKEN` — project token with `write_repository`, used to push the release commit and tag
56
+
57
+ Tag pipelines are skipped, so the tag push does not publish again.
58
+
59
+ Local build:
60
+
61
+ ```bash
62
+ uv build
63
+ uv publish
64
+ # or with an explicit token:
65
+ # uv publish --token $UV_PUBLISH_TOKEN
66
+ ```
@@ -0,0 +1,92 @@
1
+ [project]
2
+ name = "salute-api"
3
+ version = "0.1.0"
4
+ description = "Shared FastAPI runtime for Salute NLP scenarios"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.14"
9
+ keywords = [
10
+ "salute",
11
+ "fastapi",
12
+ "smartapp",
13
+ "nlp",
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Framework :: FastAPI",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Programming Language :: Python :: 3 :: Only",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ "Typing :: Typed",
26
+ ]
27
+ dependencies = [
28
+ "fastapi>=0.128.0",
29
+ "httpx>=0.28.1",
30
+ "pydantic>=2.13.5",
31
+ "redis>=7.0.0",
32
+ "sentry-sdk>=2.19.0",
33
+ ]
34
+
35
+ [[project.authors]]
36
+ name = "aaraevskiy"
37
+ email = "aaraevskiy@sberdevices.ru"
38
+
39
+ [project.urls]
40
+ Homepage = "https://pypi.org/project/salute-api/"
41
+
42
+ [build-system]
43
+ requires = ["uv_build>=0.12.0,<0.13.0"]
44
+ build-backend = "uv_build"
45
+
46
+ [dependency-groups]
47
+ dev = [
48
+ "pytest>=9.1.1",
49
+ "pytest-asyncio>=1.3.0",
50
+ "ruff>=0.16.7",
51
+ "ty>=0.0.1",
52
+ ]
53
+
54
+ [tool.ruff]
55
+ target-version = "py314"
56
+ line-length = 100
57
+ src = [
58
+ "src",
59
+ "tests",
60
+ ]
61
+
62
+ [tool.ruff.lint]
63
+ select = [
64
+ "E",
65
+ "W",
66
+ "F",
67
+ "I",
68
+ "B",
69
+ "UP",
70
+ "SIM",
71
+ "RUF",
72
+ ]
73
+ ignore = [
74
+ "RUF001",
75
+ "RUF002",
76
+ "RUF003",
77
+ ]
78
+
79
+ [tool.ruff.format]
80
+ quote-style = "double"
81
+ indent-style = "space"
82
+
83
+ [tool.ty.environment]
84
+ python-version = "3.14"
85
+
86
+ [tool.pytest.ini_options]
87
+ testpaths = ["tests"]
88
+ pythonpath = [
89
+ ".",
90
+ "src",
91
+ ]
92
+ asyncio_mode = "auto"
@@ -0,0 +1,85 @@
1
+ [project]
2
+ name = "salute-api"
3
+ version = "0.1.0"
4
+ description = "Shared FastAPI runtime for Salute NLP scenarios"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "aaraevskiy", email = "aaraevskiy@sberdevices.ru" },
10
+ ]
11
+ requires-python = ">=3.14"
12
+ keywords = [
13
+ "salute",
14
+ "fastapi",
15
+ "smartapp",
16
+ "nlp",
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "Framework :: FastAPI",
21
+ "Intended Audience :: Developers",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Programming Language :: Python :: 3 :: Only",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "fastapi>=0.128.0",
32
+ "httpx>=0.28.1",
33
+ "pydantic>=2.13.5",
34
+ "redis>=7.0.0",
35
+ "sentry-sdk>=2.19.0",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://pypi.org/project/salute-api/"
40
+
41
+ [build-system]
42
+ requires = ["uv_build>=0.12.0,<0.13.0"]
43
+ build-backend = "uv_build"
44
+
45
+ [dependency-groups]
46
+ dev = [
47
+ "pytest>=9.1.1",
48
+ "pytest-asyncio>=1.3.0",
49
+ "ruff>=0.16.7",
50
+ "ty>=0.0.1",
51
+ ]
52
+
53
+ [tool.ruff]
54
+ target-version = "py314"
55
+ line-length = 100
56
+ src = ["src", "tests"]
57
+
58
+ [tool.ruff.lint]
59
+ select = [
60
+ "E",
61
+ "W",
62
+ "F",
63
+ "I",
64
+ "B",
65
+ "UP",
66
+ "SIM",
67
+ "RUF",
68
+ ]
69
+ ignore = [
70
+ "RUF001",
71
+ "RUF002",
72
+ "RUF003",
73
+ ]
74
+
75
+ [tool.ruff.format]
76
+ quote-style = "double"
77
+ indent-style = "space"
78
+
79
+ [tool.ty.environment]
80
+ python-version = "3.14"
81
+
82
+ [tool.pytest.ini_options]
83
+ testpaths = ["tests"]
84
+ pythonpath = [".", "src"]
85
+ asyncio_mode = "auto"
@@ -0,0 +1,88 @@
1
+ """Reusable Salute scenario runtime for Python smartapps."""
2
+
3
+ from salute_api.connector import handle_nlp_request
4
+ from salute_api.helpers import (
5
+ action_id,
6
+ is_screen_on,
7
+ legacy_action,
8
+ one_of,
9
+ suggest_button,
10
+ write_and_pronounce,
11
+ )
12
+ from salute_api.i18n import i18n
13
+ from salute_api.intents import create_intents, load_intents_model, lookup_missing_variables
14
+ from salute_api.logging import configure_logging, get_log_info, logger
15
+ from salute_api.matchers import create_matchers
16
+ from salute_api.metrics import MetricsSender, NoOpMetricsSender, create_metrics_sender
17
+ from salute_api.models import SaluteNlpRequest, SaluteNlpResponse
18
+ from salute_api.process import BoundProcess, ProcessType, bind_process
19
+ from salute_api.recognizer import IntentsRecognizer, Recognizer, SmartAppBrainRecognizer
20
+ from salute_api.request import SaluteRequest, create_salute_request
21
+ from salute_api.response import SaluteResponse, create_salute_response, make_image_card
22
+ from salute_api.scenario import (
23
+ Dispatch,
24
+ Handler,
25
+ ScenarioContext,
26
+ ScenarioState,
27
+ create_scenario_walker,
28
+ create_system_scenario,
29
+ create_user_scenario,
30
+ never,
31
+ )
32
+ from salute_api.server import create_salute_app
33
+ from salute_api.storage import MemoryStorage, RedisStorage, SessionStorage, empty_session
34
+ from salute_api.types import Inference, Intent, SaluteSession, Variant
35
+
36
+ __version__ = "0.1.0"
37
+
38
+ __all__ = [
39
+ "BoundProcess",
40
+ "Dispatch",
41
+ "Handler",
42
+ "Inference",
43
+ "Intent",
44
+ "IntentsRecognizer",
45
+ "MemoryStorage",
46
+ "MetricsSender",
47
+ "NoOpMetricsSender",
48
+ "ProcessType",
49
+ "Recognizer",
50
+ "RedisStorage",
51
+ "SaluteNlpRequest",
52
+ "SaluteNlpResponse",
53
+ "SaluteRequest",
54
+ "SaluteResponse",
55
+ "SaluteSession",
56
+ "ScenarioContext",
57
+ "ScenarioState",
58
+ "SessionStorage",
59
+ "SmartAppBrainRecognizer",
60
+ "Variant",
61
+ "__version__",
62
+ "action_id",
63
+ "bind_process",
64
+ "configure_logging",
65
+ "create_intents",
66
+ "create_matchers",
67
+ "create_metrics_sender",
68
+ "create_salute_app",
69
+ "create_salute_request",
70
+ "create_salute_response",
71
+ "create_scenario_walker",
72
+ "create_system_scenario",
73
+ "create_user_scenario",
74
+ "empty_session",
75
+ "get_log_info",
76
+ "handle_nlp_request",
77
+ "i18n",
78
+ "is_screen_on",
79
+ "legacy_action",
80
+ "load_intents_model",
81
+ "logger",
82
+ "lookup_missing_variables",
83
+ "make_image_card",
84
+ "never",
85
+ "one_of",
86
+ "suggest_button",
87
+ "write_and_pronounce",
88
+ ]
@@ -0,0 +1,64 @@
1
+ """Turn a raw NLP JSON body into a Salute response payload."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import time
6
+ from collections.abc import Awaitable, Callable
7
+ from typing import Any
8
+
9
+ from salute_api.device import device_scope, merge_device
10
+ from salute_api.logging import logger, request_log_fields, response_log_fields
11
+ from salute_api.metrics import MetricsSender, NoOpMetricsSender
12
+ from salute_api.request import create_salute_request
13
+ from salute_api.response import create_salute_response
14
+ from salute_api.storage import SessionStorage
15
+ from salute_api.types import SaluteSession
16
+
17
+ Walker = Callable[..., Awaitable[None]]
18
+ AfterHook = Callable[..., Awaitable[None] | None]
19
+
20
+
21
+ async def handle_nlp_request(
22
+ body: dict[str, Any],
23
+ *,
24
+ walker: Walker,
25
+ storage: SessionStorage,
26
+ after: AfterHook | None = None,
27
+ metrics: MetricsSender | None = None,
28
+ ) -> dict[str, Any]:
29
+ sender = metrics or NoOpMetricsSender()
30
+ started = time.perf_counter()
31
+ payload = body.get("payload") if isinstance(body.get("payload"), dict) else None
32
+ with device_scope(payload):
33
+ req = create_salute_request(body)
34
+ res = create_salute_response(body)
35
+ fields = request_log_fields(req)
36
+ session_id = fields.get("userId") or "anonymous"
37
+ logger.info("nlp request", extra=fields)
38
+ sender.increment("nlp.request")
39
+ try:
40
+ session: SaluteSession = await storage.resolve(session_id)
41
+ await walker(req=req, res=res, session=session)
42
+ response_payload = res.message.get("payload")
43
+ if isinstance(response_payload, dict):
44
+ merge_device(response_payload)
45
+ if after is not None:
46
+ result = after(req, session)
47
+ if result is not None:
48
+ await result
49
+ await storage.save(session_id, session)
50
+ except Exception as exc:
51
+ logger.exception("nlp request failed", extra=fields)
52
+ sender.error("nlp.request", exc)
53
+ raise
54
+ duration_ms = round((time.perf_counter() - started) * 1000, 2)
55
+ sender.timing("nlp.request", duration_ms)
56
+ logger.info(
57
+ "nlp response",
58
+ extra={
59
+ **request_log_fields(req),
60
+ **response_log_fields(res.message),
61
+ "durationMs": duration_ms,
62
+ },
63
+ )
64
+ return res.message
@@ -0,0 +1,87 @@
1
+ """Request-scoped device identity via contextvars.
2
+
3
+ When a Salute payload includes `device`, every log line for that call gets
4
+ `deviceId` / `surface` / `platform`. Missing device is fine: logs still emit.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from collections.abc import Iterator, Mapping
10
+ from contextlib import contextmanager
11
+ from contextvars import ContextVar, Token
12
+ from typing import Any
13
+
14
+ device_id_var: ContextVar[str | None] = ContextVar("salute_device_id", default=None)
15
+ device_surface_var: ContextVar[str | None] = ContextVar("salute_device_surface", default=None)
16
+ device_platform_var: ContextVar[str | None] = ContextVar("salute_device_platform", default=None)
17
+
18
+
19
+ def device_log_fields() -> dict[str, str]:
20
+ fields: dict[str, str] = {}
21
+ device_id = device_id_var.get()
22
+ surface = device_surface_var.get()
23
+ platform = device_platform_var.get()
24
+ if device_id:
25
+ fields["deviceId"] = device_id
26
+ if surface:
27
+ fields["surface"] = surface
28
+ if platform:
29
+ fields["platform"] = platform
30
+ return fields
31
+
32
+
33
+ def extract_device(payload: Mapping[str, Any] | None) -> dict[str, str]:
34
+ if not payload:
35
+ return {}
36
+ device = payload.get("device")
37
+ if not isinstance(device, Mapping) or not device:
38
+ return {}
39
+ fields: dict[str, str] = {}
40
+ device_id = device.get("deviceId") or device.get("device_id")
41
+ surface = device.get("surface")
42
+ platform = device.get("platformType") or device.get("platform")
43
+ if device_id:
44
+ fields["deviceId"] = str(device_id)
45
+ if surface:
46
+ fields["surface"] = str(surface)
47
+ if platform:
48
+ fields["platform"] = str(platform)
49
+ return fields
50
+
51
+
52
+ def bind_device(fields: Mapping[str, str]) -> tuple[Token[str | None], ...]:
53
+ tokens = (
54
+ device_id_var.set(fields.get("deviceId")),
55
+ device_surface_var.set(fields.get("surface")),
56
+ device_platform_var.set(fields.get("platform")),
57
+ )
58
+ return tokens
59
+
60
+
61
+ def reset_device(tokens: tuple[Token[str | None], ...]) -> None:
62
+ device_id_var.reset(tokens[0])
63
+ device_surface_var.reset(tokens[1])
64
+ device_platform_var.reset(tokens[2])
65
+
66
+
67
+ def merge_device(payload: Mapping[str, Any] | None) -> None:
68
+ """Update bound device fields from a later payload (e.g. the response)."""
69
+ fields = extract_device(payload)
70
+ if not fields:
71
+ return
72
+ if "deviceId" in fields:
73
+ device_id_var.set(fields["deviceId"])
74
+ if "surface" in fields:
75
+ device_surface_var.set(fields["surface"])
76
+ if "platform" in fields:
77
+ device_platform_var.set(fields["platform"])
78
+
79
+
80
+ @contextmanager
81
+ def device_scope(payload: Mapping[str, Any] | None) -> Iterator[dict[str, str]]:
82
+ fields = extract_device(payload)
83
+ tokens = bind_device(fields)
84
+ try:
85
+ yield fields
86
+ finally:
87
+ reset_device(tokens)
@@ -0,0 +1,53 @@
1
+ """Small helpers shared by scenario apps."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Callable
6
+ from typing import Any
7
+
8
+ from salute_api.matchers import Matcher
9
+ from salute_api.request import SaluteRequest
10
+ from salute_api.response import SaluteResponse
11
+
12
+
13
+ def one_of(*matchers: Matcher) -> Matcher:
14
+ def match(req: SaluteRequest) -> bool:
15
+ return any(matcher(req) for matcher in matchers)
16
+
17
+ return match
18
+
19
+
20
+ def is_screen_on(req: SaluteRequest) -> bool:
21
+ meta = req.payload.get("meta") or {}
22
+ features = meta.get("features") or {}
23
+ screen = features.get("screen") or {}
24
+ if "enabled" in screen:
25
+ return bool(screen["enabled"])
26
+ return True
27
+
28
+
29
+ def write_and_pronounce(res: SaluteResponse, text: str) -> None:
30
+ res.append_bubble(text)
31
+ res.set_pronounce_text(text)
32
+
33
+
34
+ def action_id(expected: str) -> Callable[[SaluteRequest], bool]:
35
+ def match(req: SaluteRequest) -> bool:
36
+ server_action = req.server_action or {}
37
+ return server_action.get("action_id") == expected
38
+
39
+ return match
40
+
41
+
42
+ legacy_action = action_id
43
+
44
+
45
+ def suggest_button(title: str, action_id_value: str) -> dict[str, Any]:
46
+ return {
47
+ "title": title,
48
+ "message_name": "SERVER_ACTION",
49
+ "action": {
50
+ "type": "server_action",
51
+ "server_action": {"action_id": action_id_value},
52
+ },
53
+ }
@@ -0,0 +1,17 @@
1
+ """Reusable PRE/POST process bindings."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from salute_api.logging import log_info
6
+ from salute_api.process import BoundProcess, ProcessType
7
+ from salute_api.scenario import Dispatch, ScenarioContext
8
+
9
+ pre_log_info = BoundProcess(func=log_info, type=ProcessType.PRE)
10
+
11
+
12
+ def post_auto_listening(ctx: ScenarioContext, _dispatch: Dispatch) -> None:
13
+ if ctx.res.message.get("messageName") == "ANSWER_TO_USER":
14
+ ctx.res.set_auto_listening(True)
15
+
16
+
17
+ post_auto_listening_process = BoundProcess(func=post_auto_listening, type=ProcessType.POST)