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.

Files changed (228) hide show
  1. rasa/__main__.py +3 -1
  2. rasa/api.py +4 -0
  3. rasa/cli/arguments/default_arguments.py +13 -1
  4. rasa/cli/arguments/train.py +2 -0
  5. rasa/cli/evaluate.py +1 -1
  6. rasa/cli/export.py +2 -2
  7. rasa/cli/inspect.py +8 -4
  8. rasa/cli/project_templates/default/config.yml +5 -32
  9. rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_cancels_during_a_correction.yml +1 -1
  10. rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_changes_mind_on_a_whim.yml +1 -1
  11. rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_handle.yml +1 -1
  12. rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_name.yml +1 -1
  13. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_adds_contact_to_their_list.yml +1 -1
  14. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_lists_contacts.yml +1 -1
  15. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact.yml +1 -1
  16. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact_from_list.yml +1 -1
  17. rasa/cli/project_templates/default/endpoints.yml +18 -2
  18. rasa/cli/scaffold.py +3 -4
  19. rasa/cli/studio/download.py +1 -1
  20. rasa/cli/studio/upload.py +0 -6
  21. rasa/cli/train.py +1 -0
  22. rasa/constants.py +2 -0
  23. rasa/core/agent.py +2 -2
  24. rasa/core/brokers/kafka.py +4 -0
  25. rasa/core/brokers/pika.py +4 -0
  26. rasa/core/brokers/sql.py +1 -1
  27. rasa/core/channels/channel.py +68 -5
  28. rasa/core/channels/inspector/.eslintrc.cjs +12 -6
  29. rasa/core/channels/inspector/.prettierrc +5 -0
  30. rasa/core/channels/inspector/README.md +10 -4
  31. rasa/core/channels/inspector/dist/assets/{arc-c7691751.js → arc-c4b064fc.js} +1 -1
  32. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-ab99dff7.js → blockDiagram-38ab4fdb-215b5026.js} +1 -1
  33. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-08c35a6b.js → c4Diagram-3d4e48cf-2b54a0a3.js} +1 -1
  34. rasa/core/channels/inspector/dist/assets/channel-3730f5fd.js +1 -0
  35. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-9e9c71c9.js → classDiagram-70f12bd4-daacea5f.js} +1 -1
  36. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-15e7e2bf.js → classDiagram-v2-f2320105-930d4dc2.js} +1 -1
  37. rasa/core/channels/inspector/dist/assets/clone-e847561e.js +1 -0
  38. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-9c105cb1.js → createText-2e5e7dd3-83c206ba.js} +1 -1
  39. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-77e89e48.js → edges-e0da2a9e-b0eb01d0.js} +1 -1
  40. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-7a011646.js → erDiagram-9861fffd-17586500.js} +1 -1
  41. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-b6f105ac.js → flowDb-956e92f1-be2a1776.js} +1 -1
  42. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-ce4f18c2.js → flowDiagram-66a62f08-c2120ebd.js} +1 -1
  43. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +1 -0
  44. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-cb5f6da4.js → flowchart-elk-definition-4a651766-a6ab5c48.js} +1 -1
  45. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-e4d19e28.js → ganttDiagram-c361ad54-ef613457.js} +1 -1
  46. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-727b1c33.js → gitGraphDiagram-72cf32ee-d59185b3.js} +1 -1
  47. rasa/core/channels/inspector/dist/assets/{graph-6e2ab9a7.js → graph-0f155405.js} +1 -1
  48. rasa/core/channels/inspector/dist/assets/{index-3862675e-84ec700f.js → index-3862675e-d5f1d1b7.js} +1 -1
  49. rasa/core/channels/inspector/dist/assets/{index-098a1a24.js → index-47737d3a.js} +162 -149
  50. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-78dda442.js → infoDiagram-f8f76790-b07d141f.js} +1 -1
  51. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-f1cc6dd1.js → journeyDiagram-49397b02-1936d429.js} +1 -1
  52. rasa/core/channels/inspector/dist/assets/{layout-d98dcd0c.js → layout-dde8d0f3.js} +1 -1
  53. rasa/core/channels/inspector/dist/assets/{line-838e3d82.js → line-0c2c7ee0.js} +1 -1
  54. rasa/core/channels/inspector/dist/assets/{linear-eae72406.js → linear-35dd89a4.js} +1 -1
  55. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-c96fd84b.js → mindmap-definition-fc14e90a-56192851.js} +1 -1
  56. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-c936d4e2.js → pieDiagram-8a3498a8-fc21ed78.js} +1 -1
  57. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-b338eb8f.js → quadrantDiagram-120e2f19-25e98518.js} +1 -1
  58. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-c6b6c0d5.js → requirementDiagram-deff3bca-546ff1f5.js} +1 -1
  59. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-b9372e19.js → sankeyDiagram-04a897e0-02d8b82d.js} +1 -1
  60. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-479e0a3f.js → sequenceDiagram-704730f1-3ca5a92e.js} +1 -1
  61. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-fd26eebc.js → stateDiagram-587899a1-128ea07c.js} +1 -1
  62. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-3233e0ae.js → stateDiagram-v2-d93cdb3a-95f290af.js} +1 -1
  63. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-1fdd392b.js → styles-6aaf32cf-4984898a.js} +1 -1
  64. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-6d7bfa1b.js → styles-9a916d00-1bf266ba.js} +1 -1
  65. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-f86aab11.js → styles-c10674c1-60521c63.js} +1 -1
  66. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-e3e49d7a.js → svgDrawCommon-08f97a94-a25b6e12.js} +1 -1
  67. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-6fe08b4d.js → timeline-definition-85554ec2-0fc086bf.js} +1 -1
  68. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-c2e06fd6.js → xychartDiagram-e933f94c-44ee592e.js} +1 -1
  69. rasa/core/channels/inspector/dist/index.html +1 -1
  70. rasa/core/channels/inspector/package.json +3 -1
  71. rasa/core/channels/inspector/src/App.tsx +92 -90
  72. rasa/core/channels/inspector/src/components/Chat.tsx +61 -36
  73. rasa/core/channels/inspector/src/components/DiagramFlow.tsx +40 -43
  74. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +57 -57
  75. rasa/core/channels/inspector/src/components/DialogueStack.tsx +36 -27
  76. rasa/core/channels/inspector/src/components/ExpandIcon.tsx +4 -4
  77. rasa/core/channels/inspector/src/components/FullscreenButton.tsx +7 -7
  78. rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +28 -12
  79. rasa/core/channels/inspector/src/components/NoActiveFlow.tsx +9 -9
  80. rasa/core/channels/inspector/src/components/RasaLogo.tsx +5 -5
  81. rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +55 -60
  82. rasa/core/channels/inspector/src/components/SaraDiagrams.tsx +5 -5
  83. rasa/core/channels/inspector/src/components/Slots.tsx +22 -22
  84. rasa/core/channels/inspector/src/components/Welcome.tsx +28 -31
  85. rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +245 -0
  86. rasa/core/channels/inspector/src/helpers/audio/microphone-processor.js +12 -0
  87. rasa/core/channels/inspector/src/helpers/audio/playback-processor.js +36 -0
  88. rasa/core/channels/inspector/src/helpers/conversation.ts +16 -0
  89. rasa/core/channels/inspector/src/helpers/formatters.test.ts +181 -181
  90. rasa/core/channels/inspector/src/helpers/formatters.ts +111 -111
  91. rasa/core/channels/inspector/src/helpers/utils.ts +78 -61
  92. rasa/core/channels/inspector/src/main.tsx +8 -8
  93. rasa/core/channels/inspector/src/theme/Button/Button.ts +8 -8
  94. rasa/core/channels/inspector/src/theme/Heading/Heading.ts +7 -7
  95. rasa/core/channels/inspector/src/theme/Input/Input.ts +9 -9
  96. rasa/core/channels/inspector/src/theme/Link/Link.ts +6 -6
  97. rasa/core/channels/inspector/src/theme/Modal/Modal.ts +13 -13
  98. rasa/core/channels/inspector/src/theme/Table/Table.tsx +10 -10
  99. rasa/core/channels/inspector/src/theme/Tooltip/Tooltip.ts +5 -5
  100. rasa/core/channels/inspector/src/theme/base/breakpoints.ts +7 -7
  101. rasa/core/channels/inspector/src/theme/base/colors.ts +64 -64
  102. rasa/core/channels/inspector/src/theme/base/fonts/fontFaces.css +21 -18
  103. rasa/core/channels/inspector/src/theme/base/radii.ts +8 -8
  104. rasa/core/channels/inspector/src/theme/base/shadows.ts +5 -5
  105. rasa/core/channels/inspector/src/theme/base/sizes.ts +5 -5
  106. rasa/core/channels/inspector/src/theme/base/space.ts +12 -12
  107. rasa/core/channels/inspector/src/theme/base/styles.ts +5 -5
  108. rasa/core/channels/inspector/src/theme/base/typography.ts +12 -12
  109. rasa/core/channels/inspector/src/theme/base/zIndices.ts +3 -3
  110. rasa/core/channels/inspector/src/theme/index.ts +38 -38
  111. rasa/core/channels/inspector/src/types.ts +56 -50
  112. rasa/core/channels/inspector/yarn.lock +5 -0
  113. rasa/core/channels/voice_ready/audiocodes.py +75 -32
  114. rasa/core/channels/voice_ready/twilio_voice.py +48 -1
  115. rasa/core/channels/voice_stream/tts/azure.py +11 -2
  116. rasa/core/channels/voice_stream/twilio_media_streams.py +101 -26
  117. rasa/core/channels/voice_stream/voice_channel.py +28 -2
  118. rasa/core/concurrent_lock_store.py +24 -10
  119. rasa/core/evaluation/marker_tracker_loader.py +1 -1
  120. rasa/core/exporter.py +1 -1
  121. rasa/core/lock_store.py +151 -60
  122. rasa/core/nlg/contextual_response_rephraser.py +4 -2
  123. rasa/core/nlg/summarize.py +1 -1
  124. rasa/core/persistor.py +55 -20
  125. rasa/core/policies/enterprise_search_policy.py +7 -4
  126. rasa/core/policies/intentless_policy.py +15 -9
  127. rasa/core/processor.py +2 -2
  128. rasa/core/run.py +7 -2
  129. rasa/core/{auth_retry_tracker_store.py → tracker_stores/auth_retry_tracker_store.py} +5 -1
  130. rasa/core/tracker_stores/dynamo_tracker_store.py +218 -0
  131. rasa/core/tracker_stores/mongo_tracker_store.py +206 -0
  132. rasa/core/tracker_stores/redis_tracker_store.py +219 -0
  133. rasa/core/tracker_stores/sql_tracker_store.py +555 -0
  134. rasa/core/tracker_stores/tracker_store.py +805 -0
  135. rasa/core/utils.py +6 -0
  136. rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -3
  137. rasa/dialogue_understanding/commands/clarify_command.py +2 -2
  138. rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
  139. rasa/dialogue_understanding/generator/constants.py +2 -2
  140. rasa/dialogue_understanding/generator/llm_based_command_generator.py +1 -1
  141. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +33 -12
  142. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +2 -2
  143. rasa/dialogue_understanding_test/du_test_case.py +16 -8
  144. rasa/hooks.py +2 -2
  145. rasa/keys +1 -0
  146. rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -2
  147. rasa/model_manager/config.py +3 -1
  148. rasa/model_manager/model_api.py +1 -2
  149. rasa/model_manager/runner_service.py +8 -4
  150. rasa/model_manager/trainer_service.py +1 -0
  151. rasa/model_training.py +12 -3
  152. rasa/nlu/extractors/crf_entity_extractor.py +66 -16
  153. rasa/plugin.py +1 -4
  154. rasa/server.py +6 -2
  155. rasa/shared/constants.py +4 -0
  156. rasa/shared/core/domain.py +165 -11
  157. rasa/shared/core/events.py +68 -2
  158. rasa/shared/core/flows/flow.py +155 -131
  159. rasa/shared/core/flows/flow_step.py +19 -3
  160. rasa/shared/core/flows/flow_step_links.py +15 -0
  161. rasa/shared/core/flows/flow_step_sequence.py +6 -0
  162. rasa/shared/core/flows/nlu_trigger.py +13 -0
  163. rasa/shared/core/flows/steps/action.py +7 -4
  164. rasa/shared/core/flows/steps/call.py +11 -4
  165. rasa/shared/core/flows/steps/collect.py +27 -6
  166. rasa/shared/core/flows/steps/internal.py +6 -1
  167. rasa/shared/core/flows/steps/link.py +7 -4
  168. rasa/shared/core/flows/steps/no_operation.py +7 -4
  169. rasa/shared/core/flows/steps/set_slots.py +8 -4
  170. rasa/shared/core/flows/yaml_flows_io.py +106 -5
  171. rasa/shared/importers/importer.py +8 -0
  172. rasa/shared/providers/_configs/azure_openai_client_config.py +4 -0
  173. rasa/shared/providers/_configs/openai_client_config.py +4 -0
  174. rasa/shared/providers/_utils.py +83 -0
  175. rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
  176. rasa/shared/providers/llm/_base_litellm_client.py +11 -5
  177. rasa/shared/providers/llm/azure_openai_llm_client.py +6 -68
  178. rasa/shared/providers/router/_base_litellm_router_client.py +53 -1
  179. rasa/shared/utils/common.py +42 -0
  180. rasa/studio/download/__init__.py +0 -0
  181. rasa/studio/download/domains.py +49 -0
  182. rasa/studio/download/download.py +439 -0
  183. rasa/studio/download/flows.py +359 -0
  184. rasa/studio/results_logger.py +6 -1
  185. rasa/studio/upload.py +69 -5
  186. rasa/telemetry.py +2 -2
  187. rasa/tracing/config.py +1 -1
  188. rasa/tracing/instrumentation/attribute_extractors.py +1 -1
  189. rasa/tracing/instrumentation/instrumentation.py +1 -1
  190. rasa/utils/common.py +36 -0
  191. rasa/utils/endpoints.py +22 -1
  192. rasa/utils/licensing.py +2 -3
  193. rasa/validator.py +1 -2
  194. rasa/version.py +1 -1
  195. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/METADATA +10 -10
  196. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/RECORD +213 -210
  197. rasa/cli/project_templates/calm/config.yml +0 -10
  198. rasa/cli/project_templates/calm/credentials.yml +0 -33
  199. rasa/cli/project_templates/calm/endpoints.yml +0 -58
  200. rasa/cli/project_templates/default/actions/actions.py +0 -27
  201. rasa/cli/project_templates/default/data/nlu.yml +0 -91
  202. rasa/cli/project_templates/default/data/rules.yml +0 -13
  203. rasa/cli/project_templates/default/data/stories.yml +0 -30
  204. rasa/cli/project_templates/default/domain.yml +0 -34
  205. rasa/cli/project_templates/default/tests/test_stories.yml +0 -91
  206. rasa/core/channels/inspector/dist/assets/channel-11268142.js +0 -1
  207. rasa/core/channels/inspector/dist/assets/clone-ff7f2ce7.js +0 -1
  208. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-cba7ae20.js +0 -1
  209. rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -191
  210. rasa/core/tracker_store.py +0 -1792
  211. rasa/studio/download.py +0 -489
  212. /rasa/cli/project_templates/{calm → default}/actions/action_template.py +0 -0
  213. /rasa/cli/project_templates/{calm → default}/actions/add_contact.py +0 -0
  214. /rasa/cli/project_templates/{calm → default}/actions/db.py +0 -0
  215. /rasa/cli/project_templates/{calm → default}/actions/list_contacts.py +0 -0
  216. /rasa/cli/project_templates/{calm → default}/actions/remove_contact.py +0 -0
  217. /rasa/cli/project_templates/{calm → default}/data/flows/add_contact.yml +0 -0
  218. /rasa/cli/project_templates/{calm → default}/data/flows/list_contacts.yml +0 -0
  219. /rasa/cli/project_templates/{calm → default}/data/flows/remove_contact.yml +0 -0
  220. /rasa/cli/project_templates/{calm → default}/db/contacts.json +0 -0
  221. /rasa/cli/project_templates/{calm → default}/domain/add_contact.yml +0 -0
  222. /rasa/cli/project_templates/{calm → default}/domain/list_contacts.yml +0 -0
  223. /rasa/cli/project_templates/{calm → default}/domain/remove_contact.yml +0 -0
  224. /rasa/cli/project_templates/{calm → default}/domain/shared.yml +0 -0
  225. /rasa/{cli/project_templates/calm/actions → core/tracker_stores}/__init__.py +0 -0
  226. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/NOTICE +0 -0
  227. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/WHEEL +0 -0
  228. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/entry_points.txt +0 -0
rasa/__main__.py CHANGED
@@ -9,6 +9,7 @@ from rasa_sdk import __version__ as rasa_sdk_version
9
9
 
10
10
  import rasa.telemetry
11
11
  import rasa.utils.io
12
+ import rasa.utils.licensing
12
13
  import rasa.utils.tensorflow.environment as tf_env
13
14
  from rasa import version
14
15
  from rasa.cli import (
@@ -105,11 +106,12 @@ def main(raw_arguments: Optional[List[str]] = None) -> None:
105
106
  raw_arguments: Arguments to parse. If not provided,
106
107
  arguments will be taken from the command line.
107
108
  """
109
+ rasa.utils.licensing.validate_license_from_env()
110
+
108
111
  warn_if_rasa_plus_package_installed()
109
112
  parse_last_positional_argument_as_model_path()
110
113
  arg_parser = create_argument_parser()
111
114
  cmdline_arguments = arg_parser.parse_args(raw_arguments)
112
-
113
115
  log_level = getattr(cmdline_arguments, "loglevel", None)
114
116
  logging_config_file = getattr(cmdline_arguments, "logging_config_file", None)
115
117
  configure_logging_and_warnings(
rasa/api.py CHANGED
@@ -81,6 +81,7 @@ def train(
81
81
  remote_storage: Optional[StorageType] = None,
82
82
  file_importer: Optional["TrainingDataImporter"] = None,
83
83
  keep_local_model_copy: bool = False,
84
+ remote_root_only: bool = False,
84
85
  ) -> "TrainingResult":
85
86
  """Runs Rasa Core and NLU training in `async` loop.
86
87
 
@@ -108,6 +109,8 @@ def train(
108
109
  If it is not provided, a new instance will be created.
109
110
  keep_local_model_copy: If `True` the model will be stored locally even if
110
111
  remote storage is configured.
112
+ remote_root_only: If `True`, the model will be stored in the root of the
113
+ remote model storage.
111
114
 
112
115
  Returns:
113
116
  An instance of `TrainingResult`.
@@ -131,6 +134,7 @@ def train(
131
134
  remote_storage=remote_storage,
132
135
  file_importer=file_importer,
133
136
  keep_local_model_copy=keep_local_model_copy,
137
+ remote_root_only=remote_root_only,
134
138
  )
135
139
  )
136
140
 
@@ -172,7 +172,7 @@ def add_remote_storage_param(
172
172
  ) -> None:
173
173
  parser.add_argument(
174
174
  "--remote-storage",
175
- help="Remote storage which should be used to store/load the model."
175
+ help="Remote storage which should be used to store/load the model. "
176
176
  f"Supported storages are: {RemoteStorageType.list()}. "
177
177
  "You can also provide your own implementation of the `Persistor` interface.",
178
178
  required=required,
@@ -180,6 +180,18 @@ def add_remote_storage_param(
180
180
  )
181
181
 
182
182
 
183
+ def add_remote_root_only_param(
184
+ parser: argparse.ArgumentParser, required: bool = False
185
+ ) -> None:
186
+ parser.add_argument(
187
+ "--remote-root-only",
188
+ action="store_true",
189
+ help="If set, models will be stored only at the root directory "
190
+ "of the remote storage.",
191
+ required=required,
192
+ )
193
+
194
+
183
195
  def parse_remote_storage_arg(value: str) -> StorageType:
184
196
  try:
185
197
  return parse_remote_storage(value)
@@ -7,6 +7,7 @@ from rasa.cli.arguments.default_arguments import (
7
7
  add_endpoint_param,
8
8
  add_nlu_data_param,
9
9
  add_out_param,
10
+ add_remote_root_only_param,
10
11
  add_remote_storage_param,
11
12
  add_stories_param,
12
13
  )
@@ -41,6 +42,7 @@ def set_train_arguments(parser: argparse.ArgumentParser) -> None:
41
42
  parser, help_text="Configuration file for the connectors as a yml file."
42
43
  )
43
44
  add_remote_storage_param(parser)
45
+ add_remote_root_only_param(parser)
44
46
 
45
47
 
46
48
  def set_train_core_arguments(parser: argparse.ArgumentParser) -> None:
rasa/cli/evaluate.py CHANGED
@@ -8,7 +8,7 @@ from rasa import telemetry
8
8
  from rasa.cli import SubParsersAction
9
9
  from rasa.core.evaluation.marker_base import Marker, OperatorMarker
10
10
  from rasa.core.evaluation.marker_tracker_loader import MarkerTrackerLoader
11
- from rasa.core.tracker_store import TrackerStore
11
+ from rasa.core.tracker_stores.tracker_store import TrackerStore
12
12
  from rasa.core.utils import AvailableEndpoints
13
13
  from rasa.shared.core.domain import Domain
14
14
 
rasa/cli/export.py CHANGED
@@ -18,7 +18,7 @@ from rasa.shared.exceptions import RasaException
18
18
  if typing.TYPE_CHECKING:
19
19
  from rasa.core.brokers.broker import EventBroker
20
20
  from rasa.core.exporter import Exporter
21
- from rasa.core.tracker_store import TrackerStore
21
+ from rasa.core.tracker_stores.tracker_store import TrackerStore
22
22
  from rasa.core.utils import AvailableEndpoints
23
23
 
24
24
  logger = logging.getLogger(__name__)
@@ -67,7 +67,7 @@ def _get_tracker_store(endpoints: "AvailableEndpoints") -> "TrackerStore":
67
67
  f"Exiting. "
68
68
  )
69
69
 
70
- from rasa.core.tracker_store import TrackerStore
70
+ from rasa.core.tracker_stores.tracker_store import TrackerStore
71
71
 
72
72
  return TrackerStore.create(endpoints.tracker_store)
73
73
 
rasa/cli/inspect.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import argparse
2
2
  import webbrowser
3
3
  from asyncio import AbstractEventLoop
4
- from typing import List, Text
4
+ from typing import List, Optional, Text
5
5
 
6
6
  from sanic import Sanic
7
7
 
@@ -50,10 +50,14 @@ def add_subparser(
50
50
  remove_argument_from_parser(inspect_parser, "--enable-api")
51
51
 
52
52
 
53
- async def open_inspector_in_browser(server_url: Text, voice: bool = False) -> None:
53
+ async def open_inspector_in_browser(
54
+ server_url: Text,
55
+ voice: bool = False,
56
+ token: Optional[Text] = None,
57
+ ) -> None:
54
58
  """Opens the rasa inspector in the default browser."""
55
59
  channel = "socketio" if not voice else "browser_audio"
56
- webbrowser.open(f"{server_url}/webhooks/{channel}/inspect.html")
60
+ webbrowser.open(f"{server_url}/webhooks/{channel}/inspect.html?token={token}")
57
61
 
58
62
 
59
63
  def inspect(args: argparse.Namespace) -> None:
@@ -65,7 +69,7 @@ def inspect(args: argparse.Namespace) -> None:
65
69
  async def after_start_hook_open_inspector(_: Sanic, __: AbstractEventLoop) -> None:
66
70
  """Hook to open the browser on server start."""
67
71
  server_url = constants.DEFAULT_SERVER_FORMAT.format("http", args.port)
68
- await open_inspector_in_browser(server_url, args.voice)
72
+ await open_inspector_in_browser(server_url, args.voice, args.auth_token)
69
73
 
70
74
  # the following arguments are not exposed to the user
71
75
  if args.voice:
@@ -1,44 +1,17 @@
1
1
  # The config recipe.
2
- # https://rasa.com/docs/rasa-pro/nlu-based-assistants/model-configuration/
3
2
  recipe: default.v1
4
3
 
5
4
  # The assistant project unique identifier
6
5
  # This default value must be replaced with a unique assistant name within your deployment
7
6
  assistant_id: placeholder_default
8
7
 
9
- # Configuration for Rasa NLU.
10
- # https://rasa.com/docs/rasa-pro/nlu-based-assistants/components/
11
8
  language: en
12
-
13
9
  pipeline:
14
- # # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
15
- # # If you'd like to customize it, uncomment and adjust the pipeline.
16
- # # See https://rasa.com/docs/rasa-pro/nlu-based-assistants/tuning-your-model for more information.
17
- # - name: WhitespaceTokenizer
18
- # - name: RegexFeaturizer
19
- # - name: LexicalSyntacticFeaturizer
20
- # - name: CountVectorsFeaturizer
21
- # - name: CountVectorsFeaturizer
22
- # analyzer: char_wb
23
- # min_ngram: 1
24
- # max_ngram: 4
25
- # - name: DIETClassifier
26
- # epochs: 100
27
- # - name: EntitySynonymMapper
28
- # - name: ResponseSelector
29
- # epochs: 100
30
- # - name: FallbackClassifier
31
- # threshold: 0.3
32
- # ambiguity_threshold: 0.1
10
+ - name: CompactLLMCommandGenerator
11
+ llm:
12
+ model_group: openai-gpt-4o
33
13
 
34
14
  # Configuration for Rasa Core.
35
- # https://rasa.com/docs/rasa-pro/concepts/policies/policy-overview/
36
15
  policies:
37
- # # No configuration for policies was provided. The following default policies were used to train your model.
38
- # # If you'd like to customize them, uncomment and adjust the policies.
39
- # # See https://rasa.com/docs/rasa-pro/concepts/policies/policy-overview/ for more information.
40
- # - name: MemoizationPolicy
41
- # - name: TEDPolicy
42
- # max_history: 5
43
- # epochs: 100
44
- # - name: RulePolicy
16
+ - name: FlowPolicy
17
+ - name: IntentlessPolicy
@@ -13,4 +13,4 @@ test_cases:
13
13
  - utter: utter_corrected_previous_input
14
14
  - utter: utter_ask_add_contact_name
15
15
  - user: I changed my mind, stop.
16
- - utter: utter_flow_cancelled_rasa
16
+ - utter: utter_flow_cancelled_rasa
@@ -4,4 +4,4 @@ test_cases:
4
4
  - user: I want to add contact
5
5
  - utter: utter_ask_add_contact_handle
6
6
  - user: Stop
7
- - utter: utter_flow_cancelled_rasa
7
+ - utter: utter_flow_cancelled_rasa
@@ -17,4 +17,4 @@ test_cases:
17
17
  - add_contact_name: "Barbar"
18
18
  - utter: utter_ask_add_contact_confirmation
19
19
  - user: Yes
20
- - utter: utter_contact_added
20
+ - utter: utter_contact_added
@@ -16,4 +16,4 @@ test_cases:
16
16
  - utter: utter_corrected_previous_input
17
17
  - utter: utter_ask_add_contact_confirmation
18
18
  - user: Yes
19
- - utter: utter_contact_added
19
+ - utter: utter_contact_added
@@ -12,4 +12,4 @@ test_cases:
12
12
  - add_contact_name: Bart
13
13
  - utter: utter_ask_add_contact_confirmation
14
14
  - user: Yes
15
- - utter: utter_contact_added
15
+ - utter: utter_contact_added
@@ -2,4 +2,4 @@ test_cases:
2
2
  - test_case: user lists their contacts
3
3
  steps:
4
4
  - user: Please show me my contacts
5
- - utter: utter_list_contacts
5
+ - utter: utter_list_contacts
@@ -8,4 +8,4 @@ test_cases:
8
8
  - remove_contact_handle: "@MaryLu"
9
9
  - utter: utter_ask_remove_contact_confirmation
10
10
  - user: Yes
11
- - utter: utter_remove_contact_success
11
+ - utter: utter_remove_contact_success
@@ -9,4 +9,4 @@ test_cases:
9
9
  - remove_contact_handle: "@MaryLu"
10
10
  - utter: utter_ask_remove_contact_confirmation
11
11
  - user: yes
12
- - utter: utter_remove_contact_success
12
+ - utter: utter_remove_contact_success
@@ -10,8 +10,8 @@
10
10
  # Server which runs your custom actions.
11
11
  # https://rasa.com/docs/rasa-pro/concepts/custom-actions
12
12
 
13
- #action_endpoint:
14
- # url: "http://localhost:5055/webhook"
13
+ action_endpoint:
14
+ actions_module: "actions"
15
15
 
16
16
  # Tracker store which is used to store the conversations.
17
17
  # By default the conversations are stored in memory.
@@ -40,3 +40,19 @@
40
40
  # username: username
41
41
  # password: password
42
42
  # queue: queue
43
+
44
+ # The lines below activate contextual rephrasing, using the default OpenAI language model.
45
+ # Ensure the OPENAI_API_KEY is set to prevent any missing API key errors.
46
+ # For more details, refer to the documentation:
47
+ # https://rasa.com/docs/rasa-pro/concepts/contextual-response-rephraser
48
+ # To enable the rephraser, remove the comment symbols in the lines below.
49
+ #nlg:
50
+ # type: rephrase
51
+
52
+ model_groups:
53
+ - id: openai-gpt-4o
54
+ models:
55
+ - provider: openai
56
+ model: gpt-4o-2024-11-20
57
+ request_timeout: 7
58
+ max_tokens: 256
rasa/cli/scaffold.py CHANGED
@@ -20,18 +20,17 @@ from rasa.shared.utils.cli import print_error_and_exit, print_success
20
20
 
21
21
 
22
22
  class ProjectTemplateName(Enum):
23
- """Enum of the different project templates."""
23
+ """Enum of CALM project templates."""
24
24
 
25
25
  DEFAULT = "default"
26
26
  TUTORIAL = "tutorial"
27
- CALM = "calm"
28
27
 
29
28
  def __str__(self) -> str:
30
29
  return self.value
31
30
 
32
31
 
33
32
  template_domain_path = defaultdict(lambda: DEFAULT_DOMAIN_PATH)
34
- template_domain_path[ProjectTemplateName.CALM] = "domain"
33
+ template_domain_path[ProjectTemplateName.DEFAULT] = "domain"
35
34
 
36
35
 
37
36
  def add_subparser(
@@ -64,7 +63,7 @@ def add_subparser(
64
63
  "--template",
65
64
  type=ProjectTemplateName,
66
65
  choices=list(ProjectTemplateName),
67
- default=ProjectTemplateName.CALM,
66
+ default=ProjectTemplateName.DEFAULT,
68
67
  help="Select the template to use for the project.",
69
68
  )
70
69
  scaffold_parser.set_defaults(func=run)
@@ -8,7 +8,7 @@ from rasa.cli.arguments.default_arguments import (
8
8
  )
9
9
  from rasa.cli.arguments.train import add_data_param, add_domain_param
10
10
  from rasa.shared.constants import DEFAULT_CONFIG_PATH, DEFAULT_ENDPOINTS_PATH
11
- from rasa.studio.download import handle_download
11
+ from rasa.studio.download.download import handle_download
12
12
 
13
13
 
14
14
  def add_subparser(
rasa/cli/studio/upload.py CHANGED
@@ -54,9 +54,3 @@ def set_upload_arguments(parser: argparse.ArgumentParser) -> None:
54
54
  type=str,
55
55
  help="Name of intents to upload to Rasa Studio",
56
56
  )
57
-
58
- parser.add_argument(
59
- "--calm",
60
- action="store_true",
61
- help="If set, creates a new CALM assistant in Rasa Studio.",
62
- )
rasa/cli/train.py CHANGED
@@ -155,6 +155,7 @@ def run_training(args: argparse.Namespace, can_exit: bool = False) -> Optional[T
155
155
  remote_storage=args.remote_storage,
156
156
  file_importer=training_data_importer,
157
157
  keep_local_model_copy=args.keep_local_model_copy,
158
+ remote_root_only=args.remote_root_only,
158
159
  )
159
160
  if training_result.code != 0 and can_exit:
160
161
  display_research_study_prompt()
rasa/constants.py CHANGED
@@ -42,3 +42,5 @@ DEFAULT_BUCKET_NAME = "rasa-models"
42
42
 
43
43
  HTTP_STATUS_FORBIDDEN = 403
44
44
  HTTP_STATUS_NOT_FOUND = 404
45
+
46
+ RASA_REMOTE_STORAGE_ENV_VAR_NAME = "RASA_REMOTE_STORAGE"
rasa/core/agent.py CHANGED
@@ -22,7 +22,7 @@ from rasa.core.nlg import NaturalLanguageGenerator, TemplatedNaturalLanguageGene
22
22
  from rasa.core.persistor import StorageType
23
23
  from rasa.core.policies.policy import PolicyPrediction
24
24
  from rasa.core.processor import MessageProcessor
25
- from rasa.core.tracker_store import (
25
+ from rasa.core.tracker_stores.tracker_store import (
26
26
  FailSafeTrackerStore,
27
27
  InMemoryTrackerStore,
28
28
  TrackerStore,
@@ -215,7 +215,7 @@ async def load_agent(
215
215
  The instantiated `Agent` or `None`.
216
216
  """
217
217
  from rasa.core.brokers.broker import EventBroker
218
- from rasa.core.tracker_store import TrackerStore
218
+ from rasa.core.tracker_stores.tracker_store import TrackerStore
219
219
 
220
220
  tracker_store = None
221
221
  lock_store = None
@@ -94,6 +94,10 @@ class KafkaEventBroker(EventBroker):
94
94
  self.queue_size = kwargs.get("queue_size")
95
95
  self.ssl_check_hostname = "https" if ssl_check_hostname else None
96
96
 
97
+ # PII management attributes
98
+ self.stream_pii = kwargs.get("stream_pii", True)
99
+ self.anonymization_topics = kwargs.get("anonymization_topics", [])
100
+
97
101
  # Async producer implementation followed from confluent-kafka asyncio example:
98
102
  # https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/asyncio_example.py#L88 # noqa: E501
99
103
  self._loop = asyncio.get_event_loop()
rasa/core/brokers/pika.py CHANGED
@@ -93,6 +93,10 @@ class PikaEventBroker(EventBroker):
93
93
  self._connection: Optional[aio_pika.abc.AbstractRobustConnection] = None
94
94
  self._exchange: Optional[aio_pika.RobustExchange] = None
95
95
 
96
+ # PII related attributes
97
+ self.stream_pii = kwargs.get("stream_pii", True)
98
+ self.anonymization_queues = kwargs.get("anonymization_queues", [])
99
+
96
100
  @staticmethod
97
101
  def _get_queues_from_args(
98
102
  queues_arg: Union[List[Text], Tuple[Text, ...], Text, None],
rasa/core/brokers/sql.py CHANGED
@@ -46,7 +46,7 @@ class SQLEventBroker(EventBroker):
46
46
  """Initializes `SQLBrokerEvent`."""
47
47
  import sqlalchemy.orm
48
48
 
49
- from rasa.core.tracker_store import SQLTrackerStore
49
+ from rasa.core.tracker_stores.sql_tracker_store import SQLTrackerStore
50
50
 
51
51
  engine_url = SQLTrackerStore.get_db_url(
52
52
  dialect, host, port, db, username, password
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import hmac
2
4
  import json
3
5
  import logging
@@ -460,8 +462,50 @@ class CollectingOutputChannel(OutputChannel):
460
462
  await self._persist_message(self._message(recipient_id, custom=json_message))
461
463
 
462
464
 
463
- def requires_basic_auth(username: Optional[Text], password: Optional[Text]) -> Callable:
464
- """Decorator to require basic auth for a route."""
465
+ BASIC_AUTH_SCHEME = "Basic"
466
+
467
+
468
+ def create_auth_requested_response_provider(
469
+ realm: str,
470
+ ) -> Callable[[Request, Any, Any], ResponseWithAuthRequested]:
471
+ def _provider(
472
+ request: Request, *args: Any, **kwargs: Any
473
+ ) -> ResponseWithAuthRequested:
474
+ return ResponseWithAuthRequested(scheme=BASIC_AUTH_SCHEME, realm=realm)
475
+
476
+ return _provider
477
+
478
+
479
+ class ResponseWithAuthRequested(Unauthorized):
480
+ """Custom exception to request authentication."""
481
+
482
+ def __init__(self, scheme: str, realm: str) -> None:
483
+ super().__init__(
484
+ message="Authentication requested.", scheme=scheme, realm=realm
485
+ ) # type: ignore[no-untyped-call]
486
+
487
+
488
+ def requires_basic_auth(
489
+ username: Optional[Text],
490
+ password: Optional[Text],
491
+ auth_request_provider: Optional[Callable[[Request, Any, Any], Unauthorized]] = None,
492
+ ) -> Callable:
493
+ """Decorator to require basic auth for a route.
494
+
495
+ Args:
496
+ username: The username to check against.
497
+ password: The password to check against.
498
+ auth_request_provider: Optional function to provide a custom
499
+ response when authentication is requested. This function should
500
+ return an instance of `Unauthorized` with the necessary
501
+ authentication headers.
502
+ Returns:
503
+ A decorator that checks for basic authentication.
504
+
505
+ Raises:
506
+ Unauthorized: If the authentication fails or if authentication is
507
+ requested without necessary credentials (headers).
508
+ """
465
509
 
466
510
  def decorator(func: Callable) -> Callable:
467
511
  @wraps(func)
@@ -469,13 +513,32 @@ def requires_basic_auth(username: Optional[Text], password: Optional[Text]) -> C
469
513
  if not username or not password:
470
514
  return await func(request, *args, **kwargs)
471
515
 
472
- auth = request.headers.get("Authorization")
473
- if not auth or not auth.startswith("Basic "):
516
+ auth_header = request.headers.get("Authorization")
517
+
518
+ # Some systems will first send a request without an authorization header
519
+ # to check if the endpoint is available. In this case, we need to
520
+ # return am Unauthorized response with the necessary authorization header
521
+ # to indicate that the endpoint requires authorization.
522
+ if not auth_header and auth_request_provider:
523
+ # if the request does not contain an authorization header,
524
+ # we raise an exception to request authorization
525
+
526
+ exception = auth_request_provider(request, *args, **kwargs)
527
+ logger.debug(
528
+ f"Responding with {exception.status_code} and "
529
+ f"necessary auth headers {exception.headers}"
530
+ )
531
+ raise exception
532
+
533
+ if not auth_header or not auth_header.startswith("Basic "):
474
534
  logger.error("Missing or invalid authorization header.")
475
535
  raise Unauthorized("Missing or invalid authorization header.") # type: ignore[no-untyped-call]
476
536
 
477
537
  encoded = b64encode(f"{username}:{password}".encode()).decode()
478
- if not hmac.compare_digest(auth[6:], encoded):
538
+ username_password_digest: str = auth_header[len(BASIC_AUTH_SCHEME) :]
539
+ username_password_digest = username_password_digest.strip()
540
+
541
+ if not hmac.compare_digest(username_password_digest, encoded):
479
542
  logger.error("Invalid username or password.")
480
543
  raise Unauthorized("Invalid username or password.") # type: ignore[no-untyped-call]
481
544
 
@@ -5,6 +5,7 @@ module.exports = {
5
5
  "eslint:recommended",
6
6
  "plugin:@typescript-eslint/recommended",
7
7
  "plugin:react-hooks/recommended",
8
+ "plugin:prettier/recommended",
8
9
  ],
9
10
  ignorePatterns: [
10
11
  "dist",
@@ -16,10 +17,15 @@ module.exports = {
16
17
  ],
17
18
  parser: "@typescript-eslint/parser",
18
19
  plugins: ["react-refresh"],
19
- rules: {
20
- "react-refresh/only-export-components": [
21
- "warn",
22
- { allowConstantExport: true },
23
- ],
24
- },
20
+ overrides: [
21
+ {
22
+ files: ["*.ts", "*.tsx", "*.js", "*.jsx"],
23
+ rules: {
24
+ "react-refresh/only-export-components": [
25
+ "warn",
26
+ { allowConstantExport: true },
27
+ ],
28
+ },
29
+ },
30
+ ],
25
31
  };
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": false,
4
+ "trailingComma": "all"
5
+ }
@@ -6,7 +6,9 @@ A rapid prototyping tool for enterprise developer personas working in Rasa Pro b
6
6
 
7
7
  ### Prerequisites
8
8
 
9
- - Node JS v.16.x.x - Check how to install `node` [here](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs). Recommended using [`nvm`](https://github.com/nvm-sh/nvm).
9
+ - **Node.js**: Version **greater than 18.x.x and less than 20.x.x**.
10
+ - [How to install Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs)
11
+ - Recommended: Use [nvm](https://github.com/nvm-sh/nvm) for version management.
10
12
  - `yarn` version 1.x - Check how to install `yarn` [here](https://classic.yarnpkg.com/lang/en/docs/install/).
11
13
  - a running version of `rasa-plus`
12
14
  - a running action server (optional)
@@ -27,6 +29,7 @@ A rapid prototyping tool for enterprise developer personas working in Rasa Pro b
27
29
 
28
30
  The project can be built using the `yarn build` command. It will compile the code in the `/dist` folder.
29
31
  It is important to know that _without_ it, the page that will be served can:
32
+
30
33
  - return a 500 if the project has never been compiled before
31
34
  - show an outdated version if the project has been compiled before the changes we want to introduce
32
35
 
@@ -39,16 +42,19 @@ This is because the code within the [rasa-private](https://github.com/RasaHQ/ras
39
42
  ### Step-by-Step Guide
40
43
 
41
44
  1. **Make updates in [rasa-x](https://github.com/RasaHQ/rasa-x) repository:**
45
+
42
46
  - Make the necessary code changes.
43
47
  - Update the **npm** package version. This is done in the [src/rasa-chat/package.json](https://github.com/RasaHQ/rasa-x/blob/main/src/rasa-chat/package.json) file.
44
48
  - Merge the changes to the lastest version branch or to the `main` branch.
45
49
 
46
- 3. **Trigger the release GitHub action:**
50
+ 2. **Trigger the release GitHub action:**
51
+
47
52
  - Navigate to the [publish-rasa-chat](https://github.com/RasaHQ/rasa-x/blob/main/.github/workflows/publish-rasa-chat.yml) GitHub action within the [rasa-x](https://github.com/RasaHQ/rasa-x) repo and initiate the workflow.
48
53
 
49
- 4. **Monitor Deployment to npm:**
54
+ 3. **Monitor Deployment to npm:**
55
+
50
56
  - After the GitHub action successfully runs, the updated package will be deployed to npm. Confirm the deployment by visiting the package page on npm at [@rasahq/rasa-chat](https://www.npmjs.com/package/@rasahq/rasa-chat/).
51
57
 
52
- 5. **Update the [rasa-private](https://github.com/RasaHQ/rasa-private) Repository:**
58
+ 4. **Update the [rasa-private](https://github.com/RasaHQ/rasa-private) Repository:**
53
59
  - Download or copy the minified JavaScript from the `widget.js` file in the newly published npm package.
54
60
  - Replace the content in the [rasa-chat.js](https://github.com/RasaHQ/rasa-private/blob/main/rasa/core/channels/inspector/assets/rasa-chat.js) file with this new code to incorporate the updates.
@@ -1 +1 @@
1
- import{w as ln,c as H}from"./path-53f90ab3.js";import{aw as an,ax as V,ay as D,az as rn,aA as y,V as on,aB as K,aC as _,aD as un,aE as t,aF as sn,aG as tn,aH as fn}from"./index-098a1a24.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function mn(l){return l.endAngle}function pn(l){return l&&l.padAngle}function xn(l,h,z,E,v,A,I,a){var B=z-l,i=E-h,n=I-v,m=a-A,r=m*B-n*i;if(!(r*r<y))return r=(n*(h-A)-m*(l-v))/r,[l+r*B,h+r*i]}function W(l,h,z,E,v,A,I){var a=l-z,B=h-E,i=(I?A:-A)/K(a*a+B*B),n=i*B,m=-i*a,r=l+n,s=h+m,f=z+n,c=E+m,O=(r+f)/2,o=(s+c)/2,p=f-r,g=c-s,R=p*p+g*g,T=v-A,w=r*c-f*s,C=(g<0?-1:1)*K(fn(0,T*T*R-w*w)),F=(w*g-p*C)/R,G=(-w*p-g*C)/R,P=(w*g+p*C)/R,x=(-w*p+g*C)/R,d=F-O,e=G-o,u=P-O,S=x-o;return d*d+e*e>u*u+S*S&&(F=P,G=x),{cx:F,cy:G,x01:-n,y01:-m,x11:F*(v/T-1),y11:G*(v/T-1)}}function vn(){var l=cn,h=yn,z=H(0),E=null,v=gn,A=mn,I=pn,a=null,B=ln(i);function i(){var n,m,r=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-rn,c=A.apply(this,arguments)-rn,O=un(c-f),o=c>f;if(a||(a=n=B()),s<r&&(m=s,s=r,r=m),!(s>y))a.moveTo(0,0);else if(O>on-y)a.moveTo(s*V(f),s*D(f)),a.arc(0,0,s,f,c,!o),r>y&&(a.moveTo(r*V(c),r*D(c)),a.arc(0,0,r,c,f,o));else{var p=f,g=c,R=f,T=c,w=O,C=O,F=I.apply(this,arguments)/2,G=F>y&&(E?+E.apply(this,arguments):K(r*r+s*s)),P=_(un(s-r)/2,+z.apply(this,arguments)),x=P,d=P,e,u;if(G>y){var S=sn(G/r*D(F)),L=sn(G/s*D(F));(w-=S*2)>y?(S*=o?1:-1,R+=S,T-=S):(w=0,R=T=(f+c)/2),(C-=L*2)>y?(L*=o?1:-1,p+=L,g-=L):(C=0,p=g=(f+c)/2)}var j=s*V(p),J=s*D(p),M=r*V(T),N=r*D(T);if(P>y){var Q=s*V(g),U=s*D(g),X=r*V(R),Y=r*D(R),q;if(O<an)if(q=xn(j,J,X,Y,Q,U,M,N)){var Z=j-q[0],$=J-q[1],k=Q-q[0],b=U-q[1],nn=1/D(tn((Z*k+$*b)/(K(Z*Z+$*$)*K(k*k+b*b)))/2),en=K(q[0]*q[0]+q[1]*q[1]);x=_(P,(r-en)/(nn-1)),d=_(P,(s-en)/(nn+1))}else x=d=0}C>y?d>y?(e=W(X,Y,j,J,s,d,o),u=W(Q,U,M,N,s,d,o),a.moveTo(e.cx+e.x01,e.cy+e.y01),d<P?a.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(u.y01,u.x01),!o):(a.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(e.y11,e.x11),!o),a.arc(0,0,s,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),!o),a.arc(u.cx,u.cy,d,t(u.y11,u.x11),t(u.y01,u.x01),!o))):(a.moveTo(j,J),a.arc(0,0,s,p,g,!o)):a.moveTo(j,J),!(r>y)||!(w>y)?a.lineTo(M,N):x>y?(e=W(M,N,Q,U,r,-x,o),u=W(j,J,X,Y,r,-x,o),a.lineTo(e.cx+e.x01,e.cy+e.y01),x<P?a.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(u.y01,u.x01),!o):(a.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(e.y11,e.x11),!o),a.arc(0,0,r,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),o),a.arc(u.cx,u.cy,x,t(u.y11,u.x11),t(u.y01,u.x01),!o))):a.arc(0,0,r,T,R,o)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,m=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[V(m)*n,D(m)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:H(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:H(+n),i):h},i.cornerRadius=function(n){return arguments.length?(z=typeof n=="function"?n:H(+n),i):z},i.padRadius=function(n){return arguments.length?(E=n==null?null:typeof n=="function"?n:H(+n),i):E},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:H(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:H(+n),i):A},i.padAngle=function(n){return arguments.length?(I=typeof n=="function"?n:H(+n),i):I},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{vn as a};
1
+ import{w as ln,c as H}from"./path-53f90ab3.js";import{aw as an,ax as V,ay as D,az as rn,aA as y,V as on,aB as K,aC as _,aD as un,aE as t,aF as sn,aG as tn,aH as fn}from"./index-47737d3a.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function mn(l){return l.endAngle}function pn(l){return l&&l.padAngle}function xn(l,h,z,E,v,A,I,a){var B=z-l,i=E-h,n=I-v,m=a-A,r=m*B-n*i;if(!(r*r<y))return r=(n*(h-A)-m*(l-v))/r,[l+r*B,h+r*i]}function W(l,h,z,E,v,A,I){var a=l-z,B=h-E,i=(I?A:-A)/K(a*a+B*B),n=i*B,m=-i*a,r=l+n,s=h+m,f=z+n,c=E+m,O=(r+f)/2,o=(s+c)/2,p=f-r,g=c-s,R=p*p+g*g,T=v-A,w=r*c-f*s,C=(g<0?-1:1)*K(fn(0,T*T*R-w*w)),F=(w*g-p*C)/R,G=(-w*p-g*C)/R,P=(w*g+p*C)/R,x=(-w*p+g*C)/R,d=F-O,e=G-o,u=P-O,S=x-o;return d*d+e*e>u*u+S*S&&(F=P,G=x),{cx:F,cy:G,x01:-n,y01:-m,x11:F*(v/T-1),y11:G*(v/T-1)}}function vn(){var l=cn,h=yn,z=H(0),E=null,v=gn,A=mn,I=pn,a=null,B=ln(i);function i(){var n,m,r=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-rn,c=A.apply(this,arguments)-rn,O=un(c-f),o=c>f;if(a||(a=n=B()),s<r&&(m=s,s=r,r=m),!(s>y))a.moveTo(0,0);else if(O>on-y)a.moveTo(s*V(f),s*D(f)),a.arc(0,0,s,f,c,!o),r>y&&(a.moveTo(r*V(c),r*D(c)),a.arc(0,0,r,c,f,o));else{var p=f,g=c,R=f,T=c,w=O,C=O,F=I.apply(this,arguments)/2,G=F>y&&(E?+E.apply(this,arguments):K(r*r+s*s)),P=_(un(s-r)/2,+z.apply(this,arguments)),x=P,d=P,e,u;if(G>y){var S=sn(G/r*D(F)),L=sn(G/s*D(F));(w-=S*2)>y?(S*=o?1:-1,R+=S,T-=S):(w=0,R=T=(f+c)/2),(C-=L*2)>y?(L*=o?1:-1,p+=L,g-=L):(C=0,p=g=(f+c)/2)}var j=s*V(p),J=s*D(p),M=r*V(T),N=r*D(T);if(P>y){var Q=s*V(g),U=s*D(g),X=r*V(R),Y=r*D(R),q;if(O<an)if(q=xn(j,J,X,Y,Q,U,M,N)){var Z=j-q[0],$=J-q[1],k=Q-q[0],b=U-q[1],nn=1/D(tn((Z*k+$*b)/(K(Z*Z+$*$)*K(k*k+b*b)))/2),en=K(q[0]*q[0]+q[1]*q[1]);x=_(P,(r-en)/(nn-1)),d=_(P,(s-en)/(nn+1))}else x=d=0}C>y?d>y?(e=W(X,Y,j,J,s,d,o),u=W(Q,U,M,N,s,d,o),a.moveTo(e.cx+e.x01,e.cy+e.y01),d<P?a.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(u.y01,u.x01),!o):(a.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(e.y11,e.x11),!o),a.arc(0,0,s,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),!o),a.arc(u.cx,u.cy,d,t(u.y11,u.x11),t(u.y01,u.x01),!o))):(a.moveTo(j,J),a.arc(0,0,s,p,g,!o)):a.moveTo(j,J),!(r>y)||!(w>y)?a.lineTo(M,N):x>y?(e=W(M,N,Q,U,r,-x,o),u=W(j,J,X,Y,r,-x,o),a.lineTo(e.cx+e.x01,e.cy+e.y01),x<P?a.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(u.y01,u.x01),!o):(a.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(e.y11,e.x11),!o),a.arc(0,0,r,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),o),a.arc(u.cx,u.cy,x,t(u.y11,u.x11),t(u.y01,u.x01),!o))):a.arc(0,0,r,T,R,o)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,m=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[V(m)*n,D(m)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:H(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:H(+n),i):h},i.cornerRadius=function(n){return arguments.length?(z=typeof n=="function"?n:H(+n),i):z},i.padRadius=function(n){return arguments.length?(E=n==null?null:typeof n=="function"?n:H(+n),i):E},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:H(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:H(+n),i):A},i.padAngle=function(n){return arguments.length?(I=typeof n=="function"?n:H(+n),i):I},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{vn as a};