-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor interpreter
usage in story visualization
#9821
refactor interpreter
usage in story visualization
#9821
Conversation
else: | ||
message = el.parse_data | ||
message[TEXT] = f"{INTENT_MESSAGE_PREFIX}{el.intent_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously (even on 2.8.x) it always used None
for the nodes which is super bad UX
@@ -22,40 +21,6 @@ def test_load_training_data_reader_not_found_throws(tmp_path: Path, domain: Doma | |||
training.load_data(str(tmp_path), domain) | |||
|
|||
|
|||
async def test_story_visualization(domain: Domain, tmp_path: Path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved them to the other visualization tests
def test_story_visualization_with_processor( | ||
domain: Domain, tmp_path: Path, default_agent: Agent | ||
): | ||
import rasa.shared.core.training_data.loading as core_loading | ||
|
||
story_steps = core_loading.load_data_from_resource( | ||
"data/test_yaml_stories/stories.yml", domain | ||
) | ||
out_file = tmp_path / "graph.html" | ||
generated_graph = visualization.visualize_stories( | ||
story_steps, | ||
domain, | ||
processor=default_agent.processor, | ||
output_file=str(out_file), | ||
max_history=3, | ||
should_merge_nodes=False, | ||
) | ||
|
||
assert str(None) not in out_file.read_text() | ||
assert "/affirm" in out_file.read_text() | ||
assert len(generated_graph.nodes()) == 51 | ||
assert len(generated_graph.edges()) == 56 | ||
|
||
|
||
def test_story_visualization_with_training_data( | ||
domain: Domain, tmp_path: Path, nlu_data_path: Text | ||
): | ||
import rasa.shared.core.training_data.loading as core_loading | ||
|
||
story_steps = core_loading.load_data_from_resource( | ||
"data/test_yaml_stories/stories.yml", domain | ||
) | ||
out_file = tmp_path / "graph.html" | ||
test_text = "test text" | ||
test_intent = "affirm" | ||
generated_graph = visualization.visualize_stories( | ||
story_steps, | ||
domain, | ||
output_file=str(out_file), | ||
max_history=3, | ||
should_merge_nodes=False, | ||
nlu_training_data=TrainingData( | ||
[Message({TEXT: test_text, INTENT: test_intent})] | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added them to test whether things work as expected
93e56ec
to
a98044e
Compare
I'll actually drop the |
1785aaf
to
0d89bc6
Compare
0d89bc6
to
fe32dfc
Compare
fe32dfc
to
0cc0ac9
Compare
@joejuzl Do you have time to give this another review today? |
Proposed changes:
Status (please check what you already did):
black
(please check Readme for instructions)