rasa-pro 3.13.0.dev3__py3-none-any.whl → 3.13.0.dev7__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/__main__.py +3 -1
- rasa/api.py +4 -0
- rasa/cli/arguments/default_arguments.py +13 -1
- rasa/cli/arguments/train.py +2 -0
- rasa/cli/evaluate.py +1 -1
- rasa/cli/export.py +2 -2
- rasa/cli/inspect.py +8 -4
- rasa/cli/project_templates/default/config.yml +5 -32
- rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_cancels_during_a_correction.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_changes_mind_on_a_whim.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_handle.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_name.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_adds_contact_to_their_list.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_lists_contacts.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact_from_list.yml +1 -1
- rasa/cli/project_templates/default/endpoints.yml +18 -2
- rasa/cli/scaffold.py +3 -4
- rasa/cli/studio/download.py +1 -1
- rasa/cli/studio/upload.py +0 -6
- rasa/cli/train.py +1 -0
- rasa/constants.py +2 -0
- rasa/core/agent.py +2 -2
- rasa/core/brokers/kafka.py +4 -0
- rasa/core/brokers/pika.py +4 -0
- rasa/core/brokers/sql.py +1 -1
- rasa/core/channels/channel.py +68 -5
- rasa/core/channels/inspector/.eslintrc.cjs +12 -6
- rasa/core/channels/inspector/.prettierrc +5 -0
- rasa/core/channels/inspector/README.md +10 -4
- rasa/core/channels/inspector/dist/assets/{arc-c7691751.js → arc-c4b064fc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-ab99dff7.js → blockDiagram-38ab4fdb-215b5026.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-08c35a6b.js → c4Diagram-3d4e48cf-2b54a0a3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-3730f5fd.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-9e9c71c9.js → classDiagram-70f12bd4-daacea5f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-15e7e2bf.js → classDiagram-v2-f2320105-930d4dc2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-e847561e.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-9c105cb1.js → createText-2e5e7dd3-83c206ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-77e89e48.js → edges-e0da2a9e-b0eb01d0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-7a011646.js → erDiagram-9861fffd-17586500.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-b6f105ac.js → flowDb-956e92f1-be2a1776.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-ce4f18c2.js → flowDiagram-66a62f08-c2120ebd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-cb5f6da4.js → flowchart-elk-definition-4a651766-a6ab5c48.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-e4d19e28.js → ganttDiagram-c361ad54-ef613457.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-727b1c33.js → gitGraphDiagram-72cf32ee-d59185b3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-6e2ab9a7.js → graph-0f155405.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-84ec700f.js → index-3862675e-d5f1d1b7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-098a1a24.js → index-47737d3a.js} +162 -149
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-78dda442.js → infoDiagram-f8f76790-b07d141f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-f1cc6dd1.js → journeyDiagram-49397b02-1936d429.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-d98dcd0c.js → layout-dde8d0f3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-838e3d82.js → line-0c2c7ee0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-eae72406.js → linear-35dd89a4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-c96fd84b.js → mindmap-definition-fc14e90a-56192851.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-c936d4e2.js → pieDiagram-8a3498a8-fc21ed78.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-b338eb8f.js → quadrantDiagram-120e2f19-25e98518.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-c6b6c0d5.js → requirementDiagram-deff3bca-546ff1f5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-b9372e19.js → sankeyDiagram-04a897e0-02d8b82d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-479e0a3f.js → sequenceDiagram-704730f1-3ca5a92e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-fd26eebc.js → stateDiagram-587899a1-128ea07c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-3233e0ae.js → stateDiagram-v2-d93cdb3a-95f290af.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-1fdd392b.js → styles-6aaf32cf-4984898a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-6d7bfa1b.js → styles-9a916d00-1bf266ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-f86aab11.js → styles-c10674c1-60521c63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-e3e49d7a.js → svgDrawCommon-08f97a94-a25b6e12.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-6fe08b4d.js → timeline-definition-85554ec2-0fc086bf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-c2e06fd6.js → xychartDiagram-e933f94c-44ee592e.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/package.json +3 -1
- rasa/core/channels/inspector/src/App.tsx +92 -90
- rasa/core/channels/inspector/src/components/Chat.tsx +61 -36
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +40 -43
- rasa/core/channels/inspector/src/components/DialogueInformation.tsx +57 -57
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +36 -27
- rasa/core/channels/inspector/src/components/ExpandIcon.tsx +4 -4
- rasa/core/channels/inspector/src/components/FullscreenButton.tsx +7 -7
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +28 -12
- rasa/core/channels/inspector/src/components/NoActiveFlow.tsx +9 -9
- rasa/core/channels/inspector/src/components/RasaLogo.tsx +5 -5
- rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +55 -60
- rasa/core/channels/inspector/src/components/SaraDiagrams.tsx +5 -5
- rasa/core/channels/inspector/src/components/Slots.tsx +22 -22
- rasa/core/channels/inspector/src/components/Welcome.tsx +28 -31
- rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +245 -0
- rasa/core/channels/inspector/src/helpers/audio/microphone-processor.js +12 -0
- rasa/core/channels/inspector/src/helpers/audio/playback-processor.js +36 -0
- rasa/core/channels/inspector/src/helpers/conversation.ts +16 -0
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +181 -181
- rasa/core/channels/inspector/src/helpers/formatters.ts +111 -111
- rasa/core/channels/inspector/src/helpers/utils.ts +78 -61
- rasa/core/channels/inspector/src/main.tsx +8 -8
- rasa/core/channels/inspector/src/theme/Button/Button.ts +8 -8
- rasa/core/channels/inspector/src/theme/Heading/Heading.ts +7 -7
- rasa/core/channels/inspector/src/theme/Input/Input.ts +9 -9
- rasa/core/channels/inspector/src/theme/Link/Link.ts +6 -6
- rasa/core/channels/inspector/src/theme/Modal/Modal.ts +13 -13
- rasa/core/channels/inspector/src/theme/Table/Table.tsx +10 -10
- rasa/core/channels/inspector/src/theme/Tooltip/Tooltip.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/breakpoints.ts +7 -7
- rasa/core/channels/inspector/src/theme/base/colors.ts +64 -64
- rasa/core/channels/inspector/src/theme/base/fonts/fontFaces.css +21 -18
- rasa/core/channels/inspector/src/theme/base/radii.ts +8 -8
- rasa/core/channels/inspector/src/theme/base/shadows.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/sizes.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/space.ts +12 -12
- rasa/core/channels/inspector/src/theme/base/styles.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/typography.ts +12 -12
- rasa/core/channels/inspector/src/theme/base/zIndices.ts +3 -3
- rasa/core/channels/inspector/src/theme/index.ts +38 -38
- rasa/core/channels/inspector/src/types.ts +56 -50
- rasa/core/channels/inspector/yarn.lock +5 -0
- rasa/core/channels/voice_ready/audiocodes.py +75 -32
- rasa/core/channels/voice_ready/twilio_voice.py +48 -1
- rasa/core/channels/voice_stream/tts/azure.py +11 -2
- rasa/core/channels/voice_stream/twilio_media_streams.py +101 -26
- rasa/core/channels/voice_stream/voice_channel.py +28 -2
- rasa/core/concurrent_lock_store.py +24 -10
- rasa/core/evaluation/marker_tracker_loader.py +1 -1
- rasa/core/exporter.py +1 -1
- rasa/core/lock_store.py +151 -60
- rasa/core/nlg/contextual_response_rephraser.py +4 -2
- rasa/core/nlg/summarize.py +1 -1
- rasa/core/persistor.py +55 -20
- rasa/core/policies/enterprise_search_policy.py +7 -4
- rasa/core/policies/intentless_policy.py +15 -9
- rasa/core/processor.py +2 -2
- rasa/core/run.py +7 -2
- rasa/core/{auth_retry_tracker_store.py → tracker_stores/auth_retry_tracker_store.py} +5 -1
- rasa/core/tracker_stores/dynamo_tracker_store.py +218 -0
- rasa/core/tracker_stores/mongo_tracker_store.py +206 -0
- rasa/core/tracker_stores/redis_tracker_store.py +219 -0
- rasa/core/tracker_stores/sql_tracker_store.py +555 -0
- rasa/core/tracker_stores/tracker_store.py +805 -0
- rasa/core/utils.py +6 -0
- rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -3
- rasa/dialogue_understanding/commands/clarify_command.py +2 -2
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
- rasa/dialogue_understanding/generator/constants.py +2 -2
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +1 -1
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +33 -12
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +2 -2
- rasa/dialogue_understanding_test/du_test_case.py +16 -8
- rasa/hooks.py +2 -2
- rasa/keys +1 -0
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -2
- rasa/model_manager/config.py +3 -1
- rasa/model_manager/model_api.py +1 -2
- rasa/model_manager/runner_service.py +8 -4
- rasa/model_manager/trainer_service.py +1 -0
- rasa/model_training.py +12 -3
- rasa/nlu/extractors/crf_entity_extractor.py +66 -16
- rasa/plugin.py +1 -4
- rasa/server.py +6 -2
- rasa/shared/constants.py +4 -0
- rasa/shared/core/domain.py +165 -11
- rasa/shared/core/events.py +68 -2
- rasa/shared/core/flows/flow.py +155 -131
- rasa/shared/core/flows/flow_step.py +19 -3
- rasa/shared/core/flows/flow_step_links.py +15 -0
- rasa/shared/core/flows/flow_step_sequence.py +6 -0
- rasa/shared/core/flows/nlu_trigger.py +13 -0
- rasa/shared/core/flows/steps/action.py +7 -4
- rasa/shared/core/flows/steps/call.py +11 -4
- rasa/shared/core/flows/steps/collect.py +27 -6
- rasa/shared/core/flows/steps/internal.py +6 -1
- rasa/shared/core/flows/steps/link.py +7 -4
- rasa/shared/core/flows/steps/no_operation.py +7 -4
- rasa/shared/core/flows/steps/set_slots.py +8 -4
- rasa/shared/core/flows/yaml_flows_io.py +106 -5
- rasa/shared/importers/importer.py +8 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +4 -0
- rasa/shared/providers/_configs/openai_client_config.py +4 -0
- rasa/shared/providers/_utils.py +83 -0
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +11 -5
- rasa/shared/providers/llm/azure_openai_llm_client.py +6 -68
- rasa/shared/providers/router/_base_litellm_router_client.py +53 -1
- rasa/shared/utils/common.py +42 -0
- rasa/studio/download/__init__.py +0 -0
- rasa/studio/download/domains.py +49 -0
- rasa/studio/download/download.py +439 -0
- rasa/studio/download/flows.py +359 -0
- rasa/studio/results_logger.py +6 -1
- rasa/studio/upload.py +69 -5
- rasa/telemetry.py +2 -2
- rasa/tracing/config.py +1 -1
- rasa/tracing/instrumentation/attribute_extractors.py +1 -1
- rasa/tracing/instrumentation/instrumentation.py +1 -1
- rasa/utils/common.py +36 -0
- rasa/utils/endpoints.py +22 -1
- rasa/utils/licensing.py +2 -3
- rasa/validator.py +1 -2
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/METADATA +10 -10
- {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/RECORD +213 -210
- rasa/cli/project_templates/calm/config.yml +0 -10
- rasa/cli/project_templates/calm/credentials.yml +0 -33
- rasa/cli/project_templates/calm/endpoints.yml +0 -58
- rasa/cli/project_templates/default/actions/actions.py +0 -27
- rasa/cli/project_templates/default/data/nlu.yml +0 -91
- rasa/cli/project_templates/default/data/rules.yml +0 -13
- rasa/cli/project_templates/default/data/stories.yml +0 -30
- rasa/cli/project_templates/default/domain.yml +0 -34
- rasa/cli/project_templates/default/tests/test_stories.yml +0 -91
- rasa/core/channels/inspector/dist/assets/channel-11268142.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-ff7f2ce7.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-cba7ae20.js +0 -1
- rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -191
- rasa/core/tracker_store.py +0 -1792
- rasa/studio/download.py +0 -489
- /rasa/cli/project_templates/{calm → default}/actions/action_template.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/add_contact.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/db.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/list_contacts.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/remove_contact.py +0 -0
- /rasa/cli/project_templates/{calm → default}/data/flows/add_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/data/flows/list_contacts.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/data/flows/remove_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/db/contacts.json +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/add_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/list_contacts.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/remove_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/shared.yml +0 -0
- /rasa/{cli/project_templates/calm/actions → core/tracker_stores}/__init__.py +0 -0
- {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/entry_points.txt +0 -0
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
import { Event } from
|
|
1
|
+
import { Event } from '../types'
|
|
2
2
|
import {
|
|
3
3
|
formatSlots,
|
|
4
4
|
formatTestCases,
|
|
5
5
|
formatFlow,
|
|
6
6
|
parseFieldUsingStack,
|
|
7
|
-
} from
|
|
7
|
+
} from './formatters'
|
|
8
8
|
|
|
9
|
-
describe(
|
|
10
|
-
describe(
|
|
11
|
-
test(
|
|
9
|
+
describe('helpers', () => {
|
|
10
|
+
describe('formatSlots', () => {
|
|
11
|
+
test('should return an empty array if no slots are provided', () => {
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
const result = formatSlots(undefined)
|
|
15
|
-
expect(result).toEqual([])
|
|
16
|
-
})
|
|
14
|
+
const result = formatSlots(undefined)
|
|
15
|
+
expect(result).toEqual([])
|
|
16
|
+
})
|
|
17
17
|
|
|
18
|
-
test(
|
|
18
|
+
test('should filter out slots with no value', () => {
|
|
19
19
|
const slots = {
|
|
20
20
|
slot1: null,
|
|
21
21
|
slot2: null,
|
|
22
|
-
}
|
|
23
|
-
const result = formatSlots(slots)
|
|
24
|
-
expect(result).toEqual([])
|
|
25
|
-
})
|
|
22
|
+
}
|
|
23
|
+
const result = formatSlots(slots)
|
|
24
|
+
expect(result).toEqual([])
|
|
25
|
+
})
|
|
26
26
|
|
|
27
|
-
test(
|
|
27
|
+
test('should filter out `dialogue_stack` slots', () => {
|
|
28
28
|
const slots = {
|
|
29
|
-
dialogue_stack:
|
|
30
|
-
}
|
|
31
|
-
const result = formatSlots(slots)
|
|
32
|
-
expect(result).toEqual([])
|
|
33
|
-
})
|
|
29
|
+
dialogue_stack: 'anything',
|
|
30
|
+
}
|
|
31
|
+
const result = formatSlots(slots)
|
|
32
|
+
expect(result).toEqual([])
|
|
33
|
+
})
|
|
34
34
|
|
|
35
|
-
test(
|
|
35
|
+
test('should filter out `flow_hashes` slots', () => {
|
|
36
36
|
const slots = {
|
|
37
|
-
flow_hashes:
|
|
38
|
-
}
|
|
39
|
-
const result = formatSlots(slots)
|
|
40
|
-
expect(result).toEqual([])
|
|
41
|
-
})
|
|
37
|
+
flow_hashes: 'anything',
|
|
38
|
+
}
|
|
39
|
+
const result = formatSlots(slots)
|
|
40
|
+
expect(result).toEqual([])
|
|
41
|
+
})
|
|
42
42
|
|
|
43
|
-
test(
|
|
43
|
+
test('should format a list of slots', () => {
|
|
44
44
|
const slots = {
|
|
45
45
|
slot1: true,
|
|
46
|
-
slot2:
|
|
47
|
-
}
|
|
48
|
-
const result = formatSlots(slots)
|
|
46
|
+
slot2: 'value',
|
|
47
|
+
}
|
|
48
|
+
const result = formatSlots(slots)
|
|
49
49
|
expect(result).toEqual([
|
|
50
50
|
{
|
|
51
|
-
name:
|
|
51
|
+
name: 'slot1',
|
|
52
52
|
value: true,
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
name:
|
|
56
|
-
value:
|
|
55
|
+
name: 'slot2',
|
|
56
|
+
value: 'value',
|
|
57
57
|
},
|
|
58
|
-
])
|
|
59
|
-
})
|
|
60
|
-
})
|
|
58
|
+
])
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
61
|
|
|
62
|
-
describe(
|
|
63
|
-
const sessionId =
|
|
62
|
+
describe('formatTestCases', () => {
|
|
63
|
+
const sessionId = 'session-id'
|
|
64
64
|
|
|
65
|
-
test(
|
|
66
|
-
const events: Event[] = []
|
|
67
|
-
const result = formatTestCases(events, sessionId)
|
|
65
|
+
test('should format an empty list of events', () => {
|
|
66
|
+
const events: Event[] = []
|
|
67
|
+
const result = formatTestCases(events, sessionId)
|
|
68
68
|
expect(result).toEqual(`test_cases:
|
|
69
69
|
- test_case: ${sessionId}
|
|
70
|
-
steps: []`)
|
|
71
|
-
})
|
|
70
|
+
steps: []`)
|
|
71
|
+
})
|
|
72
72
|
|
|
73
|
-
test(
|
|
73
|
+
test('should format a list of events', () => {
|
|
74
74
|
const events: Event[] = [
|
|
75
75
|
{
|
|
76
|
-
event:
|
|
77
|
-
text:
|
|
78
|
-
timestamp:
|
|
76
|
+
event: 'user',
|
|
77
|
+
text: 'book a restaurant',
|
|
78
|
+
timestamp: '123',
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
event:
|
|
81
|
+
event: 'bot',
|
|
82
82
|
metadata: {
|
|
83
|
-
utter_action:
|
|
83
|
+
utter_action: 'utter_ask_book_restaurant_name_of_restaurant',
|
|
84
84
|
},
|
|
85
85
|
text: "What's the name of the restaurant you are interested in?",
|
|
86
|
-
timestamp:
|
|
86
|
+
timestamp: '124',
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
event:
|
|
90
|
-
text:
|
|
91
|
-
timestamp:
|
|
89
|
+
event: 'user',
|
|
90
|
+
text: 'simsim',
|
|
91
|
+
timestamp: '125',
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
|
-
event:
|
|
95
|
-
text:
|
|
96
|
-
timestamp:
|
|
94
|
+
event: 'bot',
|
|
95
|
+
text: 'How many people are we talking?',
|
|
96
|
+
timestamp: '126',
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
|
-
event:
|
|
100
|
-
text:
|
|
101
|
-
timestamp:
|
|
99
|
+
event: 'user',
|
|
100
|
+
text: '100',
|
|
101
|
+
timestamp: '127',
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
event:
|
|
104
|
+
event: 'bot',
|
|
105
105
|
metadata: {
|
|
106
|
-
utter_action:
|
|
106
|
+
utter_action: 'utter_ask_book_restaurant_date',
|
|
107
107
|
},
|
|
108
|
-
text:
|
|
109
|
-
timestamp:
|
|
108
|
+
text: 'For which day do you want to book?',
|
|
109
|
+
timestamp: '128',
|
|
110
110
|
},
|
|
111
|
-
]
|
|
112
|
-
const result = formatTestCases(events, sessionId)
|
|
111
|
+
]
|
|
112
|
+
const result = formatTestCases(events, sessionId)
|
|
113
113
|
|
|
114
114
|
expect(result).toEqual(`test_cases:
|
|
115
115
|
- test_case: ${sessionId}
|
|
@@ -119,105 +119,105 @@ describe("helpers", () => {
|
|
|
119
119
|
- user: "simsim"
|
|
120
120
|
- bot: "How many people are we talking?"
|
|
121
121
|
- user: "100"
|
|
122
|
-
- utter: utter_ask_book_restaurant_date`)
|
|
123
|
-
})
|
|
124
|
-
})
|
|
122
|
+
- utter: utter_ask_book_restaurant_date`)
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
125
|
|
|
126
|
-
describe(
|
|
127
|
-
test(
|
|
126
|
+
describe('formatFlow', () => {
|
|
127
|
+
test('should render a step sequence', () => {
|
|
128
128
|
const slots = [
|
|
129
129
|
{
|
|
130
|
-
name:
|
|
130
|
+
name: 'book_restaurant_offered_alternative_dates',
|
|
131
131
|
value: [],
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
|
-
name:
|
|
134
|
+
name: 'book_restaurant_is_date_flexible',
|
|
135
135
|
value: true,
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
|
-
name:
|
|
139
|
-
value:
|
|
138
|
+
name: 'book_restaurant_name_of_restaurant',
|
|
139
|
+
value: 'fonfon',
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
|
-
name:
|
|
143
|
-
value:
|
|
142
|
+
name: 'book_restaurant_number_of_people',
|
|
143
|
+
value: '30',
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
|
-
name:
|
|
147
|
-
value:
|
|
146
|
+
name: 'book_restaurant_date',
|
|
147
|
+
value: 'tomorrow',
|
|
148
148
|
},
|
|
149
|
-
]
|
|
149
|
+
]
|
|
150
150
|
const currentStack = {
|
|
151
|
-
frame_id:
|
|
152
|
-
flow_id:
|
|
153
|
-
step_id:
|
|
154
|
-
frame_type:
|
|
155
|
-
type:
|
|
156
|
-
}
|
|
151
|
+
frame_id: 'EPQQUPJA',
|
|
152
|
+
flow_id: 'book_restaurant',
|
|
153
|
+
step_id: '3_collect_book_restaurant_time',
|
|
154
|
+
frame_type: 'regular',
|
|
155
|
+
type: 'flow',
|
|
156
|
+
}
|
|
157
157
|
const flow = {
|
|
158
|
-
id:
|
|
159
|
-
name:
|
|
160
|
-
description:
|
|
158
|
+
id: 'book_restaurant',
|
|
159
|
+
name: 'book a restaurant',
|
|
160
|
+
description: 'This flow books a restaurant',
|
|
161
161
|
steps: [
|
|
162
162
|
{
|
|
163
|
-
next:
|
|
164
|
-
id:
|
|
165
|
-
collect:
|
|
166
|
-
utter:
|
|
163
|
+
next: '1_collect_book_restaurant_number_of_people',
|
|
164
|
+
id: '0_collect_book_restaurant_name_of_restaurant',
|
|
165
|
+
collect: 'book_restaurant_name_of_restaurant',
|
|
166
|
+
utter: 'utter_ask_book_restaurant_name_of_restaurant',
|
|
167
167
|
ask_before_filling: false,
|
|
168
168
|
reset_after_flow_ends: true,
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
|
-
next:
|
|
172
|
-
id:
|
|
173
|
-
collect:
|
|
174
|
-
utter:
|
|
171
|
+
next: '2_collect_book_restaurant_date',
|
|
172
|
+
id: '1_collect_book_restaurant_number_of_people',
|
|
173
|
+
collect: 'book_restaurant_number_of_people',
|
|
174
|
+
utter: 'utter_ask_book_restaurant_number_of_people',
|
|
175
175
|
ask_before_filling: false,
|
|
176
176
|
reset_after_flow_ends: true,
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
|
-
next:
|
|
180
|
-
id:
|
|
181
|
-
collect:
|
|
182
|
-
utter:
|
|
179
|
+
next: '3_collect_book_restaurant_time',
|
|
180
|
+
id: '2_collect_book_restaurant_date',
|
|
181
|
+
collect: 'book_restaurant_date',
|
|
182
|
+
utter: 'utter_ask_book_restaurant_date',
|
|
183
183
|
ask_before_filling: false,
|
|
184
184
|
reset_after_flow_ends: true,
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
|
-
next:
|
|
188
|
-
id:
|
|
189
|
-
collect:
|
|
190
|
-
utter:
|
|
187
|
+
next: '4_collect_book_restaurant_is_date_flexible',
|
|
188
|
+
id: '3_collect_book_restaurant_time',
|
|
189
|
+
collect: 'book_restaurant_time',
|
|
190
|
+
utter: 'utter_ask_book_restaurant_time',
|
|
191
191
|
ask_before_filling: false,
|
|
192
192
|
reset_after_flow_ends: true,
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
|
-
next:
|
|
196
|
-
id:
|
|
195
|
+
next: '5_check_restaurant_availability',
|
|
196
|
+
id: '4_collect_book_restaurant_is_date_flexible',
|
|
197
197
|
description:
|
|
198
|
-
|
|
199
|
-
collect:
|
|
200
|
-
utter:
|
|
198
|
+
'(True/False) whether offering alternative dates make sense',
|
|
199
|
+
collect: 'book_restaurant_is_date_flexible',
|
|
200
|
+
utter: 'utter_ask_book_restaurant_is_date_flexible',
|
|
201
201
|
ask_before_filling: false,
|
|
202
202
|
reset_after_flow_ends: true,
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
next: [
|
|
206
206
|
{
|
|
207
|
-
if:
|
|
207
|
+
if: 'not is_restaurant_available',
|
|
208
208
|
then: [
|
|
209
209
|
{
|
|
210
|
-
next:
|
|
211
|
-
id:
|
|
212
|
-
action:
|
|
210
|
+
next: 'ask_alternative',
|
|
211
|
+
id: '6_utter_restaurant_not_available',
|
|
212
|
+
action: 'utter_restaurant_not_available',
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
|
-
next:
|
|
216
|
-
id:
|
|
215
|
+
next: 'ask_alternative',
|
|
216
|
+
id: 'ask_alternative',
|
|
217
217
|
description:
|
|
218
|
-
|
|
219
|
-
collect:
|
|
220
|
-
utter:
|
|
218
|
+
'do not fill this slot, instead fill the given parts of the alternative into their respective slots',
|
|
219
|
+
collect: 'book_restaurant_alternative_dummy',
|
|
220
|
+
utter: 'utter_ask_book_restaurant_alternative_dummy',
|
|
221
221
|
ask_before_filling: false,
|
|
222
222
|
reset_after_flow_ends: true,
|
|
223
223
|
rejections: [],
|
|
@@ -225,121 +225,121 @@ describe("helpers", () => {
|
|
|
225
225
|
],
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
|
-
else:
|
|
228
|
+
else: 'available',
|
|
229
229
|
},
|
|
230
230
|
],
|
|
231
|
-
id:
|
|
232
|
-
action:
|
|
231
|
+
id: '5_check_restaurant_availability',
|
|
232
|
+
action: 'check_restaurant_availability',
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
|
-
next:
|
|
236
|
-
id:
|
|
237
|
-
action:
|
|
235
|
+
next: '9_collect_book_restaurant_reservation_name',
|
|
236
|
+
id: 'available',
|
|
237
|
+
action: 'utter_restaurant_available',
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
|
-
next:
|
|
241
|
-
id:
|
|
242
|
-
collect:
|
|
243
|
-
utter:
|
|
240
|
+
next: '10_collect_book_restaurant_confirmation',
|
|
241
|
+
id: '9_collect_book_restaurant_reservation_name',
|
|
242
|
+
collect: 'book_restaurant_reservation_name',
|
|
243
|
+
utter: 'utter_ask_book_restaurant_reservation_name',
|
|
244
244
|
ask_before_filling: true,
|
|
245
245
|
reset_after_flow_ends: true,
|
|
246
246
|
},
|
|
247
247
|
{
|
|
248
248
|
next: [
|
|
249
249
|
{
|
|
250
|
-
if:
|
|
250
|
+
if: 'book_restaurant_confirmation',
|
|
251
251
|
then: [
|
|
252
252
|
{
|
|
253
|
-
next:
|
|
254
|
-
id:
|
|
255
|
-
action:
|
|
253
|
+
next: 'END',
|
|
254
|
+
id: '11_utter_confirm_restaurant_booking',
|
|
255
|
+
action: 'utter_confirm_restaurant_booking',
|
|
256
256
|
},
|
|
257
257
|
],
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
else: [
|
|
261
261
|
{
|
|
262
|
-
next:
|
|
263
|
-
id:
|
|
264
|
-
action:
|
|
262
|
+
next: 'END',
|
|
263
|
+
id: '12_utter_cancel_book_restaurant',
|
|
264
|
+
action: 'utter_cancel_book_restaurant',
|
|
265
265
|
},
|
|
266
266
|
],
|
|
267
267
|
},
|
|
268
268
|
],
|
|
269
|
-
id:
|
|
270
|
-
collect:
|
|
271
|
-
utter:
|
|
269
|
+
id: '10_collect_book_restaurant_confirmation',
|
|
270
|
+
collect: 'book_restaurant_confirmation',
|
|
271
|
+
utter: 'utter_ask_book_restaurant_confirmation',
|
|
272
272
|
ask_before_filling: true,
|
|
273
273
|
reset_after_flow_ends: true,
|
|
274
274
|
},
|
|
275
275
|
],
|
|
276
|
-
}
|
|
277
|
-
const activeStep =
|
|
276
|
+
}
|
|
277
|
+
const activeStep = '3_collect_book_restaurant_time'
|
|
278
278
|
|
|
279
279
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
280
280
|
// @ts-ignore
|
|
281
|
-
const result = formatFlow(slots, currentStack, flow, activeStep)
|
|
282
|
-
expect(result).toEqual(restaurantFlow)
|
|
283
|
-
})
|
|
284
|
-
})
|
|
281
|
+
const result = formatFlow(slots, currentStack, flow, activeStep)
|
|
282
|
+
expect(result).toEqual(restaurantFlow)
|
|
283
|
+
})
|
|
284
|
+
})
|
|
285
285
|
|
|
286
|
-
describe(
|
|
287
|
-
test(
|
|
288
|
-
const fieldValue =
|
|
286
|
+
describe('parseFieldUsingStack', () => {
|
|
287
|
+
test('should parse a filed using a stack', () => {
|
|
288
|
+
const fieldValue = 'transfer_money_recipient'
|
|
289
289
|
|
|
290
290
|
expect(
|
|
291
|
-
parseFieldUsingStack(
|
|
292
|
-
frame_id:
|
|
293
|
-
flow_id:
|
|
294
|
-
step_id:
|
|
291
|
+
parseFieldUsingStack('{{context.collect}}', {
|
|
292
|
+
frame_id: 'frame_id',
|
|
293
|
+
flow_id: 'flow_id',
|
|
294
|
+
step_id: 'step_id',
|
|
295
295
|
collect: fieldValue,
|
|
296
296
|
ended: false,
|
|
297
|
-
})
|
|
298
|
-
).toEqual(fieldValue)
|
|
299
|
-
})
|
|
297
|
+
}),
|
|
298
|
+
).toEqual(fieldValue)
|
|
299
|
+
})
|
|
300
300
|
|
|
301
301
|
test("should return the same field if it doesn't have `context`", () => {
|
|
302
|
-
const fieldValue =
|
|
302
|
+
const fieldValue = 'transfer_money_recipient'
|
|
303
303
|
|
|
304
304
|
expect(
|
|
305
305
|
parseFieldUsingStack(fieldValue, {
|
|
306
|
-
frame_id:
|
|
307
|
-
flow_id:
|
|
308
|
-
step_id:
|
|
306
|
+
frame_id: 'frame_id',
|
|
307
|
+
flow_id: 'flow_id',
|
|
308
|
+
step_id: 'step_id',
|
|
309
309
|
ended: false,
|
|
310
|
-
})
|
|
311
|
-
).toEqual(fieldValue)
|
|
312
|
-
})
|
|
310
|
+
}),
|
|
311
|
+
).toEqual(fieldValue)
|
|
312
|
+
})
|
|
313
313
|
|
|
314
|
-
test(
|
|
315
|
-
const fieldValue =
|
|
314
|
+
test('should return the value if it has conditions as postfix', () => {
|
|
315
|
+
const fieldValue = 'transfer_money_recipient'
|
|
316
316
|
|
|
317
317
|
expect(
|
|
318
|
-
parseFieldUsingStack(
|
|
319
|
-
frame_id:
|
|
320
|
-
flow_id:
|
|
321
|
-
step_id:
|
|
318
|
+
parseFieldUsingStack('{{context.collect}} is not null', {
|
|
319
|
+
frame_id: 'frame_id',
|
|
320
|
+
flow_id: 'flow_id',
|
|
321
|
+
step_id: 'step_id',
|
|
322
322
|
collect: fieldValue,
|
|
323
323
|
ended: false,
|
|
324
|
-
})
|
|
325
|
-
).toEqual(`${fieldValue} is not null`)
|
|
326
|
-
})
|
|
324
|
+
}),
|
|
325
|
+
).toEqual(`${fieldValue} is not null`)
|
|
326
|
+
})
|
|
327
327
|
|
|
328
|
-
test(
|
|
329
|
-
const fieldValue =
|
|
328
|
+
test('should return the value if it has conditions as prefix', () => {
|
|
329
|
+
const fieldValue = 'transfer_money_recipient'
|
|
330
330
|
|
|
331
331
|
expect(
|
|
332
|
-
parseFieldUsingStack(
|
|
333
|
-
frame_id:
|
|
334
|
-
flow_id:
|
|
335
|
-
step_id:
|
|
332
|
+
parseFieldUsingStack('not {{context.collect}}', {
|
|
333
|
+
frame_id: 'frame_id',
|
|
334
|
+
flow_id: 'flow_id',
|
|
335
|
+
step_id: 'step_id',
|
|
336
336
|
collect: fieldValue,
|
|
337
337
|
ended: false,
|
|
338
|
-
})
|
|
339
|
-
).toEqual(`not ${fieldValue}`)
|
|
340
|
-
})
|
|
341
|
-
})
|
|
342
|
-
})
|
|
338
|
+
}),
|
|
339
|
+
).toEqual(`not ${fieldValue}`)
|
|
340
|
+
})
|
|
341
|
+
})
|
|
342
|
+
})
|
|
343
343
|
|
|
344
344
|
const restaurantFlow = `flowchart TD
|
|
345
345
|
classDef collect stroke-width:1px
|
|
@@ -389,4 +389,4 @@ END["🏁 END"]:::endstep
|
|
|
389
389
|
12_utter_cancel_book_restaurant --> END
|
|
390
390
|
END["🏁 END"]:::endstep
|
|
391
391
|
END["🏁 END"]:::endstep
|
|
392
|
-
|
|
392
|
+
`
|