rasa-pro 3.10.15__py3-none-any.whl → 3.11.0__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 +31 -15
- rasa/api.py +12 -2
- rasa/cli/arguments/default_arguments.py +24 -4
- rasa/cli/arguments/run.py +15 -0
- rasa/cli/arguments/shell.py +5 -1
- rasa/cli/arguments/train.py +17 -9
- rasa/cli/evaluate.py +7 -7
- rasa/cli/inspect.py +19 -7
- rasa/cli/interactive.py +1 -0
- rasa/cli/project_templates/calm/config.yml +5 -7
- rasa/cli/project_templates/calm/endpoints.yml +15 -2
- rasa/cli/project_templates/tutorial/config.yml +8 -5
- rasa/cli/project_templates/tutorial/data/flows.yml +1 -1
- rasa/cli/project_templates/tutorial/data/patterns.yml +5 -0
- rasa/cli/project_templates/tutorial/domain.yml +14 -0
- rasa/cli/project_templates/tutorial/endpoints.yml +5 -0
- rasa/cli/run.py +7 -0
- rasa/cli/scaffold.py +4 -2
- rasa/cli/studio/upload.py +0 -15
- rasa/cli/train.py +14 -53
- rasa/cli/utils.py +14 -11
- rasa/cli/x.py +7 -7
- rasa/constants.py +3 -1
- rasa/core/actions/action.py +77 -33
- rasa/core/actions/action_hangup.py +29 -0
- rasa/core/actions/action_repeat_bot_messages.py +89 -0
- rasa/core/actions/e2e_stub_custom_action_executor.py +5 -1
- rasa/core/actions/http_custom_action_executor.py +4 -0
- rasa/core/agent.py +2 -2
- rasa/core/brokers/kafka.py +3 -1
- rasa/core/brokers/pika.py +3 -1
- rasa/core/channels/__init__.py +10 -6
- rasa/core/channels/channel.py +41 -4
- rasa/core/channels/development_inspector.py +150 -46
- rasa/core/channels/inspector/README.md +1 -1
- rasa/core/channels/inspector/dist/assets/{arc-b6e548fe.js → arc-bc141fb2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-fa03ac9e.js → c4Diagram-d0fbc5ce-be2db283.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-ee67392a.js → classDiagram-936ed81e-55366915.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-9b283fae.js → classDiagram-v2-c3cb15f1-bb529518.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-8b6fcc2a.js → createText-62fc7601-b0ec81d6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-22e77f4f.js → edges-f2ad444c-6166330c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-60ffc87f.js → erDiagram-9d236eb7-5ccc6a8e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-9dd802e4.js → flowDb-1972c806-fca3bfe4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-5fa1912f.js → flowDiagram-7ea5b25a-4739080f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-736177bf.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-622a1fd2.js → flowchart-elk-definition-abe16c3d-7c1b0e0f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-e285a63a.js → ganttDiagram-9b5ea136-772fd050.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-f237bdca.js → gitGraphDiagram-99d0ae7c-8eae1dc9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-4b03d70e.js → index-2c4b9a3b-f55afcdf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/index-e7cef9de.js +1317 -0
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-72a0fa5f.js → infoDiagram-736b4530-124d4a14.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-82218c41.js → journeyDiagram-df861f2b-7c4fae44.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-78cff630.js → layout-b9885fb6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-5038b469.js → line-7c59abb6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-c4fc4098.js → linear-4776f780.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-c33c8ea6.js → mindmap-definition-beec6740-2332c46c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-a8d03059.js → pieDiagram-dbbf0591-8fb39303.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-6a0e56b2.js → quadrantDiagram-4d7f4fd6-3c7180a2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-2dc7c7bd.js → requirementDiagram-6fc4c22a-e910bcb8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-2360fe39.js → sankeyDiagram-8f13d901-ead16c89.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-41b9f9ad.js → sequenceDiagram-b655622a-29a02a19.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-0aad326f.js → stateDiagram-59f0c015-042b3137.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-9847d984.js → stateDiagram-v2-2b26beab-2178c0f3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-564d890e.js → styles-080da4f6-23ffa4fc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-38957613.js → styles-3dcbcfbf-94f59763.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-f0fc6921.js → styles-9c745c82-78a6bebc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-ef3c5a77.js → svgDrawCommon-4835440b-eae2a6f6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-bf3e91c1.js → timeline-definition-5b62e21b-5c968d92.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-4d4026c0.js → xychartDiagram-2b33534f-fd3db0d5.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +18 -15
- rasa/core/channels/inspector/index.html +17 -14
- rasa/core/channels/inspector/package.json +5 -1
- rasa/core/channels/inspector/src/App.tsx +118 -68
- rasa/core/channels/inspector/src/components/Chat.tsx +95 -0
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +11 -10
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +10 -25
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +6 -3
- rasa/core/channels/inspector/src/helpers/audiostream.ts +165 -0
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +10 -0
- rasa/core/channels/inspector/src/helpers/formatters.ts +107 -41
- rasa/core/channels/inspector/src/helpers/utils.ts +92 -7
- rasa/core/channels/inspector/src/types.ts +21 -1
- rasa/core/channels/inspector/yarn.lock +94 -1
- rasa/core/channels/rest.py +51 -46
- rasa/core/channels/socketio.py +28 -1
- rasa/core/channels/telegram.py +1 -1
- rasa/core/channels/twilio.py +1 -1
- rasa/core/channels/{audiocodes.py → voice_ready/audiocodes.py} +122 -69
- rasa/core/channels/{voice_aware → voice_ready}/jambonz.py +26 -8
- rasa/core/channels/{voice_aware → voice_ready}/jambonz_protocol.py +57 -5
- rasa/core/channels/{twilio_voice.py → voice_ready/twilio_voice.py} +64 -28
- rasa/core/channels/voice_ready/utils.py +37 -0
- rasa/core/channels/voice_stream/asr/__init__.py +0 -0
- rasa/core/channels/voice_stream/asr/asr_engine.py +89 -0
- rasa/core/channels/voice_stream/asr/asr_event.py +18 -0
- rasa/core/channels/voice_stream/asr/azure.py +129 -0
- rasa/core/channels/voice_stream/asr/deepgram.py +90 -0
- rasa/core/channels/voice_stream/audio_bytes.py +8 -0
- rasa/core/channels/voice_stream/browser_audio.py +107 -0
- rasa/core/channels/voice_stream/call_state.py +23 -0
- rasa/core/channels/voice_stream/tts/__init__.py +0 -0
- rasa/core/channels/voice_stream/tts/azure.py +106 -0
- rasa/core/channels/voice_stream/tts/cartesia.py +118 -0
- rasa/core/channels/voice_stream/tts/tts_cache.py +27 -0
- rasa/core/channels/voice_stream/tts/tts_engine.py +58 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +173 -0
- rasa/core/channels/voice_stream/util.py +57 -0
- rasa/core/channels/voice_stream/voice_channel.py +427 -0
- rasa/core/information_retrieval/qdrant.py +1 -0
- rasa/core/nlg/contextual_response_rephraser.py +45 -17
- rasa/{nlu → core}/persistor.py +203 -68
- rasa/core/policies/enterprise_search_policy.py +119 -63
- rasa/core/policies/flows/flow_executor.py +15 -22
- rasa/core/policies/intentless_policy.py +83 -28
- rasa/core/processor.py +25 -0
- rasa/core/run.py +12 -2
- rasa/core/secrets_manager/constants.py +4 -0
- rasa/core/secrets_manager/factory.py +8 -0
- rasa/core/secrets_manager/vault.py +11 -1
- rasa/core/training/interactive.py +33 -34
- rasa/core/utils.py +47 -21
- rasa/dialogue_understanding/coexistence/llm_based_router.py +41 -14
- rasa/dialogue_understanding/commands/__init__.py +6 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +60 -0
- rasa/dialogue_understanding/commands/session_end_command.py +61 -0
- rasa/dialogue_understanding/commands/user_silence_command.py +59 -0
- rasa/dialogue_understanding/commands/utils.py +5 -0
- rasa/dialogue_understanding/generator/constants.py +2 -0
- rasa/dialogue_understanding/generator/flow_retrieval.py +47 -9
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +38 -15
- rasa/dialogue_understanding/generator/llm_command_generator.py +1 -1
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +35 -13
- rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +3 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +60 -13
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +53 -0
- rasa/dialogue_understanding/patterns/repeat.py +37 -0
- rasa/dialogue_understanding/patterns/user_silence.py +37 -0
- rasa/dialogue_understanding/processor/command_processor.py +21 -1
- rasa/e2e_test/aggregate_test_stats_calculator.py +1 -11
- rasa/e2e_test/assertions.py +136 -61
- rasa/e2e_test/assertions_schema.yml +23 -0
- rasa/e2e_test/e2e_test_case.py +85 -6
- rasa/e2e_test/e2e_test_runner.py +2 -3
- rasa/engine/graph.py +0 -1
- rasa/engine/loader.py +12 -0
- rasa/engine/recipes/config_files/default_config.yml +0 -3
- rasa/engine/recipes/default_recipe.py +0 -1
- rasa/engine/recipes/graph_recipe.py +0 -1
- rasa/engine/runner/dask.py +2 -2
- rasa/engine/storage/local_model_storage.py +12 -42
- rasa/engine/storage/storage.py +1 -5
- rasa/engine/validation.py +527 -74
- rasa/model_manager/__init__.py +0 -0
- rasa/model_manager/config.py +40 -0
- rasa/model_manager/model_api.py +559 -0
- rasa/model_manager/runner_service.py +286 -0
- rasa/model_manager/socket_bridge.py +146 -0
- rasa/model_manager/studio_jwt_auth.py +86 -0
- rasa/model_manager/trainer_service.py +325 -0
- rasa/model_manager/utils.py +87 -0
- rasa/model_manager/warm_rasa_process.py +187 -0
- rasa/model_service.py +112 -0
- rasa/model_training.py +42 -23
- rasa/nlu/tokenizers/whitespace_tokenizer.py +3 -14
- rasa/server.py +4 -2
- rasa/shared/constants.py +60 -8
- rasa/shared/core/constants.py +13 -0
- rasa/shared/core/domain.py +107 -50
- rasa/shared/core/events.py +29 -0
- rasa/shared/core/flows/flow.py +5 -0
- rasa/shared/core/flows/flows_list.py +19 -6
- rasa/shared/core/flows/flows_yaml_schema.json +10 -0
- rasa/shared/core/flows/utils.py +39 -0
- rasa/shared/core/flows/validation.py +121 -0
- rasa/shared/core/flows/yaml_flows_io.py +15 -27
- rasa/shared/core/slots.py +5 -0
- rasa/shared/importers/importer.py +59 -41
- rasa/shared/importers/multi_project.py +23 -11
- rasa/shared/importers/rasa.py +12 -3
- rasa/shared/importers/remote_importer.py +196 -0
- rasa/shared/importers/utils.py +3 -1
- rasa/shared/nlu/training_data/formats/rasa_yaml.py +18 -3
- rasa/shared/nlu/training_data/training_data.py +18 -19
- rasa/shared/providers/_configs/litellm_router_client_config.py +220 -0
- rasa/shared/providers/_configs/model_group_config.py +167 -0
- rasa/shared/providers/_configs/openai_client_config.py +1 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +73 -0
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -0
- rasa/shared/providers/_configs/utils.py +16 -0
- rasa/shared/providers/_utils.py +79 -0
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +13 -29
- rasa/shared/providers/embedding/azure_openai_embedding_client.py +54 -21
- rasa/shared/providers/embedding/default_litellm_embedding_client.py +24 -0
- rasa/shared/providers/embedding/litellm_router_embedding_client.py +135 -0
- rasa/shared/providers/llm/_base_litellm_client.py +34 -22
- rasa/shared/providers/llm/azure_openai_llm_client.py +50 -29
- rasa/shared/providers/llm/default_litellm_llm_client.py +24 -0
- rasa/shared/providers/llm/litellm_router_llm_client.py +182 -0
- rasa/shared/providers/llm/rasa_llm_client.py +112 -0
- rasa/shared/providers/llm/self_hosted_llm_client.py +5 -29
- rasa/shared/providers/mappings.py +19 -0
- rasa/shared/providers/router/__init__.py +0 -0
- rasa/shared/providers/router/_base_litellm_router_client.py +183 -0
- rasa/shared/providers/router/router_client.py +73 -0
- rasa/shared/utils/common.py +40 -24
- rasa/shared/utils/health_check/__init__.py +0 -0
- rasa/shared/utils/health_check/embeddings_health_check_mixin.py +31 -0
- rasa/shared/utils/health_check/health_check.py +258 -0
- rasa/shared/utils/health_check/llm_health_check_mixin.py +31 -0
- rasa/shared/utils/io.py +27 -6
- rasa/shared/utils/llm.py +353 -43
- rasa/shared/utils/schemas/events.py +2 -0
- rasa/shared/utils/schemas/model_config.yml +0 -10
- rasa/shared/utils/yaml.py +181 -38
- rasa/studio/data_handler.py +3 -1
- rasa/studio/upload.py +160 -74
- rasa/telemetry.py +94 -17
- rasa/tracing/config.py +3 -1
- rasa/tracing/instrumentation/attribute_extractors.py +95 -18
- rasa/tracing/instrumentation/instrumentation.py +121 -0
- rasa/utils/common.py +5 -0
- rasa/utils/endpoints.py +27 -1
- rasa/utils/io.py +8 -16
- rasa/utils/log_utils.py +9 -2
- rasa/utils/sanic_error_handler.py +32 -0
- rasa/validator.py +110 -4
- rasa/version.py +1 -1
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/METADATA +14 -12
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/RECORD +234 -183
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-1844e5a5.js +0 -1
- rasa/core/channels/inspector/dist/assets/index-a5d3e69d.js +0 -1040
- rasa/core/channels/voice_aware/utils.py +0 -20
- rasa/llm_fine_tuning/notebooks/unsloth_finetuning.ipynb +0 -407
- /rasa/core/channels/{voice_aware → voice_ready}/__init__.py +0 -0
- /rasa/core/channels/{voice_native → voice_stream}/__init__.py +0 -0
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/NOTICE +0 -0
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/WHEEL +0 -0
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Z as zt,$ as ot,X as wt,W as Ft,s as Nt,g as Xt,B as Yt,D as St,a as Ht,b as $t,E as Ut,l as Ct,U as qt,i as jt,d as Gt}from"./index-
|
|
1
|
+
import{Z as zt,$ as ot,X as wt,W as Ft,s as Nt,g as Xt,B as Yt,D as St,a as Ht,b as $t,E as Ut,l as Ct,U as qt,i as jt,d as Gt}from"./index-e7cef9de.js";import{c as Qt}from"./createText-62fc7601-b0ec81d6.js";import{i as Kt}from"./init-77b53fdd.js";import{o as Zt}from"./ordinal-ba9b4969.js";import{l as ft}from"./linear-4776f780.js";import{l as pt}from"./line-7c59abb6.js";import"./array-9f3ba611.js";import"./path-53f90ab3.js";function Jt(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function st(){var e=Zt().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,c,f=!1,d=0,R=0,_=.5;delete e.unknown;function A(){var m=t().length,T=n<s,S=T?n:s,P=T?s:n;o=(P-S)/Math.max(1,m-d+R*2),f&&(o=Math.floor(o)),S+=(P-S-o*(m-d))*_,c=o*(1-d),f&&(S=Math.round(S),c=Math.round(c));var p=Jt(m).map(function(C){return S+o*C});return i(T?p.reverse():p)}return e.domain=function(m){return arguments.length?(t(m),A()):t()},e.range=function(m){return arguments.length?([s,n]=m,s=+s,n=+n,A()):[s,n]},e.rangeRound=function(m){return[s,n]=m,s=+s,n=+n,f=!0,A()},e.bandwidth=function(){return c},e.step=function(){return o},e.round=function(m){return arguments.length?(f=!!m,A()):f},e.padding=function(m){return arguments.length?(d=Math.min(1,R=+m),A()):d},e.paddingInner=function(m){return arguments.length?(d=Math.min(1,m),A()):d},e.paddingOuter=function(m){return arguments.length?(R=+m,A()):R},e.align=function(m){return arguments.length?(_=Math.max(0,Math.min(1,m)),A()):_},e.copy=function(){return st(t(),[s,n]).round(f).paddingInner(d).paddingOuter(R).align(_)},Kt.apply(A(),arguments)}var nt=function(){var e=function(V,r,l,u){for(l=l||{},u=V.length;u--;l[V[u]]=r);return l},t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],c=[1,7],f=[1,5,10,12,14,16,18,19,21,23,34,35,36],d=[1,25],R=[1,26],_=[1,28],A=[1,29],m=[1,30],T=[1,31],S=[1,32],P=[1,33],p=[1,34],C=[1,35],h=[1,36],L=[1,37],z=[1,43],lt=[1,42],ct=[1,47],$=[1,50],w=[1,10,12,14,16,18,19,21,23,34,35,36],Q=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],ut=[1,64],K={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:function(r,l,u,g,b,a,F){var x=a.length-1;switch(b){case 5:g.setOrientation(a[x]);break;case 9:g.setDiagramTitle(a[x].text.trim());break;case 12:g.setLineData({text:"",type:"text"},a[x]);break;case 13:g.setLineData(a[x-1],a[x]);break;case 14:g.setBarData({text:"",type:"text"},a[x]);break;case 15:g.setBarData(a[x-1],a[x]);break;case 16:this.$=a[x].trim(),g.setAccTitle(this.$);break;case 17:case 18:this.$=a[x].trim(),g.setAccDescription(this.$);break;case 19:this.$=a[x-1];break;case 20:this.$=[Number(a[x-2]),...a[x]];break;case 21:this.$=[Number(a[x])];break;case 22:g.setXAxisTitle(a[x]);break;case 23:g.setXAxisTitle(a[x-1]);break;case 24:g.setXAxisTitle({type:"text",text:""});break;case 25:g.setXAxisBand(a[x]);break;case 26:g.setXAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 27:this.$=a[x-1];break;case 28:this.$=[a[x-2],...a[x]];break;case 29:this.$=[a[x]];break;case 30:g.setYAxisTitle(a[x]);break;case 31:g.setYAxisTitle(a[x-1]);break;case 32:g.setYAxisTitle({type:"text",text:""});break;case 33:g.setYAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 37:this.$={text:a[x],type:"text"};break;case 38:this.$={text:a[x],type:"text"};break;case 39:this.$={text:a[x],type:"markdown"};break;case 40:this.$=a[x];break;case 41:this.$=a[x-1]+""+a[x];break}},table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:c}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:c}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(f,[2,34]),e(f,[2,35]),e(f,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:c}),{1:[2,3]},e(f,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:c}),{11:23,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:39,13:38,24:z,27:lt,29:40,30:41,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:45,15:44,27:ct,33:46,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:49,17:48,24:$,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:52,17:51,24:$,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{20:[1,53]},{22:[1,54]},e(w,[2,18]),{1:[2,2]},e(w,[2,8]),e(w,[2,9]),e(Q,[2,37],{40:55,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L}),e(Q,[2,38]),e(Q,[2,39]),e(E,[2,40]),e(E,[2,42]),e(E,[2,43]),e(E,[2,44]),e(E,[2,45]),e(E,[2,46]),e(E,[2,47]),e(E,[2,48]),e(E,[2,49]),e(E,[2,50]),e(E,[2,51]),e(w,[2,10]),e(w,[2,22],{30:41,29:56,24:z,27:lt}),e(w,[2,24]),e(w,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},e(w,[2,11]),e(w,[2,30],{33:60,27:ct}),e(w,[2,32]),{31:[1,61]},e(w,[2,12]),{17:62,24:$},{25:63,27:ut},e(w,[2,14]),{17:65,24:$},e(w,[2,16]),e(w,[2,17]),e(E,[2,41]),e(w,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(w,[2,31]),{27:[1,69]},e(w,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(w,[2,15]),e(w,[2,26]),e(w,[2,27]),{11:59,32:72,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},e(w,[2,33]),e(w,[2,19]),{25:73,27:ut},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:function(r,l){if(l.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=l,u}},parse:function(r){var l=this,u=[0],g=[],b=[null],a=[],F=this.table,x="",U=0,gt=0,Vt=2,xt=1,Bt=a.slice.call(arguments,1),k=Object.create(this.lexer),B={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(B.yy[J]=this.yy[J]);k.setInput(r,B.yy),B.yy.lexer=k,B.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var tt=k.yylloc;a.push(tt);var Wt=k.options&&k.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ot(){var I;return I=g.pop()||k.lex()||xt,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=l.symbols_[I]||I),I}for(var D,W,v,it,O={},q,M,dt,j;;){if(W=u[u.length-1],this.defaultActions[W]?v=this.defaultActions[W]:((D===null||typeof D>"u")&&(D=Ot()),v=F[W]&&F[W][D]),typeof v>"u"||!v.length||!v[0]){var et="";j=[];for(q in F[W])this.terminals_[q]&&q>Vt&&j.push("'"+this.terminals_[q]+"'");k.showPosition?et="Parse error on line "+(U+1)+`:
|
|
2
2
|
`+k.showPosition()+`
|
|
3
3
|
Expecting `+j.join(", ")+", got '"+(this.terminals_[D]||D)+"'":et="Parse error on line "+(U+1)+": Unexpected "+(D==xt?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError(et,{text:k.match,token:this.terminals_[D]||D,line:k.yylineno,loc:tt,expected:j})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+D);switch(v[0]){case 1:u.push(D),b.push(k.yytext),a.push(k.yylloc),u.push(v[1]),D=null,gt=k.yyleng,x=k.yytext,U=k.yylineno,tt=k.yylloc;break;case 2:if(M=this.productions_[v[1]][1],O.$=b[b.length-M],O._$={first_line:a[a.length-(M||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(M||1)].first_column,last_column:a[a.length-1].last_column},Wt&&(O._$.range=[a[a.length-(M||1)].range[0],a[a.length-1].range[1]]),it=this.performAction.apply(O,[x,gt,U,B.yy,v[1],b,a].concat(Bt)),typeof it<"u")return it;M&&(u=u.slice(0,-1*M*2),b=b.slice(0,-1*M),a=a.slice(0,-1*M)),u.push(this.productions_[v[1]][0]),b.push(O.$),a.push(O._$),dt=F[u[u.length-2]][u[u.length-1]],u.push(dt);break;case 3:return!0}}return!0}},It=function(){var V={EOF:1,parseError:function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},setInput:function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var l=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var b=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===g.length?this.yylloc.first_column:0)+g[g.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[b[0],b[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAICAQAAEABADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAOwAAADsAAAAEAAAABAAAABxaUwAwoyZAMOJmADBi5kAwoyZAMKMmQDCjJkAwoyZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAAAACV3AAAAAAAAAAAAAAAAAAYXdwAAAAAAAAAAAAAAAANHd3cAAAAAAAEREREREREXd3d3ERAAAAAHd3d3d3d3d3FXd3dwAAAAB3d3d3d3d3dDB3d3cAAAAAd3IiIiIiIiAAIid3AAAAAHdwAAAAAAAAAAAHdwAAAAB3cAAAAAAAAAAAB3cAAAAAd3AAd3AABnd0AAd3AAAAAHdwAHdwADF3QgAHdwAAAAB3cAB3dTMXcSAAB3cAAAAAd3AAd3dxdxMAAAd3AAAAAHdwAHd3d3dGAAAHdwAAAAB3cAB3dHd3dxUAB3cAAAAAd3AAd3A1F3d3AAd3AAAAAHdwAHdwAANXdwAHdwAAAAB3cAB3cAAAAXcAB3cAAAAAd3AAd3d3d3d3AAd3AAAAAHdwAHd3d3d3dwAHdwAAAAB3cAB3d3d3d3cAB3cAAAAAd3AAAAAAAAAAAAd3AAAAAHdwAAAAAAAAAAAHdwAAAAB3cAAAAAAAAAAAB3cAAAAAd3d3d3d3d3d3d3d3AAAAAHd3d3d3d3d3d3d3dwAAAAB3d3d3d3d3d3d3d3cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///5////4f///8H///8B/8AAAD/AAAA/wAAQP8AAcD/H//4/x//+P8ceDj/HHA4/xwAeP8cAPj/HAD4/xwAOP8cQDj/HHg4/xx+OP8cADj/HAA4/xwAOP8f//j/H//4/x//+P8AAAD/AAAA/wAAAP/////////////////////w==" sizes="32x32">
|
|
8
8
|
<title>Rasa inspector</title>
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-e7cef9de.js"></script>
|
|
10
10
|
<link rel="stylesheet" href="./assets/index-3ee28881.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
@@ -15,22 +15,25 @@
|
|
|
15
15
|
|
|
16
16
|
<div id="rasa-chat-widget" data-websocket-url="" data-default-open="true"></div>
|
|
17
17
|
<script>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
remReference =
|
|
26
|
-
|
|
18
|
+
// only show the rasa chat widget if we are on the socketio channel
|
|
19
|
+
if (window.location.pathname.includes("socketio")) {
|
|
20
|
+
const chatDiv = document.getElementById("rasa-chat-widget");
|
|
21
|
+
const websocketUrl = window.location.origin.replace("http", "ws");
|
|
22
|
+
const maxHeight = document.documentElement.scrollHeight - 130;
|
|
23
|
+
// 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
|
|
24
|
+
// A potential improvement would be to add a onresize event for both width and height
|
|
25
|
+
let remReference = 21.75;
|
|
26
|
+
if (document.documentElement.clientWidth > 1631) {
|
|
27
|
+
remReference = 25.75;
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
const columnWidth = remReference * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
chatDiv.setAttribute("data-websocket-url", websocketUrl);
|
|
33
|
+
chatDiv.setAttribute("data-close-on-outside-click", false);
|
|
34
|
+
chatDiv.setAttribute("data-height", maxHeight);
|
|
35
|
+
chatDiv.setAttribute("data-width", columnWidth);
|
|
36
|
+
}
|
|
34
37
|
</script>
|
|
35
38
|
<!-- downloaded from https://unpkg.com/@rasahq/rasa-chat -->
|
|
36
39
|
|
|
@@ -13,22 +13,25 @@
|
|
|
13
13
|
<script type="module" src="/src/main.tsx"></script>
|
|
14
14
|
<div id="rasa-chat-widget" data-websocket-url="" data-default-open="true"></div>
|
|
15
15
|
<script>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
remReference =
|
|
24
|
-
|
|
16
|
+
// only show the rasa chat widget if we are on the socketio channel
|
|
17
|
+
if (window.location.pathname.includes("socketio")) {
|
|
18
|
+
const chatDiv = document.getElementById("rasa-chat-widget");
|
|
19
|
+
const websocketUrl = window.location.origin.replace("http", "ws");
|
|
20
|
+
const maxHeight = document.documentElement.scrollHeight - 130;
|
|
21
|
+
// 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
|
|
22
|
+
// A potential improvement would be to add a onresize event for both width and height
|
|
23
|
+
let remReference = 21.75;
|
|
24
|
+
if (document.documentElement.clientWidth > 1631) {
|
|
25
|
+
remReference = 25.75;
|
|
26
|
+
}
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
const columnWidth = remReference * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
chatDiv.setAttribute("data-websocket-url", websocketUrl);
|
|
31
|
+
chatDiv.setAttribute("data-close-on-outside-click", false);
|
|
32
|
+
chatDiv.setAttribute("data-height", maxHeight);
|
|
33
|
+
chatDiv.setAttribute("data-width", columnWidth);
|
|
34
|
+
}
|
|
32
35
|
</script>
|
|
33
36
|
<!-- downloaded from https://unpkg.com/@rasahq/rasa-chat -->
|
|
34
37
|
<script src="/assets/rasa-chat.js" type="module" ></script>
|
|
@@ -17,11 +17,15 @@
|
|
|
17
17
|
"@emotion/react": "11.11.1",
|
|
18
18
|
"@emotion/styled": "11.11.0",
|
|
19
19
|
"axios": "1.5.1",
|
|
20
|
+
"deep-chat-react": "2.0.1",
|
|
20
21
|
"framer-motion": "10.16.4",
|
|
22
|
+
"immutable-json-patch": "^6.0.1",
|
|
21
23
|
"mermaid": "10.6.0",
|
|
24
|
+
"query-string": "^9.0.0",
|
|
22
25
|
"react": "18.2.0",
|
|
23
26
|
"react-dom": "18.2.0",
|
|
24
27
|
"react-syntax-highlighter": "15.5.0",
|
|
28
|
+
"react-use-websocket": "^4.8.1",
|
|
25
29
|
"usehooks-ts": "2.9.1"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
@@ -45,4 +49,4 @@
|
|
|
45
49
|
"typescript": "5.0.2",
|
|
46
50
|
"vite": "4.4.5"
|
|
47
51
|
}
|
|
48
|
-
}
|
|
52
|
+
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
useToast,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
8
|
import { useEffect, useState } from "react";
|
|
9
|
-
import { useInterval } from "usehooks-ts";
|
|
10
9
|
import axios from "axios";
|
|
11
10
|
import { useOurTheme } from "./theme";
|
|
12
11
|
import { Welcome } from "./components/Welcome";
|
|
@@ -15,12 +14,15 @@ import { DialougeInformation } from "./components/DialogueInformation";
|
|
|
15
14
|
import { LoadingSpinner } from "./components/LoadingSpinner";
|
|
16
15
|
import { DiagramFlow } from "./components/DiagramFlow";
|
|
17
16
|
import { formatSlots } from "./helpers/formatters";
|
|
18
|
-
import { Slot, Stack, Event, Flow, SelectedStack } from "./types";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
import { Slot, Stack, Event, Flow, SelectedStack, Tracker } from "./types";
|
|
18
|
+
import {
|
|
19
|
+
createHistoricalStack,
|
|
20
|
+
flowStepTrail,
|
|
21
|
+
updatedActiveFrame,
|
|
22
|
+
} from "./helpers/utils";
|
|
23
|
+
import queryString from "query-string";
|
|
24
|
+
import { Chat } from "./components/Chat";
|
|
25
|
+
import useWebSocket, { ReadyState } from "react-use-websocket";
|
|
24
26
|
|
|
25
27
|
export function App() {
|
|
26
28
|
const toast = useToast();
|
|
@@ -33,6 +35,48 @@ export function App() {
|
|
|
33
35
|
const [stack, setStack] = useState<Stack[]>([]);
|
|
34
36
|
const [frame, setFrame] = useState<SelectedStack | undefined>(undefined);
|
|
35
37
|
|
|
38
|
+
// we only show the transcript if we are not on the socket io channel
|
|
39
|
+
// on the socketio channel, we show the chat component instead
|
|
40
|
+
const shouldShowTranscript = !window.location.href.includes("socketio");
|
|
41
|
+
|
|
42
|
+
const inspectWS = window.location.href
|
|
43
|
+
.replace("inspect.html", "tracker_stream")
|
|
44
|
+
.replace("http", "ws");
|
|
45
|
+
const { sendJsonMessage, lastJsonMessage, readyState } =
|
|
46
|
+
useWebSocket<Tracker>(inspectWS, {
|
|
47
|
+
share: false,
|
|
48
|
+
shouldReconnect: () => true,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (readyState === ReadyState.OPEN && rasaChatSessionId) {
|
|
53
|
+
sendJsonMessage({
|
|
54
|
+
action: "retrieve",
|
|
55
|
+
sender_id: rasaChatSessionId,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}, [readyState, sendJsonMessage, rasaChatSessionId]);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
// if we are on a "dynamic" input channel where the user can chat on
|
|
62
|
+
// the inspector page, these chat-uis (rasa chat, vortex chat) don't
|
|
63
|
+
// support loading an existing conversation. therefore, we don't set
|
|
64
|
+
// the sender id in the url and a reload of the page will start a new
|
|
65
|
+
// conversation.
|
|
66
|
+
if(!shouldShowTranscript) return;
|
|
67
|
+
|
|
68
|
+
const queryParameters = queryString.parse(window.location.search);
|
|
69
|
+
const urlSender = queryParameters.sender as string;
|
|
70
|
+
if (urlSender && urlSender !== rasaChatSessionId) {
|
|
71
|
+
setRasaChatSessionId(urlSender);
|
|
72
|
+
} else if (!urlSender && rasaChatSessionId) {
|
|
73
|
+
// update the sender query parameter
|
|
74
|
+
const url = new URL(window.location.href);
|
|
75
|
+
url.searchParams.set("sender", rasaChatSessionId);
|
|
76
|
+
window.history.pushState(null, "", url.toString());
|
|
77
|
+
}
|
|
78
|
+
}, [rasaChatSessionId, shouldShowTranscript]);
|
|
79
|
+
|
|
36
80
|
useEffect(() => {
|
|
37
81
|
axios
|
|
38
82
|
.get("/flows")
|
|
@@ -51,66 +95,54 @@ export function App() {
|
|
|
51
95
|
});
|
|
52
96
|
}, [toast]);
|
|
53
97
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.then((response) => setStory(response.data))
|
|
69
|
-
.catch((error) => {
|
|
70
|
-
// don't show a new toast if it's already active
|
|
71
|
-
if (toast.isActive("story-error")) return;
|
|
72
|
-
toast({
|
|
73
|
-
id: "story-error",
|
|
74
|
-
title: "Stories could not be retrieved",
|
|
75
|
-
description: error?.message || "An unknown error happened.",
|
|
76
|
-
status: "error",
|
|
77
|
-
duration: 4000,
|
|
78
|
-
isClosable: true,
|
|
79
|
-
});
|
|
98
|
+
function fetchStory() {
|
|
99
|
+
axios
|
|
100
|
+
.get(`/conversations/${rasaChatSessionId}/story`)
|
|
101
|
+
.then((response) => setStory(response.data))
|
|
102
|
+
.catch((error) => {
|
|
103
|
+
// don't show a new toast if it's already active
|
|
104
|
+
if (toast.isActive("story-error")) return;
|
|
105
|
+
toast({
|
|
106
|
+
id: "story-error",
|
|
107
|
+
title: "Stories could not be retrieved",
|
|
108
|
+
description: error?.message || "An unknown error happened.",
|
|
109
|
+
status: "error",
|
|
110
|
+
duration: 4000,
|
|
111
|
+
isClosable: true,
|
|
80
112
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
rasaChatSessionId ? pollingInterval : null
|
|
84
|
-
);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
85
115
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
116
|
+
// Run when a new WebSocket message is received (lastJsonMessage)
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
// if the tracker update that we received is for the current chat session,
|
|
119
|
+
// update the tracker.
|
|
120
|
+
if (!lastJsonMessage) return;
|
|
121
|
+
if (
|
|
122
|
+
!rasaChatSessionId ||
|
|
123
|
+
lastJsonMessage?.sender_id === rasaChatSessionId
|
|
124
|
+
) {
|
|
125
|
+
setSlots(formatSlots(lastJsonMessage.slots));
|
|
126
|
+
setEvents(lastJsonMessage.events);
|
|
127
|
+
const updatedStack = createHistoricalStack(
|
|
128
|
+
lastJsonMessage.stack,
|
|
129
|
+
lastJsonMessage.events
|
|
130
|
+
);
|
|
131
|
+
setStack(updatedStack);
|
|
132
|
+
setFrame(updatedActiveFrame(frame, updatedStack, lastJsonMessage.events));
|
|
133
|
+
setRasaChatSessionId(lastJsonMessage.sender_id);
|
|
134
|
+
} else if (
|
|
135
|
+
rasaChatSessionId &&
|
|
136
|
+
lastJsonMessage.sender_id !== rasaChatSessionId
|
|
137
|
+
) {
|
|
138
|
+
// show a header link with the new sender the user can click a button to
|
|
139
|
+
// switch to the new chat session. the alert should be dissmissable.
|
|
140
|
+
}
|
|
141
|
+
}, [lastJsonMessage, rasaChatSessionId]);
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
fetchStory();
|
|
145
|
+
}, [rasaChatSessionId]);
|
|
114
146
|
|
|
115
147
|
const borderRadiusSx = {
|
|
116
148
|
borderRadius: rasaRadii.normal,
|
|
@@ -140,7 +172,15 @@ export function App() {
|
|
|
140
172
|
gridRowGap: rasaSpace[1],
|
|
141
173
|
};
|
|
142
174
|
|
|
143
|
-
|
|
175
|
+
const onFrameSelected = (stack: Stack) => {
|
|
176
|
+
setFrame({
|
|
177
|
+
stack,
|
|
178
|
+
activatedSteps: flowStepTrail(events)[stack.flow_id],
|
|
179
|
+
isUserSelected: true,
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
if (!rasaChatSessionId && !window.location.href.includes("socketio")) return <LoadingSpinner />;
|
|
144
184
|
|
|
145
185
|
return (
|
|
146
186
|
<Grid sx={gridSx}>
|
|
@@ -151,7 +191,7 @@ export function App() {
|
|
|
151
191
|
sx={boxSx}
|
|
152
192
|
stack={stack}
|
|
153
193
|
active={frame?.stack}
|
|
154
|
-
onItemClick={
|
|
194
|
+
onItemClick={onFrameSelected}
|
|
155
195
|
/>
|
|
156
196
|
<DialougeInformation
|
|
157
197
|
sx={boxSx}
|
|
@@ -163,8 +203,18 @@ export function App() {
|
|
|
163
203
|
</Grid>
|
|
164
204
|
</GridItem>
|
|
165
205
|
<GridItem sx={boxSx}>
|
|
166
|
-
<DiagramFlow
|
|
206
|
+
<DiagramFlow
|
|
207
|
+
stackFrame={frame?.stack}
|
|
208
|
+
stepTrail={frame?.activatedSteps || []}
|
|
209
|
+
flows={flows}
|
|
210
|
+
slots={slots}
|
|
211
|
+
/>
|
|
167
212
|
</GridItem>
|
|
213
|
+
{shouldShowTranscript && (
|
|
214
|
+
<GridItem>
|
|
215
|
+
<Chat events={events || []} />
|
|
216
|
+
</GridItem>
|
|
217
|
+
)}
|
|
168
218
|
</Grid>
|
|
169
219
|
);
|
|
170
220
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { DeepChat } from "deep-chat-react";
|
|
2
|
+
import { MessageContent } from "deep-chat/dist/types/messages";
|
|
3
|
+
import { Flex, FlexProps } from "@chakra-ui/react";
|
|
4
|
+
import { Command, Event } from "../types";
|
|
5
|
+
|
|
6
|
+
interface Props extends FlexProps {
|
|
7
|
+
events: Event[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Chat = ({ sx, events, ...props }: Props) => {
|
|
11
|
+
const containerSx = {
|
|
12
|
+
...sx,
|
|
13
|
+
p: 0,
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const maxHeight = document.documentElement.scrollHeight - 64;
|
|
18
|
+
// 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
|
|
19
|
+
// A potential improvement would be to add a onresize event for both width and height
|
|
20
|
+
let remReference = 21.75;
|
|
21
|
+
if (document.documentElement.clientWidth > 1631) {
|
|
22
|
+
remReference = 25.75;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const columnWidth =
|
|
26
|
+
remReference *
|
|
27
|
+
parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
28
|
+
|
|
29
|
+
// function that maps a command dict to a human string to display in the chat
|
|
30
|
+
const mapCommand = (command: Command) => {
|
|
31
|
+
let commandName = command.command;
|
|
32
|
+
if (commandName === "start flow") {
|
|
33
|
+
return `Start (${command.flow})`;
|
|
34
|
+
}
|
|
35
|
+
if (commandName === "set slot") {
|
|
36
|
+
return `Set (${command.name} = ${command.value})`;
|
|
37
|
+
}
|
|
38
|
+
return commandName;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// collect user and bot messages
|
|
42
|
+
const messages: MessageContent[] = events
|
|
43
|
+
.filter((event: Event) => event.event === "user" || event.event === "bot")
|
|
44
|
+
// @ts-expect-error
|
|
45
|
+
.flatMap((event: Event) => {
|
|
46
|
+
if (event.event === "user") {
|
|
47
|
+
let commands =
|
|
48
|
+
event.parse_data?.commands?.map(
|
|
49
|
+
(command) => `<div>${mapCommand(command)}</div>`
|
|
50
|
+
) || [];
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
role: event.event,
|
|
54
|
+
text: event.text || "",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
role: "system",
|
|
58
|
+
html: `<div>${commands.join("")}</div>`,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
} else {
|
|
62
|
+
return [
|
|
63
|
+
{
|
|
64
|
+
role: event.event,
|
|
65
|
+
text: event.text || "",
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Flex sx={containerSx} {...props}>
|
|
73
|
+
<DeepChat
|
|
74
|
+
avatars={true}
|
|
75
|
+
textInput={{
|
|
76
|
+
disabled: true,
|
|
77
|
+
}}
|
|
78
|
+
inputAreaStyle={{ display: "none" }}
|
|
79
|
+
messageStyles={{
|
|
80
|
+
html: {
|
|
81
|
+
shared: { bubble: { backgroundColor: "unset", padding: "0px" } },
|
|
82
|
+
},
|
|
83
|
+
}}
|
|
84
|
+
style={{
|
|
85
|
+
borderRadius: "10px",
|
|
86
|
+
border: "none",
|
|
87
|
+
width: columnWidth,
|
|
88
|
+
height: maxHeight,
|
|
89
|
+
}}
|
|
90
|
+
history={messages}
|
|
91
|
+
demo={true}
|
|
92
|
+
/>
|
|
93
|
+
</Flex>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -10,17 +10,14 @@ interface Props {
|
|
|
10
10
|
stackFrame?: Stack;
|
|
11
11
|
flows: Flow[];
|
|
12
12
|
slots: Slot[];
|
|
13
|
+
stepTrail?: string[];
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export const DiagramFlow = (
|
|
16
|
+
export const DiagramFlow = ({ stackFrame, stepTrail, flows, slots }: Props) => {
|
|
16
17
|
const { rasaSpace } = useOurTheme();
|
|
17
18
|
const mermaidRef = useRef<HTMLPreElement>(null);
|
|
18
19
|
const [text, setText] = useState<string>("");
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const activeFlowId = stackFrame?.flow_id;
|
|
22
|
-
const activeStepId = stackFrame?.step_id;
|
|
23
|
-
const flow = flows.find(({ id }) => id === activeFlowId);
|
|
20
|
+
const flow = flows.find(({ id }) => id === stackFrame?.flow_id)
|
|
24
21
|
|
|
25
22
|
const config = {
|
|
26
23
|
startOnLoad: true,
|
|
@@ -28,7 +25,7 @@ export const DiagramFlow = (props: Props) => {
|
|
|
28
25
|
flowchart: {
|
|
29
26
|
useMaxWidth: false,
|
|
30
27
|
},
|
|
31
|
-
}
|
|
28
|
+
};
|
|
32
29
|
|
|
33
30
|
useEffect(() => {
|
|
34
31
|
mermaid.mermaidAPI.initialize(config);
|
|
@@ -50,10 +47,14 @@ export const DiagramFlow = (props: Props) => {
|
|
|
50
47
|
}, [text]);
|
|
51
48
|
|
|
52
49
|
useEffect(() => {
|
|
53
|
-
setText(formatFlow(slots, stackFrame, flow,
|
|
54
|
-
}, [text, flow, slots, stackFrame
|
|
50
|
+
setText(formatFlow(slots, stackFrame, flow, stepTrail));
|
|
51
|
+
}, [text, flow, slots, stackFrame]);
|
|
55
52
|
|
|
56
53
|
const handleRestartConversation = () => {
|
|
54
|
+
// unset the sender id from the query parameters
|
|
55
|
+
const url = new URL(window.location.href);
|
|
56
|
+
url.searchParams.delete("sender");
|
|
57
|
+
window.history.pushState(null, "", url.toString());
|
|
57
58
|
location.reload();
|
|
58
59
|
};
|
|
59
60
|
|
|
@@ -99,7 +100,7 @@ export const DiagramFlow = (props: Props) => {
|
|
|
99
100
|
</Box>
|
|
100
101
|
<Flex justifyContent="space-between" alignItems="flex-end">
|
|
101
102
|
<Button variant="outline" size="sm" onClick={handleRestartConversation}>
|
|
102
|
-
|
|
103
|
+
New conversation
|
|
103
104
|
</Button>
|
|
104
105
|
</Flex>
|
|
105
106
|
</Flex>
|
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
Tooltip,
|
|
15
15
|
} from "@chakra-ui/react";
|
|
16
16
|
import { useOurTheme } from "../theme";
|
|
17
|
-
import {
|
|
17
|
+
import { Stack } from "../types";
|
|
18
18
|
import { shouldShowTooltip } from "../helpers/utils";
|
|
19
19
|
|
|
20
20
|
interface Props extends FlexProps {
|
|
21
21
|
stack: Stack[];
|
|
22
22
|
active?: Stack;
|
|
23
|
-
onItemClick?: (
|
|
23
|
+
onItemClick?: (stack: Stack) => void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function StackRow({
|
|
@@ -32,15 +32,8 @@ function StackRow({
|
|
|
32
32
|
stack: Stack;
|
|
33
33
|
highlighted?: boolean;
|
|
34
34
|
selectable?: boolean;
|
|
35
|
-
onItemClick?: (
|
|
35
|
+
onItemClick?: (stack: Stack) => void;
|
|
36
36
|
}) {
|
|
37
|
-
const { rasaFontSizes } = useOurTheme();
|
|
38
|
-
|
|
39
|
-
const idSx = {
|
|
40
|
-
fontSize: rasaFontSizes.xs,
|
|
41
|
-
textTransform: "uppercase",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
37
|
// use pointy hand cursor when hovering over a row
|
|
45
38
|
const clickableTrSx = {
|
|
46
39
|
_hover: {
|
|
@@ -62,19 +55,12 @@ function StackRow({
|
|
|
62
55
|
return (
|
|
63
56
|
<Tr
|
|
64
57
|
sx={highlighted ? highlightedTrSx : selectable ? clickableTrSx : undefined}
|
|
65
|
-
onClick={() => onItemClick?.(
|
|
58
|
+
onClick={() => onItemClick?.(stack)}
|
|
66
59
|
>
|
|
67
|
-
<Td sx={idSx}>
|
|
68
|
-
<Text noOfLines={1}>{stack.frame_id}</Text>
|
|
69
|
-
</Td>
|
|
70
60
|
<Td>
|
|
71
|
-
{
|
|
72
|
-
<Tooltip label={stack.flow_id} hasArrow>
|
|
73
|
-
<Text noOfLines={1}>{stack.flow_id}</Text>
|
|
74
|
-
</Tooltip>
|
|
75
|
-
) : (
|
|
61
|
+
<Tooltip label={`${stack.flow_id} (${stack.frame_id})`} hasArrow>
|
|
76
62
|
<Text noOfLines={1}>{stack.flow_id}</Text>
|
|
77
|
-
|
|
63
|
+
</Tooltip>
|
|
78
64
|
</Td>
|
|
79
65
|
<Td>
|
|
80
66
|
{shouldShowTooltip(stack.step_id) ? (
|
|
@@ -115,17 +101,16 @@ export const DialogueStack = ({
|
|
|
115
101
|
<Flex sx={containerSx} {...props}>
|
|
116
102
|
<Flex>
|
|
117
103
|
<Heading size="lg" mb={rasaSpace[0.5]}>
|
|
118
|
-
|
|
104
|
+
History
|
|
119
105
|
</Heading>
|
|
120
|
-
<Text ml={rasaSpace[0.25]}>({stack.length}
|
|
106
|
+
<Text ml={rasaSpace[0.25]}>({stack.length} flows)</Text>
|
|
121
107
|
</Flex>
|
|
122
108
|
<Box sx={overflowBox}>
|
|
123
109
|
<Table width="100%" layout="fixed">
|
|
124
110
|
<Thead>
|
|
125
111
|
<Tr>
|
|
126
|
-
<Th width="20%">ID</Th>
|
|
127
112
|
<Th>Flow</Th>
|
|
128
|
-
<Th width="
|
|
113
|
+
<Th width="40%">Step ID</Th>
|
|
129
114
|
</Tr>
|
|
130
115
|
</Thead>
|
|
131
116
|
<Tbody>
|
|
@@ -141,7 +126,7 @@ export const DialogueStack = ({
|
|
|
141
126
|
/>
|
|
142
127
|
))}
|
|
143
128
|
{stack.length === 0 && (
|
|
144
|
-
<StackRow stack={{ frame_id: "-", flow_id: "-", step_id: "-" }} />
|
|
129
|
+
<StackRow stack={{ frame_id: "-", flow_id: "-", step_id: "-", ended: false }} />
|
|
145
130
|
)}
|
|
146
131
|
</Tbody>
|
|
147
132
|
</Table>
|