rasa-pro 3.11.3a1.dev7__py3-none-any.whl → 3.11.5__py3-none-any.whl
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.
Potentially problematic release.
This version of rasa-pro might be problematic. Click here for more details.
- rasa/core/actions/action.py +10 -17
- rasa/core/actions/direct_custom_actions_executor.py +0 -1
- rasa/core/channels/__init__.py +0 -2
- rasa/core/channels/inspector/dist/assets/Tableau10-1b767f5e.js +1 -0
- rasa/core/channels/inspector/dist/assets/arc-f0f8bd46.js +1 -0
- rasa/core/channels/inspector/dist/assets/blockDiagram-38ab4fdb-7162c77d.js +118 -0
- rasa/core/channels/inspector/dist/assets/c4Diagram-3d4e48cf-b1d0d098.js +10 -0
- rasa/core/channels/inspector/dist/assets/channel-e265ea59.js +1 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-70f12bd4-807a1b27.js +2 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-f2320105-5238dcdb.js +2 -0
- rasa/core/channels/inspector/dist/assets/clone-21f8a43d.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-ef476ecd.js → createText-2e5e7dd3-75dfaa67.js} +1 -1
- rasa/core/channels/inspector/dist/assets/edges-e0da2a9e-df20501d.js +4 -0
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-fac75185.js → erDiagram-9861fffd-13cf4797.js} +4 -4
- rasa/core/channels/inspector/dist/assets/flowDb-956e92f1-a4991264.js +10 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-66a62f08-ccecf773.js +4 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-5c8ce12d.js +1 -0
- rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-4a651766-b5801783.js +139 -0
- rasa/core/channels/inspector/dist/assets/ganttDiagram-c361ad54-161e079a.js +257 -0
- rasa/core/channels/inspector/dist/assets/gitGraphDiagram-72cf32ee-f38e86a4.js +70 -0
- rasa/core/channels/inspector/dist/assets/graph-be6ef5d8.js +1 -0
- rasa/core/channels/inspector/dist/assets/index-3862675e-d9ce8994.js +1 -0
- rasa/core/channels/inspector/dist/assets/{index-37817b51.js → index-7794b245.js} +200 -195
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-6b731386.js → infoDiagram-f8f76790-5000a3dc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-e8579ac6.js → journeyDiagram-49397b02-8ef0a17a.js} +4 -4
- rasa/core/channels/inspector/dist/assets/katex-498eb57e.js +261 -0
- rasa/core/channels/inspector/dist/assets/layout-d649bc98.js +1 -0
- rasa/core/channels/inspector/dist/assets/{line-dc73d3fc.js → line-95add810.js} +1 -1
- rasa/core/channels/inspector/dist/assets/linear-f6025094.js +1 -0
- rasa/core/channels/inspector/dist/assets/mindmap-definition-fc14e90a-2e8531c4.js +312 -0
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-bdf5f29b.js → pieDiagram-8a3498a8-918adfdb.js} +7 -7
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-c7a0cbe4.js → quadrantDiagram-120e2f19-cbd01797.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-7ec5410f.js → requirementDiagram-deff3bca-6a8b877b.js} +2 -2
- rasa/core/channels/inspector/dist/assets/sankeyDiagram-04a897e0-c377c3fe.js +8 -0
- rasa/core/channels/inspector/dist/assets/sequenceDiagram-704730f1-ab9e9b7f.js +122 -0
- rasa/core/channels/inspector/dist/assets/stateDiagram-587899a1-5e6ae67d.js +1 -0
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-d93cdb3a-40643476.js +1 -0
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-7a4e0e61.js → styles-6aaf32cf-afb8d108.js} +1 -1
- rasa/core/channels/inspector/dist/assets/styles-9a916d00-7edc9423.js +160 -0
- rasa/core/channels/inspector/dist/assets/styles-c10674c1-c1d8f7e9.js +116 -0
- rasa/core/channels/inspector/dist/assets/svgDrawCommon-08f97a94-f494b2ef.js +1 -0
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-01ea12df.js → timeline-definition-85554ec2-11c7cdd0.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-89407137.js → xychartDiagram-e933f94c-3f191ec1.js} +3 -3
- rasa/core/channels/inspector/dist/index.html +3 -1
- rasa/core/channels/inspector/index.html +2 -0
- rasa/core/channels/inspector/package.json +10 -3
- rasa/core/channels/inspector/src/App.tsx +1 -4
- rasa/core/channels/inspector/yarn.lock +89 -99
- rasa/core/channels/socketio.py +23 -2
- rasa/core/channels/voice_ready/audiocodes.py +42 -23
- rasa/core/nlg/contextual_response_rephraser.py +9 -62
- rasa/core/policies/enterprise_search_policy.py +12 -77
- rasa/core/policies/flows/flow_executor.py +2 -26
- rasa/core/processor.py +8 -11
- rasa/dialogue_understanding/generator/command_generator.py +5 -120
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +5 -5
- rasa/dialogue_understanding/generator/llm_command_generator.py +1 -2
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +4 -50
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +0 -3
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +3 -16
- rasa/dialogue_understanding/patterns/continue_interrupted.py +9 -0
- rasa/dialogue_understanding/stack/utils.py +1 -0
- rasa/e2e_test/e2e_test_case.py +1 -2
- rasa/e2e_test/utils/e2e_yaml_utils.py +1 -1
- rasa/e2e_test/utils/io.py +1 -1
- rasa/e2e_test/utils/validation.py +2 -100
- rasa/engine/recipes/default_recipe.py +49 -63
- rasa/engine/recipes/graph_recipe.py +7 -8
- rasa/hooks.py +9 -14
- rasa/model_manager/socket_bridge.py +2 -7
- rasa/model_manager/warm_rasa_process.py +4 -9
- rasa/model_training.py +1 -2
- rasa/nlu/classifiers/fallback_classifier.py +0 -3
- rasa/plugin.py +0 -11
- rasa/server.py +40 -2
- rasa/shared/constants.py +6 -26
- rasa/shared/core/events.py +8 -8
- rasa/shared/core/flows/flow.py +4 -4
- rasa/shared/core/flows/flow_step.py +15 -10
- rasa/shared/core/flows/flow_step_links.py +20 -12
- rasa/shared/core/flows/flow_step_sequence.py +5 -3
- rasa/shared/core/flows/steps/action.py +3 -2
- rasa/shared/core/flows/steps/call.py +3 -3
- rasa/shared/core/flows/steps/collect.py +6 -3
- rasa/shared/core/flows/steps/continuation.py +3 -1
- rasa/shared/core/flows/steps/end.py +3 -1
- rasa/shared/core/flows/steps/internal.py +2 -1
- rasa/shared/core/flows/steps/link.py +5 -3
- rasa/shared/core/flows/steps/no_operation.py +5 -3
- rasa/shared/core/flows/steps/set_slots.py +3 -2
- rasa/shared/core/flows/steps/start.py +3 -1
- rasa/shared/nlu/constants.py +0 -7
- rasa/shared/providers/llm/llm_response.py +1 -42
- rasa/shared/utils/llm.py +1 -1
- rasa/shared/utils/schemas/events.py +1 -1
- rasa/shared/utils/yaml.py +5 -6
- rasa/studio/upload.py +5 -19
- rasa/telemetry.py +33 -40
- rasa/tracing/instrumentation/attribute_extractors.py +9 -12
- rasa/validator.py +41 -32
- rasa/version.py +1 -1
- {rasa_pro-3.11.3a1.dev7.dist-info → rasa_pro-3.11.5.dist-info}/METADATA +7 -7
- {rasa_pro-3.11.3a1.dev7.dist-info → rasa_pro-3.11.5.dist-info}/RECORD +106 -107
- rasa/core/channels/inspector/dist/assets/arc-861ddd57.js +0 -1
- rasa/core/channels/inspector/dist/assets/c4Diagram-d0fbc5ce-921f02db.js +0 -10
- rasa/core/channels/inspector/dist/assets/classDiagram-936ed81e-b436c4f8.js +0 -2
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-c3cb15f1-511a23cb.js +0 -2
- rasa/core/channels/inspector/dist/assets/edges-f2ad444c-f1878e0a.js +0 -4
- rasa/core/channels/inspector/dist/assets/flowDb-1972c806-201c5bbc.js +0 -6
- rasa/core/channels/inspector/dist/assets/flowDiagram-7ea5b25a-f904ae41.js +0 -4
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-b080d6f2.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-abe16c3d-1813da66.js +0 -139
- rasa/core/channels/inspector/dist/assets/ganttDiagram-9b5ea136-872af172.js +0 -266
- rasa/core/channels/inspector/dist/assets/gitGraphDiagram-99d0ae7c-34a0af5a.js +0 -70
- rasa/core/channels/inspector/dist/assets/index-2c4b9a3b-42ba3e3d.js +0 -1
- rasa/core/channels/inspector/dist/assets/layout-89e6403a.js +0 -1
- rasa/core/channels/inspector/dist/assets/linear-f5b1d2bc.js +0 -1
- rasa/core/channels/inspector/dist/assets/mindmap-definition-beec6740-82cb74fa.js +0 -109
- rasa/core/channels/inspector/dist/assets/sankeyDiagram-8f13d901-caee5554.js +0 -8
- rasa/core/channels/inspector/dist/assets/sequenceDiagram-b655622a-2935f8db.js +0 -122
- rasa/core/channels/inspector/dist/assets/stateDiagram-59f0c015-8f5d9693.js +0 -1
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-2b26beab-d565d1de.js +0 -1
- rasa/core/channels/inspector/dist/assets/styles-080da4f6-75ad421d.js +0 -110
- rasa/core/channels/inspector/dist/assets/styles-3dcbcfbf-7e764226.js +0 -159
- rasa/core/channels/inspector/dist/assets/svgDrawCommon-4835440b-4019d1bf.js +0 -1
- rasa/core/channels/studio_chat.py +0 -192
- rasa/dialogue_understanding/constants.py +0 -1
- rasa/dialogue_understanding/utils.py +0 -21
- rasa/dialogue_understanding_test/__init__.py +0 -0
- rasa/dialogue_understanding_test/constants.py +0 -15
- rasa/dialogue_understanding_test/du_test_case.py +0 -118
- rasa/dialogue_understanding_test/du_test_result.py +0 -11
- {rasa_pro-3.11.3a1.dev7.dist-info → rasa_pro-3.11.5.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.3a1.dev7.dist-info → rasa_pro-3.11.5.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.3a1.dev7.dist-info → rasa_pro-3.11.5.dist-info}/entry_points.txt +0 -0
|
@@ -2295,12 +2295,12 @@ available-typed-arrays@^1.0.5:
|
|
|
2295
2295
|
resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
|
|
2296
2296
|
integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==
|
|
2297
2297
|
|
|
2298
|
-
axios@1.
|
|
2299
|
-
version "1.
|
|
2300
|
-
resolved "https://registry.yarnpkg.com/axios/-/axios-1.
|
|
2301
|
-
integrity sha512-
|
|
2298
|
+
axios@1.7.4:
|
|
2299
|
+
version "1.7.4"
|
|
2300
|
+
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.4.tgz#4c8ded1b43683c8dd362973c393f3ede24052aa2"
|
|
2301
|
+
integrity sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==
|
|
2302
2302
|
dependencies:
|
|
2303
|
-
follow-redirects "^1.15.
|
|
2303
|
+
follow-redirects "^1.15.6"
|
|
2304
2304
|
form-data "^4.0.0"
|
|
2305
2305
|
proxy-from-env "^1.1.0"
|
|
2306
2306
|
|
|
@@ -2386,12 +2386,12 @@ brace-expansion@^1.1.7:
|
|
|
2386
2386
|
balanced-match "^1.0.0"
|
|
2387
2387
|
concat-map "0.0.1"
|
|
2388
2388
|
|
|
2389
|
-
braces@^3.0.2:
|
|
2390
|
-
version "3.0.
|
|
2391
|
-
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.
|
|
2392
|
-
integrity sha512-
|
|
2389
|
+
braces@3.0.3, braces@^3.0.2:
|
|
2390
|
+
version "3.0.3"
|
|
2391
|
+
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
|
|
2392
|
+
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
|
|
2393
2393
|
dependencies:
|
|
2394
|
-
fill-range "^7.
|
|
2394
|
+
fill-range "^7.1.1"
|
|
2395
2395
|
|
|
2396
2396
|
browserslist@^4.21.9:
|
|
2397
2397
|
version "4.22.1"
|
|
@@ -2576,6 +2576,11 @@ commander@7:
|
|
|
2576
2576
|
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
|
|
2577
2577
|
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
|
|
2578
2578
|
|
|
2579
|
+
commander@^8.3.0:
|
|
2580
|
+
version "8.3.0"
|
|
2581
|
+
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
|
2582
|
+
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
|
2583
|
+
|
|
2579
2584
|
compute-scroll-into-view@3.0.3:
|
|
2580
2585
|
version "3.0.3"
|
|
2581
2586
|
resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.0.3.tgz#c418900a5c56e2b04b885b54995df164535962b1"
|
|
@@ -2610,13 +2615,6 @@ cose-base@^1.0.0:
|
|
|
2610
2615
|
dependencies:
|
|
2611
2616
|
layout-base "^1.0.0"
|
|
2612
2617
|
|
|
2613
|
-
cose-base@^2.2.0:
|
|
2614
|
-
version "2.2.0"
|
|
2615
|
-
resolved "https://registry.yarnpkg.com/cose-base/-/cose-base-2.2.0.tgz#1c395c35b6e10bb83f9769ca8b817d614add5c01"
|
|
2616
|
-
integrity sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g==
|
|
2617
|
-
dependencies:
|
|
2618
|
-
layout-base "^2.0.0"
|
|
2619
|
-
|
|
2620
2618
|
cosmiconfig@^7.0.0:
|
|
2621
2619
|
version "7.1.0"
|
|
2622
2620
|
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6"
|
|
@@ -2646,10 +2644,10 @@ create-require@^1.1.0:
|
|
|
2646
2644
|
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
|
|
2647
2645
|
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
|
|
2648
2646
|
|
|
2649
|
-
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
|
|
2650
|
-
version "7.0.
|
|
2651
|
-
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.
|
|
2652
|
-
integrity sha512-
|
|
2647
|
+
cross-spawn@7.0.5, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
|
|
2648
|
+
version "7.0.5"
|
|
2649
|
+
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.5.tgz#910aac880ff5243da96b728bc6521a5f6c2f2f82"
|
|
2650
|
+
integrity sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==
|
|
2653
2651
|
dependencies:
|
|
2654
2652
|
path-key "^3.1.0"
|
|
2655
2653
|
shebang-command "^2.0.0"
|
|
@@ -2696,20 +2694,10 @@ cytoscape-cose-bilkent@^4.1.0:
|
|
|
2696
2694
|
dependencies:
|
|
2697
2695
|
cose-base "^1.0.0"
|
|
2698
2696
|
|
|
2699
|
-
cytoscape
|
|
2700
|
-
version "
|
|
2701
|
-
resolved "https://registry.yarnpkg.com/cytoscape
|
|
2702
|
-
integrity sha512-
|
|
2703
|
-
dependencies:
|
|
2704
|
-
cose-base "^2.2.0"
|
|
2705
|
-
|
|
2706
|
-
cytoscape@^3.23.0:
|
|
2707
|
-
version "3.27.0"
|
|
2708
|
-
resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.27.0.tgz#5141cd694570807c91075b609181bce102e0bb88"
|
|
2709
|
-
integrity sha512-pPZJilfX9BxESwujODz5pydeGi+FBrXq1rcaB1mfhFXXFJ9GjE6CNndAk+8jPzoXGD+16LtSS4xlYEIUiW4Abg==
|
|
2710
|
-
dependencies:
|
|
2711
|
-
heap "^0.2.6"
|
|
2712
|
-
lodash "^4.17.21"
|
|
2697
|
+
cytoscape@^3.28.1:
|
|
2698
|
+
version "3.31.0"
|
|
2699
|
+
resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.31.0.tgz#cffbbb8ca51db01cbf360e0cf59088db6d429837"
|
|
2700
|
+
integrity sha512-zDGn1K/tfZwEnoGOcHc0H4XazqAAXAuDpcYw9mUnUjATjqljyCNGJv8uEvbvxGaGHaVshxMecyl6oc6uKzRfbw==
|
|
2713
2701
|
|
|
2714
2702
|
"d3-array@1 - 2":
|
|
2715
2703
|
version "2.12.1"
|
|
@@ -3170,20 +3158,20 @@ domexception@^4.0.0:
|
|
|
3170
3158
|
dependencies:
|
|
3171
3159
|
webidl-conversions "^7.0.0"
|
|
3172
3160
|
|
|
3173
|
-
dompurify@^3.0.5:
|
|
3174
|
-
version "3.
|
|
3175
|
-
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.
|
|
3176
|
-
integrity sha512-
|
|
3161
|
+
dompurify@3.1.3, "dompurify@^3.0.5 <3.1.7":
|
|
3162
|
+
version "3.1.3"
|
|
3163
|
+
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.3.tgz#cfe3ce4232c216d923832f68f2aa18b2fb9bd223"
|
|
3164
|
+
integrity sha512-5sOWYSNPaxz6o2MUPvtyxTTqR4D3L77pr5rUQoWgD5ROQtVIZQgJkXbo1DLlK3vj11YGw5+LnF4SYti4gZmwng==
|
|
3177
3165
|
|
|
3178
3166
|
electron-to-chromium@^1.4.535:
|
|
3179
3167
|
version "1.4.563"
|
|
3180
3168
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.563.tgz#dabb424202754c1fed2d2938ff564b23d3bbf0d3"
|
|
3181
3169
|
integrity sha512-dg5gj5qOgfZNkPNeyKBZQAQitIQ/xwfIDmEQJHCbXaD9ebTZxwJXUsDYcBlAvZGZLi+/354l35J1wkmP6CqYaw==
|
|
3182
3170
|
|
|
3183
|
-
elkjs@^0.
|
|
3184
|
-
version "0.
|
|
3185
|
-
resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.
|
|
3186
|
-
integrity sha512-
|
|
3171
|
+
elkjs@^0.9.0:
|
|
3172
|
+
version "0.9.3"
|
|
3173
|
+
resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.9.3.tgz#16711f8ceb09f1b12b99e971b138a8384a529161"
|
|
3174
|
+
integrity sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ==
|
|
3187
3175
|
|
|
3188
3176
|
emittery@^0.13.1:
|
|
3189
3177
|
version "0.13.1"
|
|
@@ -3483,10 +3471,10 @@ file-entry-cache@^6.0.1:
|
|
|
3483
3471
|
dependencies:
|
|
3484
3472
|
flat-cache "^3.0.4"
|
|
3485
3473
|
|
|
3486
|
-
fill-range@^7.
|
|
3487
|
-
version "7.
|
|
3488
|
-
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.
|
|
3489
|
-
integrity sha512-
|
|
3474
|
+
fill-range@^7.1.1:
|
|
3475
|
+
version "7.1.1"
|
|
3476
|
+
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
|
|
3477
|
+
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
|
|
3490
3478
|
dependencies:
|
|
3491
3479
|
to-regex-range "^5.0.1"
|
|
3492
3480
|
|
|
@@ -3537,10 +3525,10 @@ focus-lock@^1.0.0:
|
|
|
3537
3525
|
dependencies:
|
|
3538
3526
|
tslib "^2.0.3"
|
|
3539
3527
|
|
|
3540
|
-
follow-redirects@^1.15.
|
|
3541
|
-
version "1.15.
|
|
3542
|
-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.
|
|
3543
|
-
integrity sha512-
|
|
3528
|
+
follow-redirects@^1.15.6:
|
|
3529
|
+
version "1.15.9"
|
|
3530
|
+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1"
|
|
3531
|
+
integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==
|
|
3544
3532
|
|
|
3545
3533
|
for-each@^0.3.3:
|
|
3546
3534
|
version "0.3.3"
|
|
@@ -3768,11 +3756,6 @@ hastscript@^6.0.0:
|
|
|
3768
3756
|
property-information "^5.0.0"
|
|
3769
3757
|
space-separated-tokens "^1.0.0"
|
|
3770
3758
|
|
|
3771
|
-
heap@^0.2.6:
|
|
3772
|
-
version "0.2.7"
|
|
3773
|
-
resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.7.tgz#1e6adf711d3f27ce35a81fe3b7bd576c2260a8fc"
|
|
3774
|
-
integrity sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==
|
|
3775
|
-
|
|
3776
3759
|
highlight.js@^10.4.1, highlight.js@~10.7.0:
|
|
3777
3760
|
version "10.7.3"
|
|
3778
3761
|
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531"
|
|
@@ -4605,6 +4588,13 @@ json5@^2.2.3:
|
|
|
4605
4588
|
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
|
|
4606
4589
|
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
|
|
4607
4590
|
|
|
4591
|
+
katex@^0.16.9:
|
|
4592
|
+
version "0.16.21"
|
|
4593
|
+
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.21.tgz#8f63c659e931b210139691f2cc7bb35166b792a3"
|
|
4594
|
+
integrity sha512-XvqR7FgOHtWupfMiigNzmh+MgUVmDGU2kXZm899ZkPfcuoPuFxyHmXsgATDpFZDAXCI8tvinaVcDo8PIIJSo4A==
|
|
4595
|
+
dependencies:
|
|
4596
|
+
commander "^8.3.0"
|
|
4597
|
+
|
|
4608
4598
|
keyv@^4.5.3:
|
|
4609
4599
|
version "4.5.4"
|
|
4610
4600
|
resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"
|
|
@@ -4632,11 +4622,6 @@ layout-base@^1.0.0:
|
|
|
4632
4622
|
resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-1.0.2.tgz#1291e296883c322a9dd4c5dd82063721b53e26e2"
|
|
4633
4623
|
integrity sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==
|
|
4634
4624
|
|
|
4635
|
-
layout-base@^2.0.0:
|
|
4636
|
-
version "2.0.1"
|
|
4637
|
-
resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-2.0.1.tgz#d0337913586c90f9c2c075292069f5c2da5dd285"
|
|
4638
|
-
integrity sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==
|
|
4639
|
-
|
|
4640
4625
|
leven@^3.1.0:
|
|
4641
4626
|
version "3.1.0"
|
|
4642
4627
|
resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2"
|
|
@@ -4689,7 +4674,7 @@ lodash.mergewith@4.6.2:
|
|
|
4689
4674
|
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
|
|
4690
4675
|
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
|
|
4691
4676
|
|
|
4692
|
-
lodash@^4.17.15
|
|
4677
|
+
lodash@^4.17.15:
|
|
4693
4678
|
version "4.17.21"
|
|
4694
4679
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
|
4695
4680
|
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
|
@@ -4782,23 +4767,23 @@ merge2@^1.3.0, merge2@^1.4.1:
|
|
|
4782
4767
|
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
|
4783
4768
|
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
|
4784
4769
|
|
|
4785
|
-
mermaid@10.
|
|
4786
|
-
version "10.
|
|
4787
|
-
resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.
|
|
4788
|
-
integrity sha512-
|
|
4770
|
+
mermaid@10.9.3:
|
|
4771
|
+
version "10.9.3"
|
|
4772
|
+
resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.9.3.tgz#90bc6f15c33dbe5d9507fed31592cc0d88fee9f7"
|
|
4773
|
+
integrity sha512-V80X1isSEvAewIL3xhmz/rVmc27CVljcsbWxkxlWJWY/1kQa4XOABqpDl2qQLGKzpKm6WbTfUEKImBlUfFYArw==
|
|
4789
4774
|
dependencies:
|
|
4790
4775
|
"@braintree/sanitize-url" "^6.0.1"
|
|
4791
4776
|
"@types/d3-scale" "^4.0.3"
|
|
4792
4777
|
"@types/d3-scale-chromatic" "^3.0.0"
|
|
4793
|
-
cytoscape "^3.
|
|
4778
|
+
cytoscape "^3.28.1"
|
|
4794
4779
|
cytoscape-cose-bilkent "^4.1.0"
|
|
4795
|
-
cytoscape-fcose "^2.1.0"
|
|
4796
4780
|
d3 "^7.4.0"
|
|
4797
4781
|
d3-sankey "^0.12.3"
|
|
4798
4782
|
dagre-d3-es "7.0.10"
|
|
4799
4783
|
dayjs "^1.11.7"
|
|
4800
|
-
dompurify "^3.0.5"
|
|
4801
|
-
elkjs "^0.
|
|
4784
|
+
dompurify "^3.0.5 <3.1.7"
|
|
4785
|
+
elkjs "^0.9.0"
|
|
4786
|
+
katex "^0.16.9"
|
|
4802
4787
|
khroma "^2.0.0"
|
|
4803
4788
|
lodash-es "^4.17.21"
|
|
4804
4789
|
mdast-util-from-markdown "^1.3.0"
|
|
@@ -5049,10 +5034,10 @@ ms@2.1.2:
|
|
|
5049
5034
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
|
5050
5035
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
|
5051
5036
|
|
|
5052
|
-
nanoid@^3.3.
|
|
5053
|
-
version "3.3.
|
|
5054
|
-
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.
|
|
5055
|
-
integrity sha512-
|
|
5037
|
+
nanoid@^3.3.8:
|
|
5038
|
+
version "3.3.8"
|
|
5039
|
+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
|
|
5040
|
+
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==
|
|
5056
5041
|
|
|
5057
5042
|
natural-compare-lite@^1.4.0:
|
|
5058
5043
|
version "1.4.0"
|
|
@@ -5254,6 +5239,11 @@ picocolors@^1.0.0:
|
|
|
5254
5239
|
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
|
|
5255
5240
|
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
|
|
5256
5241
|
|
|
5242
|
+
picocolors@^1.1.1:
|
|
5243
|
+
version "1.1.1"
|
|
5244
|
+
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
|
|
5245
|
+
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
|
|
5246
|
+
|
|
5257
5247
|
picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1:
|
|
5258
5248
|
version "2.3.1"
|
|
5259
5249
|
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
|
@@ -5271,14 +5261,14 @@ pkg-dir@^4.2.0:
|
|
|
5271
5261
|
dependencies:
|
|
5272
5262
|
find-up "^4.0.0"
|
|
5273
5263
|
|
|
5274
|
-
postcss@^8.4.
|
|
5275
|
-
version "8.
|
|
5276
|
-
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.
|
|
5277
|
-
integrity sha512-
|
|
5264
|
+
postcss@^8.4.27:
|
|
5265
|
+
version "8.5.1"
|
|
5266
|
+
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.1.tgz#e2272a1f8a807fafa413218245630b5db10a3214"
|
|
5267
|
+
integrity sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==
|
|
5278
5268
|
dependencies:
|
|
5279
|
-
nanoid "^3.3.
|
|
5280
|
-
picocolors "^1.
|
|
5281
|
-
source-map-js "^1.
|
|
5269
|
+
nanoid "^3.3.8"
|
|
5270
|
+
picocolors "^1.1.1"
|
|
5271
|
+
source-map-js "^1.2.1"
|
|
5282
5272
|
|
|
5283
5273
|
prelude-ls@^1.2.1:
|
|
5284
5274
|
version "1.2.1"
|
|
@@ -5576,10 +5566,10 @@ robust-predicates@^3.0.0:
|
|
|
5576
5566
|
resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.2.tgz#d5b28528c4824d20fc48df1928d41d9efa1ad771"
|
|
5577
5567
|
integrity sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==
|
|
5578
5568
|
|
|
5579
|
-
rollup@^3.
|
|
5580
|
-
version "3.29.
|
|
5581
|
-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.
|
|
5582
|
-
integrity sha512-
|
|
5569
|
+
rollup@3.29.5, rollup@^3.27.1:
|
|
5570
|
+
version "3.29.5"
|
|
5571
|
+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.5.tgz#8a2e477a758b520fb78daf04bca4c522c1da8a54"
|
|
5572
|
+
integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==
|
|
5583
5573
|
optionalDependencies:
|
|
5584
5574
|
fsevents "~2.3.2"
|
|
5585
5575
|
|
|
@@ -5688,10 +5678,10 @@ slash@^3.0.0:
|
|
|
5688
5678
|
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
|
|
5689
5679
|
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
|
|
5690
5680
|
|
|
5691
|
-
source-map-js@^1.
|
|
5692
|
-
version "1.
|
|
5693
|
-
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.
|
|
5694
|
-
integrity sha512-
|
|
5681
|
+
source-map-js@^1.2.1:
|
|
5682
|
+
version "1.2.1"
|
|
5683
|
+
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
|
|
5684
|
+
integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==
|
|
5695
5685
|
|
|
5696
5686
|
source-map-support@0.5.13:
|
|
5697
5687
|
version "0.5.13"
|
|
@@ -6064,14 +6054,14 @@ v8-to-istanbul@^9.0.1:
|
|
|
6064
6054
|
"@types/istanbul-lib-coverage" "^2.0.1"
|
|
6065
6055
|
convert-source-map "^2.0.0"
|
|
6066
6056
|
|
|
6067
|
-
vite@4.
|
|
6068
|
-
version "4.
|
|
6069
|
-
resolved "https://registry.yarnpkg.com/vite/-/vite-4.
|
|
6070
|
-
integrity sha512-
|
|
6057
|
+
vite@4.5.2:
|
|
6058
|
+
version "4.5.2"
|
|
6059
|
+
resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.2.tgz#d6ea8610e099851dad8c7371599969e0f8b97e82"
|
|
6060
|
+
integrity sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==
|
|
6071
6061
|
dependencies:
|
|
6072
6062
|
esbuild "^0.18.10"
|
|
6073
|
-
postcss "^8.4.
|
|
6074
|
-
rollup "^3.
|
|
6063
|
+
postcss "^8.4.27"
|
|
6064
|
+
rollup "^3.27.1"
|
|
6075
6065
|
optionalDependencies:
|
|
6076
6066
|
fsevents "~2.3.2"
|
|
6077
6067
|
|
|
@@ -6180,10 +6170,10 @@ write-file-atomic@^4.0.2:
|
|
|
6180
6170
|
imurmurhash "^0.1.4"
|
|
6181
6171
|
signal-exit "^3.0.7"
|
|
6182
6172
|
|
|
6183
|
-
ws@^8.11.0:
|
|
6184
|
-
version "8.
|
|
6185
|
-
resolved "https://registry.yarnpkg.com/ws/-/ws-8.
|
|
6186
|
-
integrity sha512-
|
|
6173
|
+
ws@8.17.1, ws@^8.11.0:
|
|
6174
|
+
version "8.17.1"
|
|
6175
|
+
resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
|
|
6176
|
+
integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==
|
|
6187
6177
|
|
|
6188
6178
|
xml-name-validator@^4.0.0:
|
|
6189
6179
|
version "4.0.0"
|
rasa/core/channels/socketio.py
CHANGED
|
@@ -54,9 +54,31 @@ class SocketIOOutput(OutputChannel):
|
|
|
54
54
|
super().__init__()
|
|
55
55
|
self.sio = sio
|
|
56
56
|
self.bot_message_evt = bot_message_evt
|
|
57
|
+
self.last_event_timestamp = (
|
|
58
|
+
-1
|
|
59
|
+
) # Initialize with -1 to send all events on first message
|
|
60
|
+
|
|
61
|
+
def _get_new_events(self) -> List[Dict[Text, Any]]:
|
|
62
|
+
"""Get events that are newer than the last sent event."""
|
|
63
|
+
events = self.tracker_state.get("events", []) if self.tracker_state else []
|
|
64
|
+
new_events = [
|
|
65
|
+
event for event in events if event["timestamp"] > self.last_event_timestamp
|
|
66
|
+
]
|
|
67
|
+
if new_events:
|
|
68
|
+
self.last_event_timestamp = new_events[-1]["timestamp"]
|
|
69
|
+
return new_events
|
|
57
70
|
|
|
58
71
|
async def _send_message(self, socket_id: Text, response: Any) -> None:
|
|
59
72
|
"""Sends a message to the recipient using the bot event."""
|
|
73
|
+
# send tracker state (contains stack, slots and more)
|
|
74
|
+
await self.sio.emit("tracker_state", self.tracker_state, room=socket_id)
|
|
75
|
+
|
|
76
|
+
# send new events
|
|
77
|
+
new_events = self._get_new_events()
|
|
78
|
+
if new_events:
|
|
79
|
+
await self.sio.emit("rasa_events", new_events, room=socket_id)
|
|
80
|
+
|
|
81
|
+
# send bot response
|
|
60
82
|
await self.sio.emit(self.bot_message_evt, response, room=socket_id)
|
|
61
83
|
|
|
62
84
|
async def send_text_message(
|
|
@@ -192,7 +214,7 @@ class SocketIOInput(InputChannel):
|
|
|
192
214
|
|
|
193
215
|
def blueprint(
|
|
194
216
|
self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
|
|
195
|
-
) ->
|
|
217
|
+
) -> Blueprint:
|
|
196
218
|
"""Defines a Sanic blueprint."""
|
|
197
219
|
# Workaround so that socketio works with requests from other origins.
|
|
198
220
|
# https://github.com/miguelgrinberg/python-socketio/issues/205#issuecomment-493769183
|
|
@@ -267,7 +289,6 @@ class SocketIOInput(InputChannel):
|
|
|
267
289
|
metadata = data.get(self.metadata_key, {})
|
|
268
290
|
if isinstance(metadata, Text):
|
|
269
291
|
metadata = json.loads(metadata)
|
|
270
|
-
|
|
271
292
|
message = UserMessage(
|
|
272
293
|
data.get("message", ""),
|
|
273
294
|
output_channel,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import copy
|
|
2
3
|
from datetime import datetime, timezone, timedelta
|
|
3
4
|
import json
|
|
4
5
|
import uuid
|
|
5
|
-
from
|
|
6
|
+
from collections import defaultdict
|
|
6
7
|
from dataclasses import asdict
|
|
8
|
+
from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Text, Union
|
|
7
9
|
|
|
8
10
|
import structlog
|
|
9
11
|
from jsonschema import ValidationError, validate
|
|
@@ -223,6 +225,16 @@ class AudiocodesInput(InputChannel):
|
|
|
223
225
|
self.scheduler_job = None
|
|
224
226
|
self.keep_alive = keep_alive
|
|
225
227
|
self.keep_alive_expiration_factor = keep_alive_expiration_factor
|
|
228
|
+
self.background_tasks: Dict[Text, Set[asyncio.Task]] = defaultdict(set)
|
|
229
|
+
|
|
230
|
+
def _create_task(self, conversation_id: Text, coro: Awaitable[Any]) -> asyncio.Task:
|
|
231
|
+
"""Create and track an asyncio task for a conversation."""
|
|
232
|
+
task: asyncio.Task = asyncio.create_task(coro)
|
|
233
|
+
self.background_tasks[conversation_id].add(task)
|
|
234
|
+
task.add_done_callback(
|
|
235
|
+
lambda t: self.background_tasks[conversation_id].discard(t)
|
|
236
|
+
)
|
|
237
|
+
return task
|
|
226
238
|
|
|
227
239
|
async def _set_scheduler_job(self) -> None:
|
|
228
240
|
if self.scheduler_job:
|
|
@@ -251,11 +263,20 @@ class AudiocodesInput(InputChannel):
|
|
|
251
263
|
)
|
|
252
264
|
now = datetime.now(timezone.utc)
|
|
253
265
|
delta = timedelta(seconds=self.keep_alive * self.keep_alive_expiration_factor)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
|
|
267
|
+
# clean up conversations
|
|
268
|
+
inactive = [
|
|
269
|
+
conv_id
|
|
270
|
+
for conv_id, conv in self.conversations.items()
|
|
271
|
+
if not conv.is_active_conversation(now, delta)
|
|
272
|
+
]
|
|
273
|
+
|
|
274
|
+
# cancel tasks and remove conversations
|
|
275
|
+
for conv_id in inactive:
|
|
276
|
+
for task in self.background_tasks[conv_id]:
|
|
277
|
+
task.cancel()
|
|
278
|
+
self.background_tasks.pop(conv_id, None)
|
|
279
|
+
self.conversations.pop(conv_id, None)
|
|
259
280
|
|
|
260
281
|
def handle_start_conversation(self, body: Dict[Text, Any]) -> Dict[Text, Any]:
|
|
261
282
|
conversation_id = body["conversation"]
|
|
@@ -347,31 +368,29 @@ class AudiocodesInput(InputChannel):
|
|
|
347
368
|
structlogger.debug("audiocodes.on_activities", conversation=conversation_id)
|
|
348
369
|
conversation = self._get_conversation(request.token, conversation_id)
|
|
349
370
|
if conversation is None:
|
|
371
|
+
structlogger.warning(
|
|
372
|
+
"audiocodes.on_activities.no_conversation", request=request.json
|
|
373
|
+
)
|
|
350
374
|
return response.json({})
|
|
351
375
|
elif conversation.ws:
|
|
352
376
|
ac_output: Union[WebsocketOutput, AudiocodesOutput] = WebsocketOutput(
|
|
353
377
|
conversation.ws, conversation_id
|
|
354
378
|
)
|
|
355
|
-
|
|
356
|
-
request.json,
|
|
357
|
-
output_channel=ac_output,
|
|
358
|
-
on_new_message=on_new_message,
|
|
359
|
-
)
|
|
360
|
-
return response.json({})
|
|
379
|
+
response_json = {}
|
|
361
380
|
else:
|
|
362
381
|
# handle non websocket case where messages get returned in json
|
|
363
382
|
ac_output = AudiocodesOutput()
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
383
|
+
response_json = {
|
|
384
|
+
"conversation": conversation_id,
|
|
385
|
+
"activities": ac_output.messages,
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
# start a background task to handle activities
|
|
389
|
+
self._create_task(
|
|
390
|
+
conversation_id,
|
|
391
|
+
conversation.handle_activities(request.json, ac_output, on_new_message),
|
|
392
|
+
)
|
|
393
|
+
return response.json(response_json)
|
|
375
394
|
|
|
376
395
|
@ac_webhook.route(
|
|
377
396
|
"/conversation/<conversation_id>/disconnect", methods=["POST"]
|
|
@@ -2,7 +2,6 @@ from typing import Any, Dict, Optional, Text
|
|
|
2
2
|
|
|
3
3
|
import structlog
|
|
4
4
|
from jinja2 import Template
|
|
5
|
-
|
|
6
5
|
from rasa import telemetry
|
|
7
6
|
from rasa.core.nlg.response import TemplatedNaturalLanguageGenerator
|
|
8
7
|
from rasa.core.nlg.summarize import summarize_conversation
|
|
@@ -19,14 +18,6 @@ from rasa.shared.constants import (
|
|
|
19
18
|
from rasa.shared.core.domain import KEY_RESPONSES_TEXT, Domain
|
|
20
19
|
from rasa.shared.core.events import BotUttered, UserUttered
|
|
21
20
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
22
|
-
from rasa.shared.nlu.constants import (
|
|
23
|
-
PROMPTS,
|
|
24
|
-
KEY_USER_PROMPT,
|
|
25
|
-
KEY_LLM_RESPONSE_METADATA,
|
|
26
|
-
KEY_PROMPT_NAME,
|
|
27
|
-
KEY_COMPONENT_NAME,
|
|
28
|
-
)
|
|
29
|
-
from rasa.shared.providers.llm.llm_response import LLMResponse
|
|
30
21
|
from rasa.shared.utils.health_check.llm_health_check_mixin import LLMHealthCheckMixin
|
|
31
22
|
from rasa.shared.utils.llm import (
|
|
32
23
|
DEFAULT_OPENAI_GENERATE_MODEL_NAME,
|
|
@@ -133,39 +124,6 @@ class ContextualResponseRephraser(
|
|
|
133
124
|
ContextualResponseRephraser.__name__,
|
|
134
125
|
)
|
|
135
126
|
|
|
136
|
-
@classmethod
|
|
137
|
-
def _add_prompt_and_llm_metadata_to_response(
|
|
138
|
-
cls,
|
|
139
|
-
response: Dict[str, Any],
|
|
140
|
-
prompt_name: str,
|
|
141
|
-
user_prompt: str,
|
|
142
|
-
llm_response: Optional["LLMResponse"] = None,
|
|
143
|
-
) -> Dict[str, Any]:
|
|
144
|
-
"""Stores the prompt and LLMResponse metadata to response.
|
|
145
|
-
|
|
146
|
-
Args:
|
|
147
|
-
response: The response to add the prompt and LLMResponse metadata to.
|
|
148
|
-
prompt_name: A name identifying prompt usage.
|
|
149
|
-
user_prompt: The user prompt that was sent to the LLM.
|
|
150
|
-
llm_response: The response object from the LLM (None if no response).
|
|
151
|
-
"""
|
|
152
|
-
from rasa.dialogue_understanding.utils import record_commands_and_prompts
|
|
153
|
-
|
|
154
|
-
if not record_commands_and_prompts:
|
|
155
|
-
return response
|
|
156
|
-
|
|
157
|
-
prompt_data: Dict[Text, Any] = {
|
|
158
|
-
KEY_COMPONENT_NAME: cls.__name__,
|
|
159
|
-
KEY_PROMPT_NAME: prompt_name,
|
|
160
|
-
KEY_USER_PROMPT: user_prompt,
|
|
161
|
-
KEY_LLM_RESPONSE_METADATA: llm_response.to_dict() if llm_response else None,
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
prompts = response.get(PROMPTS, [])
|
|
165
|
-
prompts.append(prompt_data)
|
|
166
|
-
response[PROMPTS] = prompts
|
|
167
|
-
return response
|
|
168
|
-
|
|
169
127
|
def _last_message_if_human(self, tracker: DialogueStateTracker) -> Optional[str]:
|
|
170
128
|
"""Returns the latest message from the tracker.
|
|
171
129
|
|
|
@@ -184,21 +142,20 @@ class ContextualResponseRephraser(
|
|
|
184
142
|
return None
|
|
185
143
|
return None
|
|
186
144
|
|
|
187
|
-
async def _generate_llm_response(self, prompt: str) -> Optional[
|
|
188
|
-
"""
|
|
189
|
-
Use LLM to generate a response, returning an LLMResponse object
|
|
190
|
-
containing both the generated text (choices) and metadata.
|
|
145
|
+
async def _generate_llm_response(self, prompt: str) -> Optional[str]:
|
|
146
|
+
"""Use LLM to generate a response.
|
|
191
147
|
|
|
192
148
|
Args:
|
|
193
|
-
prompt:
|
|
149
|
+
prompt: the prompt to send to the LLM
|
|
194
150
|
|
|
195
151
|
Returns:
|
|
196
|
-
|
|
152
|
+
generated text
|
|
197
153
|
"""
|
|
198
154
|
llm = llm_factory(self.llm_config, DEFAULT_LLM_CONFIG)
|
|
199
155
|
|
|
200
156
|
try:
|
|
201
|
-
|
|
157
|
+
llm_response = await llm.acompletion(prompt)
|
|
158
|
+
return llm_response.choices[0]
|
|
202
159
|
except Exception as e:
|
|
203
160
|
# unfortunately, langchain does not wrap LLM exceptions which means
|
|
204
161
|
# we have to catch all exceptions here
|
|
@@ -298,21 +255,11 @@ class ContextualResponseRephraser(
|
|
|
298
255
|
or self.llm_property(MODEL_NAME_CONFIG_KEY),
|
|
299
256
|
llm_model_group_id=self.llm_property(MODEL_GROUP_ID_CONFIG_KEY),
|
|
300
257
|
)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
response = self._add_prompt_and_llm_metadata_to_response(
|
|
305
|
-
response=response,
|
|
306
|
-
prompt_name="rephrase_prompt",
|
|
307
|
-
user_prompt=prompt,
|
|
308
|
-
llm_response=llm_response,
|
|
309
|
-
)
|
|
310
|
-
|
|
311
|
-
if not (llm_response and llm_response.choices and llm_response.choices[0]):
|
|
312
|
-
# If the LLM fails to generate a response, return the original response.
|
|
258
|
+
if not (updated_text := await self._generate_llm_response(prompt)):
|
|
259
|
+
# If the LLM fails to generate a response, we
|
|
260
|
+
# return the original response.
|
|
313
261
|
return response
|
|
314
262
|
|
|
315
|
-
updated_text = llm_response.choices[0]
|
|
316
263
|
structlogger.debug(
|
|
317
264
|
"nlg.rewrite.complete",
|
|
318
265
|
response_text=response_text,
|