rasa-pro 3.13.0.dev5__py3-none-any.whl → 3.13.0.dev8__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 +0 -3
- rasa/api.py +5 -1
- rasa/cli/arguments/default_arguments.py +13 -1
- rasa/cli/arguments/train.py +2 -0
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -1
- rasa/cli/evaluate.py +2 -2
- rasa/cli/export.py +3 -3
- rasa/cli/llm_fine_tuning.py +12 -11
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/run.py +1 -1
- rasa/cli/studio/link.py +53 -0
- rasa/cli/studio/pull.py +78 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/upload.py +8 -0
- rasa/cli/train.py +2 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +4 -0
- rasa/core/__init__.py +0 -16
- rasa/core/actions/action.py +5 -1
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +0 -1
- rasa/core/agent.py +18 -3
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/kafka.py +4 -0
- rasa/core/brokers/pika.py +5 -2
- rasa/core/brokers/sql.py +1 -1
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/hangouts.py +8 -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-9f75cc3b.js → arc-c4b064fc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-7f34db23.js → blockDiagram-38ab4fdb-215b5026.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-948bab2c.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-53b0dd0e.js → classDiagram-70f12bd4-daacea5f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-fdf789e7.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-87c4ece5.js → createText-2e5e7dd3-83c206ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-5a8b0749.js → edges-e0da2a9e-b0eb01d0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-66da90e2.js → erDiagram-9861fffd-17586500.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-10044f05.js → flowDb-956e92f1-be2a1776.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-f338f66a.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-b13140aa.js → flowchart-elk-definition-4a651766-a6ab5c48.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-f2b4a55a.js → ganttDiagram-c361ad54-ef613457.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-dedc298d.js → gitGraphDiagram-72cf32ee-d59185b3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-4ede11ff.js → graph-0f155405.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-65549d37.js → index-3862675e-d5f1d1b7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3a23e736.js → index-47737d3a.js} +123 -123
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-65439671.js → infoDiagram-f8f76790-b07d141f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-56d03d98.js → journeyDiagram-49397b02-1936d429.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dd48f7f4.js → layout-dde8d0f3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-1569ad2c.js → line-0c2c7ee0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-48bf4935.js → linear-35dd89a4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-688504c1.js → mindmap-definition-fc14e90a-56192851.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-78b6d7e6.js → pieDiagram-8a3498a8-fc21ed78.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-048b84b3.js → quadrantDiagram-120e2f19-25e98518.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-dd67f107.js → requirementDiagram-deff3bca-546ff1f5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-8128436e.js → sankeyDiagram-04a897e0-02d8b82d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-1a0d1461.js → sequenceDiagram-704730f1-3ca5a92e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-46d388ed.js → stateDiagram-587899a1-128ea07c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-ea42951a.js → stateDiagram-v2-d93cdb3a-95f290af.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-7427ed0c.js → styles-6aaf32cf-4984898a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-ff5e5a16.js → styles-9a916d00-1bf266ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-7b3680cf.js → styles-c10674c1-60521c63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-f860f2ad.js → svgDrawCommon-08f97a94-a25b6e12.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-2eebf0c8.js → timeline-definition-85554ec2-0fc086bf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-5d7f4e96.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 +91 -90
- rasa/core/channels/inspector/src/components/Chat.tsx +45 -41
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +40 -40
- 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 +7 -7
- 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/mattermost.py +1 -1
- rasa/core/channels/rasa_chat.py +2 -4
- rasa/core/channels/rest.py +5 -4
- rasa/core/channels/studio_chat.py +3 -2
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +35 -25
- rasa/core/channels/voice_stream/audiocodes.py +7 -4
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/twilio_media_streams.py +10 -5
- rasa/core/channels/voice_stream/voice_channel.py +33 -22
- rasa/core/evaluation/marker_tracker_loader.py +1 -1
- rasa/core/exporter.py +1 -1
- rasa/core/http_interpreter.py +3 -7
- rasa/core/jobs.py +2 -1
- rasa/core/nlg/contextual_response_rephraser.py +38 -11
- rasa/core/nlg/generator.py +0 -1
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/summarize.py +40 -6
- rasa/core/persistor.py +55 -20
- rasa/core/policies/enterprise_search_policy.py +290 -66
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +63 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +24 -16
- rasa/core/processor.py +106 -53
- rasa/core/run.py +40 -13
- rasa/core/tracker_stores/__init__.py +0 -0
- 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/training/interactive.py +1 -1
- rasa/core/utils.py +24 -91
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -3
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +2 -0
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +6 -2
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/human_handoff_command.py +2 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +11 -1
- rasa/dialogue_understanding/commands/skip_question_command.py +2 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +4 -0
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +4 -2
- rasa/dialogue_understanding/generator/command_parser.py +2 -2
- rasa/dialogue_understanding/generator/command_parser_validator.py +63 -0
- 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_v3_gpt_4o_2024_11_20_template.jinja2 +78 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +28 -463
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +147 -0
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +477 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +8 -58
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +37 -25
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +3 -3
- rasa/dialogue_understanding/processor/command_processor_component.py +3 -3
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/utils.py +68 -12
- rasa/dialogue_understanding_test/du_test_case.py +1 -1
- rasa/dialogue_understanding_test/du_test_runner.py +4 -22
- rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +2 -6
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/recipes/default_recipe.py +26 -2
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +2 -30
- rasa/keys +1 -0
- rasa/llm_fine_tuning/annotation_module.py +39 -9
- rasa/llm_fine_tuning/conversations.py +3 -0
- rasa/llm_fine_tuning/llm_data_preparation_module.py +66 -49
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -2
- rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +52 -44
- rasa/llm_fine_tuning/paraphrasing_module.py +10 -12
- rasa/llm_fine_tuning/storage.py +4 -4
- rasa/llm_fine_tuning/utils.py +63 -1
- rasa/model_manager/config.py +3 -1
- rasa/model_manager/model_api.py +89 -2
- rasa/model_manager/runner_service.py +8 -4
- rasa/model_manager/trainer_service.py +5 -4
- rasa/model_training.py +12 -3
- rasa/nlu/extractors/crf_entity_extractor.py +66 -16
- rasa/plugin.py +2 -12
- rasa/privacy/__init__.py +0 -0
- rasa/privacy/constants.py +83 -0
- rasa/privacy/event_broker_utils.py +77 -0
- rasa/privacy/privacy_config.py +281 -0
- rasa/privacy/privacy_config_schema.json +86 -0
- rasa/privacy/privacy_filter.py +340 -0
- rasa/privacy/privacy_manager.py +576 -0
- rasa/server.py +29 -4
- rasa/shared/constants.py +6 -0
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +7 -0
- rasa/shared/core/events.py +99 -3
- rasa/shared/core/flows/flow.py +1 -2
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/steps/collect.py +46 -2
- rasa/shared/core/slots.py +28 -0
- rasa/shared/exceptions.py +4 -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/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +5 -2
- rasa/shared/utils/llm.py +161 -6
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/data_handler.py +3 -3
- rasa/studio/download/download.py +37 -60
- rasa/studio/download/flows.py +23 -31
- rasa/studio/link.py +200 -0
- rasa/studio/pull.py +94 -0
- rasa/studio/push.py +131 -0
- rasa/studio/upload.py +117 -67
- rasa/telemetry.py +84 -27
- rasa/tracing/config.py +4 -5
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +11 -3
- rasa/tracing/instrumentation/instrumentation.py +54 -3
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +1 -27
- rasa/utils/licensing.py +1 -2
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/METADATA +8 -9
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/RECORD +254 -231
- rasa/anonymization/__init__.py +0 -2
- rasa/anonymization/anonymisation_rule_yaml_reader.py +0 -91
- rasa/anonymization/anonymization_pipeline.py +0 -286
- rasa/anonymization/anonymization_rule_executor.py +0 -266
- rasa/anonymization/anonymization_rule_orchestrator.py +0 -119
- rasa/anonymization/schemas/config.yml +0 -47
- rasa/anonymization/utils.py +0 -118
- rasa/core/channels/inspector/dist/assets/channel-dfa68278.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-edb7f119.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-65e7c670.js +0 -1
- rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -191
- rasa/core/tracker_store.py +0 -1792
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/entry_points.txt +0 -0
|
@@ -11,24 +11,24 @@ import {
|
|
|
11
11
|
Flex,
|
|
12
12
|
useColorModeValue,
|
|
13
13
|
Tooltip,
|
|
14
|
-
} from
|
|
15
|
-
import { useOurTheme } from
|
|
16
|
-
import { Light as SyntaxHighlighter } from
|
|
17
|
-
import { Slot } from
|
|
18
|
-
import { shouldShowTooltip } from
|
|
14
|
+
} from '@chakra-ui/react'
|
|
15
|
+
import { useOurTheme } from '../theme'
|
|
16
|
+
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'
|
|
17
|
+
import { Slot } from '../types'
|
|
18
|
+
import { shouldShowTooltip } from '../helpers/utils'
|
|
19
19
|
|
|
20
20
|
interface Props extends FlexProps {
|
|
21
|
-
slots: Slot[]
|
|
21
|
+
slots: Slot[]
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const SlotTable = ({ slots }: { slots: Slot[] }) => {
|
|
25
|
-
const { rasaFontSizes } = useOurTheme()
|
|
25
|
+
const { rasaFontSizes } = useOurTheme()
|
|
26
26
|
|
|
27
27
|
const highlighterSx = {
|
|
28
|
-
background: useColorModeValue(
|
|
28
|
+
background: useColorModeValue('neutral.50', 'neutral.50'),
|
|
29
29
|
fontSize: rasaFontSizes.sm,
|
|
30
|
-
letterSpacing:
|
|
31
|
-
}
|
|
30
|
+
letterSpacing: '0',
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<Table width="100%" layout="fixed">
|
|
@@ -59,27 +59,27 @@ export const SlotTable = ({ slots }: { slots: Slot[] }) => {
|
|
|
59
59
|
))}
|
|
60
60
|
</Tbody>
|
|
61
61
|
</Table>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
64
|
|
|
65
65
|
export const Slots = ({ sx, slots, ...props }: Props) => {
|
|
66
|
-
const { rasaSpace } = useOurTheme()
|
|
66
|
+
const { rasaSpace } = useOurTheme()
|
|
67
67
|
|
|
68
68
|
const containerSx = {
|
|
69
69
|
...sx,
|
|
70
70
|
pr: 0,
|
|
71
71
|
pb: 0,
|
|
72
|
-
position:
|
|
73
|
-
flexDirection:
|
|
74
|
-
}
|
|
72
|
+
position: 'relative',
|
|
73
|
+
flexDirection: 'column',
|
|
74
|
+
}
|
|
75
75
|
const overflowBox = {
|
|
76
|
-
height:
|
|
77
|
-
overflow:
|
|
76
|
+
height: '100%',
|
|
77
|
+
overflow: 'auto',
|
|
78
78
|
pr: rasaSpace[1],
|
|
79
79
|
pb: rasaSpace[0.5],
|
|
80
|
-
}
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
const displaySlots = slots.length ? slots : [{ name:
|
|
82
|
+
const displaySlots = slots.length ? slots : [{ name: '-', value: '-' }]
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
85
|
<Flex sx={containerSx} {...props}>
|
|
@@ -87,5 +87,5 @@ export const Slots = ({ sx, slots, ...props }: Props) => {
|
|
|
87
87
|
<SlotTable slots={displaySlots} />
|
|
88
88
|
</Box>
|
|
89
89
|
</Flex>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
90
|
+
)
|
|
91
|
+
}
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
FlexProps,
|
|
5
|
-
Heading,
|
|
6
|
-
Link,
|
|
7
|
-
Text,
|
|
8
|
-
} from "@chakra-ui/react";
|
|
9
|
-
import { RasaLogo, RasaLogoDark } from "./RasaLogo";
|
|
10
|
-
import { useOurTheme } from "../theme";
|
|
1
|
+
import { Box, Flex, FlexProps, Heading, Link, Text } from '@chakra-ui/react'
|
|
2
|
+
import { RasaLogo, RasaLogoDark } from './RasaLogo'
|
|
3
|
+
import { useOurTheme } from '../theme'
|
|
11
4
|
|
|
12
5
|
interface WelcomeProps extends FlexProps {
|
|
13
|
-
isRecruitmentVisible?: boolean
|
|
6
|
+
isRecruitmentVisible?: boolean
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
export const Welcome = ({
|
|
17
|
-
|
|
9
|
+
export const Welcome = ({
|
|
10
|
+
sx,
|
|
11
|
+
isRecruitmentVisible,
|
|
12
|
+
...props
|
|
13
|
+
}: WelcomeProps) => {
|
|
14
|
+
const { rasaSpace } = useOurTheme()
|
|
18
15
|
|
|
19
16
|
const containerSx = {
|
|
20
17
|
...sx,
|
|
21
|
-
color: isRecruitmentVisible ?
|
|
22
|
-
bg: isRecruitmentVisible ?
|
|
23
|
-
bgGradient: isRecruitmentVisible
|
|
24
|
-
|
|
18
|
+
color: isRecruitmentVisible ? 'black' : 'neutral.50',
|
|
19
|
+
bg: isRecruitmentVisible ? 'white' : undefined,
|
|
20
|
+
bgGradient: isRecruitmentVisible
|
|
21
|
+
? undefined
|
|
22
|
+
: 'linear(to-b, #4E61E1, #7622D2)',
|
|
23
|
+
}
|
|
25
24
|
|
|
26
25
|
const linkSx = {
|
|
27
26
|
flexGrow: 0,
|
|
28
|
-
color: isRecruitmentVisible ?
|
|
29
|
-
textDecoration:
|
|
27
|
+
color: isRecruitmentVisible ? '#0000EE' : 'neutral.50',
|
|
28
|
+
textDecoration: 'underline',
|
|
30
29
|
_hover: {
|
|
31
|
-
color: isRecruitmentVisible
|
|
32
|
-
? "link.visited"
|
|
33
|
-
: "neutral.400",
|
|
30
|
+
color: isRecruitmentVisible ? 'link.visited' : 'neutral.400',
|
|
34
31
|
},
|
|
35
|
-
}
|
|
32
|
+
}
|
|
36
33
|
|
|
37
34
|
return (
|
|
38
35
|
<Flex sx={containerSx} {...props}>
|
|
@@ -40,21 +37,21 @@ export const Welcome = ({ sx, isRecruitmentVisible, ...props }: WelcomeProps) =>
|
|
|
40
37
|
<Heading as="h1" size="xl" mb={rasaSpace[1]}>
|
|
41
38
|
Rasa Inspector
|
|
42
39
|
</Heading>
|
|
43
|
-
<Text as="span">
|
|
44
|
-
New to the Inspector?
|
|
45
|
-
</Text>
|
|
40
|
+
<Text as="span">New to the Inspector?</Text>
|
|
46
41
|
<Link
|
|
47
42
|
sx={linkSx}
|
|
48
43
|
href="https://rasa.com/docs/rasa-pro/production/inspect-assistant/"
|
|
49
44
|
target="_blank"
|
|
50
45
|
ml={rasaSpace[0.25]}
|
|
51
|
-
>
|
|
46
|
+
>
|
|
47
|
+
Browse the docs
|
|
48
|
+
</Link>
|
|
52
49
|
</Box>
|
|
53
50
|
{isRecruitmentVisible ? (
|
|
54
|
-
<RasaLogoDark sx={{ flexShrink: 0, marginLeft:
|
|
51
|
+
<RasaLogoDark sx={{ flexShrink: 0, marginLeft: 'auto' }} />
|
|
55
52
|
) : (
|
|
56
|
-
<RasaLogo sx={{ flexShrink: 0, marginLeft:
|
|
53
|
+
<RasaLogo sx={{ flexShrink: 0, marginLeft: 'auto' }} />
|
|
57
54
|
)}
|
|
58
55
|
</Flex>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
const bufferSize = 128
|
|
2
|
+
const sampleRate = 8000
|
|
3
|
+
const audioOptions = {
|
|
4
|
+
audio: {
|
|
5
|
+
echoCancellation: true,
|
|
6
|
+
noiseSuppression: true,
|
|
7
|
+
autoGainControl: true,
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const arrayBufferToBase64 = (buffer: ArrayBuffer): string => {
|
|
12
|
+
let binary = ''
|
|
13
|
+
const bytes = new Uint8Array(buffer)
|
|
14
|
+
const len = bytes.byteLength
|
|
15
|
+
for (let i = 0; i < len; i++) {
|
|
16
|
+
binary += String.fromCharCode(bytes[i])
|
|
17
|
+
}
|
|
18
|
+
return window.btoa(binary)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const base64ToArrayBuffer = (s: string): ArrayBuffer => {
|
|
22
|
+
const binary_string = window.atob(s)
|
|
23
|
+
const len = binary_string.length
|
|
24
|
+
const bytes = new Uint8Array(len)
|
|
25
|
+
for (let i = 0; i < len; i++) {
|
|
26
|
+
bytes[i] = binary_string.charCodeAt(i)
|
|
27
|
+
}
|
|
28
|
+
return bytes.buffer
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const floatToIntArray = (arr: Float32Array): Int32Array => {
|
|
32
|
+
// Convert Float Array [-1, 1] to full range int array
|
|
33
|
+
return Int32Array.from(arr, (x) => x * 0x7fffffff)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const intToFloatArray = (arr: Int32Array): Float32Array => {
|
|
37
|
+
return Float32Array.from(arr, (x) => x / 0x7fffffff)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Mark {
|
|
41
|
+
id: string
|
|
42
|
+
bytesToGo: number
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface AudioQueue {
|
|
46
|
+
buffer: Float32Array
|
|
47
|
+
marks: Array<Mark>
|
|
48
|
+
socket: WebSocket
|
|
49
|
+
write: (newAudio: Float32Array) => void
|
|
50
|
+
read: (nSamples: number) => Float32Array
|
|
51
|
+
length: () => number
|
|
52
|
+
addMarker: (id: string) => void
|
|
53
|
+
reduceMarkers: (bytesRead: number) => void
|
|
54
|
+
popMarkers: () => void
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const createAudioQueue = (socket: WebSocket): AudioQueue => {
|
|
58
|
+
return {
|
|
59
|
+
buffer: new Float32Array(0),
|
|
60
|
+
marks: new Array<Mark>(),
|
|
61
|
+
socket,
|
|
62
|
+
|
|
63
|
+
write: function (newAudio: Float32Array) {
|
|
64
|
+
const currentQLength = this.buffer.length
|
|
65
|
+
const newBuffer = new Float32Array(currentQLength + newAudio.length)
|
|
66
|
+
newBuffer.set(this.buffer, 0)
|
|
67
|
+
newBuffer.set(newAudio, currentQLength)
|
|
68
|
+
this.buffer = newBuffer
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
read: function (nSamples: number) {
|
|
72
|
+
const samplesToPlay = this.buffer.subarray(0, nSamples)
|
|
73
|
+
this.buffer = this.buffer.subarray(nSamples, this.buffer.length)
|
|
74
|
+
this.reduceMarkers(samplesToPlay.length)
|
|
75
|
+
this.popMarkers()
|
|
76
|
+
return samplesToPlay
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
length: function () {
|
|
80
|
+
return this.buffer.length
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
addMarker: function (id: string) {
|
|
84
|
+
this.marks.push({ id, bytesToGo: this.length() })
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
reduceMarkers: function (bytesRead: number) {
|
|
88
|
+
this.marks = this.marks.map((m) => {
|
|
89
|
+
return { id: m.id, bytesToGo: m.bytesToGo - bytesRead }
|
|
90
|
+
})
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
popMarkers: function () {
|
|
94
|
+
// marks are ordered
|
|
95
|
+
let popUpTo = 0
|
|
96
|
+
while (popUpTo < this.marks.length) {
|
|
97
|
+
if (this.marks[popUpTo].bytesToGo <= 0) {
|
|
98
|
+
popUpTo += 1
|
|
99
|
+
} else {
|
|
100
|
+
break
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const marksToPop = this.marks.slice(0, popUpTo)
|
|
104
|
+
this.marks = this.marks.slice(popUpTo, this.marks.length)
|
|
105
|
+
marksToPop.forEach((m) => {
|
|
106
|
+
if (this.socket.readyState === WebSocket.OPEN) {
|
|
107
|
+
this.socket.send(JSON.stringify({ marker: m.id }))
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const streamMicrophoneToServer = async (socket: WebSocket) => {
|
|
115
|
+
const audioContext = new AudioContext({ sampleRate })
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const audioStream = await navigator.mediaDevices.getUserMedia(audioOptions)
|
|
119
|
+
await audioContext.audioWorklet.addModule(
|
|
120
|
+
new URL('./microphone-processor.js', import.meta.url).href,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
const microphoneNode = new AudioWorkletNode(
|
|
124
|
+
audioContext,
|
|
125
|
+
'microphone-processor',
|
|
126
|
+
)
|
|
127
|
+
microphoneNode.port.onmessage = (event: MessageEvent) => {
|
|
128
|
+
const audioData = event.data as Float32Array
|
|
129
|
+
const message = JSON.stringify({
|
|
130
|
+
audio: arrayBufferToBase64(floatToIntArray(audioData).buffer),
|
|
131
|
+
})
|
|
132
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
133
|
+
socket.send(message)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const source = audioContext.createMediaStreamSource(audioStream)
|
|
137
|
+
source.connect(microphoneNode).connect(audioContext.destination)
|
|
138
|
+
} catch (err) {
|
|
139
|
+
console.error(err)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const setupAudioPlayback = async (socket: WebSocket): Promise<AudioQueue> => {
|
|
144
|
+
const audioQueue = createAudioQueue(socket)
|
|
145
|
+
const audioOutputContext = new AudioContext({ sampleRate })
|
|
146
|
+
|
|
147
|
+
// Resume the audio context (browsers often start it in suspended state)
|
|
148
|
+
if (audioOutputContext.state === 'suspended') {
|
|
149
|
+
await audioOutputContext.resume()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
await audioOutputContext.audioWorklet.addModule(
|
|
153
|
+
new URL('./playback-processor.js', import.meta.url).href,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
const playbackNode = new AudioWorkletNode(
|
|
157
|
+
audioOutputContext,
|
|
158
|
+
'playback-processor',
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
playbackNode.port.onmessage = (event: MessageEvent) => {
|
|
162
|
+
if (event.data === 'need-more-data') {
|
|
163
|
+
// Request more audio data from the queue
|
|
164
|
+
const audioData = audioQueue.length()
|
|
165
|
+
? audioQueue.read(bufferSize)
|
|
166
|
+
: new Float32Array(bufferSize)
|
|
167
|
+
|
|
168
|
+
if (!(audioData instanceof Float32Array)) {
|
|
169
|
+
console.error('audioData is invalid, sending silence.')
|
|
170
|
+
playbackNode.port.postMessage(new Float32Array(bufferSize))
|
|
171
|
+
} else if (audioData.length !== bufferSize) {
|
|
172
|
+
console.warn(
|
|
173
|
+
`audioData is too short (${audioData.length} samples), padding with silence`,
|
|
174
|
+
)
|
|
175
|
+
const padded = new Float32Array(bufferSize)
|
|
176
|
+
padded.set(audioData)
|
|
177
|
+
playbackNode.port.postMessage(padded)
|
|
178
|
+
} else {
|
|
179
|
+
playbackNode.port.postMessage(audioData)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
playbackNode.connect(audioOutputContext.destination)
|
|
185
|
+
|
|
186
|
+
return audioQueue
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const addDataToAudioQueue =
|
|
190
|
+
(audioQueue: AudioQueue) => (message: MessageEvent<any>) => {
|
|
191
|
+
try {
|
|
192
|
+
const data = JSON.parse(message.data.toString())
|
|
193
|
+
if (data['error']) {
|
|
194
|
+
console.error('Error from server:', data['error'])
|
|
195
|
+
}
|
|
196
|
+
if (data['audio']) {
|
|
197
|
+
const audioBytes = base64ToArrayBuffer(data['audio'])
|
|
198
|
+
const int32Data = new Int32Array(audioBytes)
|
|
199
|
+
const audioData = intToFloatArray(int32Data)
|
|
200
|
+
audioQueue.write(audioData)
|
|
201
|
+
} else if (data['marker']) {
|
|
202
|
+
audioQueue.addMarker(data['marker'])
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error('Error processing server incoming audio data:', error)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Constructs a WebSocket URL for browser audio from a base HTTP/HTTPS URL
|
|
211
|
+
*
|
|
212
|
+
* @param baseUrl - The base URL (e.g., "https://example.com" or "http://localhost:5005")
|
|
213
|
+
* @returns WebSocket URL for browser audio endpoint
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* getWebSocketUrl("https://example.com")
|
|
217
|
+
* // Returns: "wss://example.com/webhooks/browser_audio/websocket"
|
|
218
|
+
*
|
|
219
|
+
* getWebSocketUrl("http://localhost:5005")
|
|
220
|
+
* // Returns: "ws://localhost:5005/webhooks/browser_audio/websocket"
|
|
221
|
+
*
|
|
222
|
+
* @throws {TypeError} If baseUrl is not a valid URL
|
|
223
|
+
*/
|
|
224
|
+
function getWebSocketUrl(baseUrl: string) {
|
|
225
|
+
const url = new URL(baseUrl)
|
|
226
|
+
const wsProtocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
|
|
227
|
+
return `${wsProtocol}//${url.host}/webhooks/browser_audio/websocket`
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Creates a WebSocket connection for browser audio and streams microphone input to the server
|
|
232
|
+
*
|
|
233
|
+
* @param baseUrl - The base URL (e.g., "https://example.com" or "http://localhost:5005")
|
|
234
|
+
*/
|
|
235
|
+
export async function createAudioConnection(baseUrl: string) {
|
|
236
|
+
const websocketURL = getWebSocketUrl(baseUrl)
|
|
237
|
+
const socket = new WebSocket(websocketURL)
|
|
238
|
+
|
|
239
|
+
socket.onopen = async () => {
|
|
240
|
+
await streamMicrophoneToServer(socket)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const audioQueue = await setupAudioPlayback(socket)
|
|
244
|
+
socket.onmessage = addDataToAudioQueue(audioQueue)
|
|
245
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class MicrophoneProcessor extends AudioWorkletProcessor {
|
|
2
|
+
process(inputs) {
|
|
3
|
+
const input = inputs[0]
|
|
4
|
+
if (input.length > 0) {
|
|
5
|
+
const channelData = input[0]
|
|
6
|
+
this.port.postMessage(channelData)
|
|
7
|
+
}
|
|
8
|
+
return true
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
registerProcessor('microphone-processor', MicrophoneProcessor)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class PlaybackProcessor extends AudioWorkletProcessor {
|
|
2
|
+
constructor() {
|
|
3
|
+
super()
|
|
4
|
+
this.audioBuffer = new Float32Array(0)
|
|
5
|
+
|
|
6
|
+
// Set up message handling from the main thread
|
|
7
|
+
this.port.onmessage = (event) => {
|
|
8
|
+
this.audioBuffer = event.data
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Request initial audio data
|
|
12
|
+
this.port.postMessage('need-more-data')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
process(_, outputs) {
|
|
16
|
+
const output = outputs[0]
|
|
17
|
+
const channelData = output[0]
|
|
18
|
+
|
|
19
|
+
const availableSamples = this.audioBuffer.length
|
|
20
|
+
const requestedSamples = channelData.length
|
|
21
|
+
const samplesToCopy = Math.min(availableSamples, requestedSamples)
|
|
22
|
+
|
|
23
|
+
if (samplesToCopy > 0) {
|
|
24
|
+
channelData.set(this.audioBuffer.subarray(0, samplesToCopy))
|
|
25
|
+
this.audioBuffer = this.audioBuffer.subarray(samplesToCopy)
|
|
26
|
+
} else {
|
|
27
|
+
channelData.fill(0)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this.port.postMessage('need-more-data')
|
|
31
|
+
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
registerProcessor('playback-processor', PlaybackProcessor)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export const restartConversation = () => {
|
|
2
2
|
// unset the sender id from the query parameters
|
|
3
|
-
const url = new URL(window.location.href)
|
|
4
|
-
url.searchParams.delete(
|
|
5
|
-
window.history.pushState(null,
|
|
6
|
-
location.reload()
|
|
7
|
-
}
|
|
3
|
+
const url = new URL(window.location.href)
|
|
4
|
+
url.searchParams.delete('sender')
|
|
5
|
+
window.history.pushState(null, '', url.toString())
|
|
6
|
+
location.reload()
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
// Make the function available on the window object
|
|
10
10
|
declare global {
|
|
11
11
|
interface Window {
|
|
12
|
-
restartConversation: typeof restartConversation
|
|
12
|
+
restartConversation: typeof restartConversation
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
window.restartConversation = restartConversation
|
|
16
|
+
window.restartConversation = restartConversation
|