rasa-pro 3.12.29__py3-none-any.whl → 3.12.31__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/dialogue_understanding/processor/command_processor.py +27 -11
- rasa/engine/storage/local_model_storage.py +45 -2
- rasa/version.py +1 -1
- {rasa_pro-3.12.29.dist-info → rasa_pro-3.12.31.dist-info}/METADATA +1 -1
- {rasa_pro-3.12.29.dist-info → rasa_pro-3.12.31.dist-info}/RECORD +8 -8
- {rasa_pro-3.12.29.dist-info → rasa_pro-3.12.31.dist-info}/NOTICE +0 -0
- {rasa_pro-3.12.29.dist-info → rasa_pro-3.12.31.dist-info}/WHEEL +0 -0
- {rasa_pro-3.12.29.dist-info → rasa_pro-3.12.31.dist-info}/entry_points.txt +0 -0
|
@@ -399,19 +399,12 @@ def clean_up_commands(
|
|
|
399
399
|
"""
|
|
400
400
|
domain = domain if domain else Domain.empty()
|
|
401
401
|
|
|
402
|
-
# we consider all slots that were set in the tracker for potential corrections
|
|
403
|
-
# in the correct_slot_command we will check if a slot should actually be
|
|
404
|
-
# corrected
|
|
405
|
-
slots_so_far = set(
|
|
406
|
-
[event.key for event in tracker.events if isinstance(event, SlotSet)]
|
|
407
|
-
)
|
|
408
|
-
|
|
409
402
|
clean_commands: List[Command] = []
|
|
410
403
|
|
|
411
404
|
for command in commands:
|
|
412
405
|
if isinstance(command, SetSlotCommand):
|
|
413
406
|
clean_commands = clean_up_slot_command(
|
|
414
|
-
clean_commands, command, tracker, all_flows
|
|
407
|
+
clean_commands, command, tracker, all_flows
|
|
415
408
|
)
|
|
416
409
|
|
|
417
410
|
elif isinstance(command, CancelFlowCommand) and contains_command(
|
|
@@ -502,6 +495,25 @@ def clean_up_commands(
|
|
|
502
495
|
return clean_commands
|
|
503
496
|
|
|
504
497
|
|
|
498
|
+
def _get_slots_eligible_for_correction(tracker: DialogueStateTracker) -> Set[str]:
|
|
499
|
+
"""Get all slots that are eligible for correction.
|
|
500
|
+
|
|
501
|
+
# We consider all slots, which are not None, that were set in the tracker
|
|
502
|
+
# eligible for correction.
|
|
503
|
+
# In the correct_slot_command we will check if a slot should actually be
|
|
504
|
+
# corrected.
|
|
505
|
+
"""
|
|
506
|
+
# get all slots that were set in the tracker
|
|
507
|
+
slots_so_far = set(
|
|
508
|
+
[event.key for event in tracker.events if isinstance(event, SlotSet)]
|
|
509
|
+
)
|
|
510
|
+
|
|
511
|
+
# filter out slots that are set to None (None = empty value)
|
|
512
|
+
slots_so_far = {slot for slot in slots_so_far if tracker.get_slot(slot) is not None}
|
|
513
|
+
|
|
514
|
+
return slots_so_far
|
|
515
|
+
|
|
516
|
+
|
|
505
517
|
def ensure_max_number_of_command_type(
|
|
506
518
|
commands: List[Command], command_type: Type[Command], n: int
|
|
507
519
|
) -> List[Command]:
|
|
@@ -561,7 +573,6 @@ def clean_up_slot_command(
|
|
|
561
573
|
command: SetSlotCommand,
|
|
562
574
|
tracker: DialogueStateTracker,
|
|
563
575
|
all_flows: FlowsList,
|
|
564
|
-
slots_so_far: Set[str],
|
|
565
576
|
) -> List[Command]:
|
|
566
577
|
"""Clean up a slot command.
|
|
567
578
|
|
|
@@ -574,7 +585,6 @@ def clean_up_slot_command(
|
|
|
574
585
|
command: The command to clean up.
|
|
575
586
|
tracker: The dialogue state tracker.
|
|
576
587
|
all_flows: All flows.
|
|
577
|
-
slots_so_far: The slots that have been filled so far.
|
|
578
588
|
|
|
579
589
|
Returns:
|
|
580
590
|
The cleaned up commands.
|
|
@@ -643,7 +653,13 @@ def clean_up_slot_command(
|
|
|
643
653
|
)
|
|
644
654
|
return resulting_commands
|
|
645
655
|
|
|
646
|
-
|
|
656
|
+
# get all slots that were set in the tracker and are eligible for correction
|
|
657
|
+
slots_eligible_for_correction = _get_slots_eligible_for_correction(tracker)
|
|
658
|
+
|
|
659
|
+
if (
|
|
660
|
+
command.name in slots_eligible_for_correction
|
|
661
|
+
and command.name != ROUTE_TO_CALM_SLOT
|
|
662
|
+
):
|
|
647
663
|
current_collect_info = get_current_collect_step(stack, all_flows)
|
|
648
664
|
|
|
649
665
|
if current_collect_info and current_collect_info.collect == command.name:
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import os
|
|
4
5
|
import shutil
|
|
5
6
|
import sys
|
|
7
|
+
import tarfile
|
|
6
8
|
import tempfile
|
|
7
9
|
import uuid
|
|
8
10
|
from contextlib import contextmanager
|
|
9
11
|
from datetime import datetime
|
|
10
12
|
from pathlib import Path
|
|
11
|
-
from typing import Generator, Optional, Text, Tuple, Union
|
|
13
|
+
from typing import Callable, Generator, Optional, Text, Tuple, Union
|
|
12
14
|
|
|
13
15
|
from tarsafe import TarSafe
|
|
14
16
|
|
|
@@ -57,6 +59,35 @@ def windows_safe_temporary_directory(
|
|
|
57
59
|
yield temporary_directory
|
|
58
60
|
|
|
59
61
|
|
|
62
|
+
def filter_normpath(member: tarfile.TarInfo, dest_path: str) -> tarfile.TarInfo:
|
|
63
|
+
"""Normalize tar member paths for safe extraction"""
|
|
64
|
+
if member.name:
|
|
65
|
+
member.name = os.path.normpath(member.name)
|
|
66
|
+
return member
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
FilterFunction = Callable[[tarfile.TarInfo, str], Optional[tarfile.TarInfo]]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def create_combined_filter(existing_filter: Optional[FilterFunction]) -> FilterFunction:
|
|
73
|
+
"""Create a filter that combines existing filter with path normalization"""
|
|
74
|
+
|
|
75
|
+
def combined_filter(
|
|
76
|
+
member: tarfile.TarInfo, dest_path: str
|
|
77
|
+
) -> Optional[tarfile.TarInfo]:
|
|
78
|
+
"""Apply existing filter first, then path normalization"""
|
|
79
|
+
if existing_filter is not None:
|
|
80
|
+
filtered_member = existing_filter(member, dest_path)
|
|
81
|
+
if filtered_member is None:
|
|
82
|
+
return None # Rejected by existing filter
|
|
83
|
+
member = filtered_member # Use the filtered result
|
|
84
|
+
|
|
85
|
+
# Apply our path normalization
|
|
86
|
+
return filter_normpath(member, dest_path)
|
|
87
|
+
|
|
88
|
+
return combined_filter
|
|
89
|
+
|
|
90
|
+
|
|
60
91
|
class LocalModelStorage(ModelStorage):
|
|
61
92
|
"""Stores and provides output of `GraphComponents` on local disk."""
|
|
62
93
|
|
|
@@ -122,7 +153,19 @@ class LocalModelStorage(ModelStorage):
|
|
|
122
153
|
# this restriction in environments where it's not possible
|
|
123
154
|
# to override this behavior, mostly for internal policy reasons
|
|
124
155
|
# reference: https://stackoverflow.com/a/49102229
|
|
125
|
-
|
|
156
|
+
try:
|
|
157
|
+
# Use extraction filter to normalize paths for compatibility
|
|
158
|
+
# before trying the \\?\ prefix approach first
|
|
159
|
+
prev_filter = getattr(tar, "extraction_filter", None)
|
|
160
|
+
tar.extraction_filter = create_combined_filter(prev_filter)
|
|
161
|
+
tar.extractall(f"\\\\?\\{temporary_directory}")
|
|
162
|
+
except Exception:
|
|
163
|
+
# Fallback for Python versions with tarfile security fix
|
|
164
|
+
logger.warning(
|
|
165
|
+
"Failed to extract model archive with long path support. "
|
|
166
|
+
"Falling back to regular extraction."
|
|
167
|
+
)
|
|
168
|
+
tar.extractall(temporary_directory)
|
|
126
169
|
else:
|
|
127
170
|
tar.extractall(temporary_directory)
|
|
128
171
|
LocalModelStorage._assert_not_rasa2_archive(temporary_directory)
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.12.
|
|
3
|
+
Version: 3.12.31
|
|
4
4
|
Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
|
|
5
5
|
Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
|
|
6
6
|
Author: Rasa Technologies GmbH
|
|
@@ -436,7 +436,7 @@ rasa/dialogue_understanding/patterns/skip_question.py,sha256=fJ1MC0WEEtS-BpnGJEf
|
|
|
436
436
|
rasa/dialogue_understanding/patterns/user_silence.py,sha256=xP-QMnd-MsybH5z4g01hBv4OLOHcw6m3rc26LQfe2zo,1140
|
|
437
437
|
rasa/dialogue_understanding/patterns/validate_slot.py,sha256=hqd5AEGT3M3HLNhMwuI9W9kZNCvgU6GyI-2xc2b4kz8,2085
|
|
438
438
|
rasa/dialogue_understanding/processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
439
|
-
rasa/dialogue_understanding/processor/command_processor.py,sha256=
|
|
439
|
+
rasa/dialogue_understanding/processor/command_processor.py,sha256=At3R1gwYMggfeC-j-YJzYTMLYKXWi2RGh0SMCEx8EXo,33522
|
|
440
440
|
rasa/dialogue_understanding/processor/command_processor_component.py,sha256=rkErI_Uo7s3LsEojUSGSRbWGyGaX7GtGOYSJn0V-TI4,1650
|
|
441
441
|
rasa/dialogue_understanding/stack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
442
442
|
rasa/dialogue_understanding/stack/dialogue_stack.py,sha256=cYV6aQeh0EuOJHODDqK3biqXozYTX8baPgLwHhPxFqs,5244
|
|
@@ -503,7 +503,7 @@ rasa/engine/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
503
503
|
rasa/engine/runner/dask.py,sha256=ocmpRpDpRPMaisZcBFDeUPbWGl6oWiU9UXyWimE9074,9476
|
|
504
504
|
rasa/engine/runner/interface.py,sha256=zkaKe5vjiYrR7Efepr7LVZRJEGNDM959rkdR62vEgTM,1679
|
|
505
505
|
rasa/engine/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
506
|
-
rasa/engine/storage/local_model_storage.py,sha256=
|
|
506
|
+
rasa/engine/storage/local_model_storage.py,sha256=Y2VKg04I63WgIL9XeLhJs7SkQMRqUziKyTj9QnhTWZ8,11382
|
|
507
507
|
rasa/engine/storage/resource.py,sha256=sUCBNSIrjEr68wCj7D48hzmIih7ezmT88esMhyykA88,3932
|
|
508
508
|
rasa/engine/storage/storage.py,sha256=mNLptsu9cOXWu8k55CnjZMByv6eqh2rEOqXC9__k8aE,6930
|
|
509
509
|
rasa/engine/training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -822,9 +822,9 @@ rasa/utils/train_utils.py,sha256=ClJx-6x3-h3Vt6mskacgkcCUJTMXjFPe3zAcy_DfmaU,212
|
|
|
822
822
|
rasa/utils/url_tools.py,sha256=dZ1HGkVdWTJB7zYEdwoDIrEuyX9HE5WsxKKFVsXBLE0,1218
|
|
823
823
|
rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
|
|
824
824
|
rasa/validator.py,sha256=524VlFTYK0B3iXYveVD6BDC3K0j1QfpzJ9O-TAWczmc,83166
|
|
825
|
-
rasa/version.py,sha256=
|
|
826
|
-
rasa_pro-3.12.
|
|
827
|
-
rasa_pro-3.12.
|
|
828
|
-
rasa_pro-3.12.
|
|
829
|
-
rasa_pro-3.12.
|
|
830
|
-
rasa_pro-3.12.
|
|
825
|
+
rasa/version.py,sha256=2Z_MhUOhckb-Tlm2UuPGZdu3Albffu_Js1q85XaCmXo,118
|
|
826
|
+
rasa_pro-3.12.31.dist-info/METADATA,sha256=0IoqbSS8YRmiKFl7qocrUXcFHfoa0NBRd5yfArRgzmc,10609
|
|
827
|
+
rasa_pro-3.12.31.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
|
|
828
|
+
rasa_pro-3.12.31.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
829
|
+
rasa_pro-3.12.31.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
|
|
830
|
+
rasa_pro-3.12.31.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|