Rasa Webchat Integration

I have not yet gone to intent prediction level sir. I am trying to bring up Rasa and get a clean. setup.

Jitesh

am I missing any setup over here ?. probably, there must be some ENV variable to be set for Rasa to read from the trained model place rather than from regular temp space.

You won’t get to know whether it’s working fine or not unless you have tested it sir :blush:

I am using windows system so I didn’t do any environment path variable for the temp space.

Got it. I will check and get back to you. I am new to Rasa. will try to see . but if you have any findings, then let me know

Sure sir :blush::+1:

Jitesh

I have built a separate virtual image under Vmware fusion. built a ubuntu and gone through this fully. too many things I have to fix. finally for this.but still our issue still perists. logged a bug with Rasa, see

Heloooooo again @JiteshGaikwad!

I’m trying to use your modifications, I was able to run them, even debug the socketChannel.py you made. The customData arrive there with no problem but isn’t sent to the ā€˜action_session_start’ event on the action server (as metadata).

File: socketChannel.py - Line: await on_new_message(message) image

I’m pretty new to RASA and Python (1 week working which each), I’m trying to find why the customData isn’t sent to ā€˜action_session_start’ (as metadata), but my chances aren’t very good based on my current level of expertise at RASA and Python.

Can you help me?

I even had to change your method extract_metadata_from_tracker because of the events dictionary is empty and added some logs and the return is always empty:

tracker.current_state() {ā€˜sender_id’: ā€˜79630f5a353f499fbec162302a30fb12’, ā€˜slots’: {}, ā€˜latest_message’: {ā€˜intent’: {}, ā€˜entities’: [ ], ā€˜text’: None, ā€˜message_id’: None, ā€˜metadata’: {}}, ā€˜latest_event_time’: None, ā€˜paused’: False, ā€˜events’: , 'latest_input_channel ': None, ā€˜active_form’: {}, ā€˜latest_action_name’: None}

tracker.current_state()[ā€œeventsā€]

2020-04-08 10:40:21.050844 MetaData:

File: actions.py

def extract_metadata_from_tracker(tracker: Tracker):
    events = tracker.current_state()['events']
    print('tracker.current_state()', tracker.current_state())
    print('tracker.current_state()["events"]', tracker.current_state()['events'])
    user_events = []
    for e in events:
        print(e)
        if e['event'] == 'user':
            user_events.append(e)
    
    if len(user_events) > 0:
        return user_events[-1]['metadata']
    return ''

class ActionSessionStart(Action):
    def name(self) -> Text:
        return 'action_session_start'
		
    async def run(self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict]:
            
        metadata = extract_metadata_from_tracker(tracker)        
        print(datetime.now(), 'MetaData: ', metadata)

UPDATE:

I found that the new session always send a blank tracker, so now I’m looking for other ways to pass the customData to ā€˜action_session_start’

I have clarification how to run the rasa server on rasa.ai.com (provided static IP and domain name) instead of localhost:5005, my environment is windows and offline environment (there is no access to internet)

>Previously linked reply<

@JiteshGaikwad

I was able to pass the custom data to the action server, I had to modify your socketChannel.py (I’ll try to update the Github) and the processor.py from RASA.

My doubt here is how to make the changes o processor permanent? Just commit and push to RASA repo?

hey @lluchini, sorry I was busy with something else so didn’t got time to reply you :sweat_smile:

Glad that you were able to solve it :slight_smile:

you can make a pull request, is that what you are trying to say?

@JiteshGaikwad

No prob bro, no need to apologize for, everyone does what they can! :grin: I hope someday to be good at RASA/Python to help as much you do.

Yes, I never used Github (I use git), I just need to create a pull request for yours/RASA repo with the change? like on Bitbucket from Atlassian?

And I would like to know if you can just check what I did, and be sure it won’t break anything else on RASA, can you?

Thanks and Ya sure definitely you will :smiley:

I too recently started learning about the PR, no problem you can raise the issue in the GitHub repo and tell me the changes there, I will integrate those changes, does that works for you?

1 Like

I don’t know if is this what you meant, but I forked RASA on my Github and pushed a branch with the adjusts, the link is below.

Github - lluchini: metada-on-session-start-action

Hey @lluchini, sorry but that’s too complicated for mešŸ˜…

Your socketChannel that’s too complicated for me… :joy:

No problem, I’ll submit the pull request, let’s see what happen…

Just everybody knows, it already had an issue opened for my problem Issues #5574.

I linked the open issue with my pull request…

Hi,

I’m replying here because my issue seems similar.

I have worked before with the early rasa_nlu and I have one computer (Ubuntu 18.04) with working Rasa 1.3.1 installation. Now I wanted to install new Rasa to my new server, create a new bot and connect it to Webchat. This works fine in that old computer, Webchat also.

I have the latest Rasa version in Ubuntu 18.04 (Python 3.6) server. First I tried to install it to venv but it kept failing. Maybe I got it wrong somehow. But it is now installed in the server. ā€˜Rasa init’ worked fine.

When I run ā€˜rasa run –enable-api’ –cors ā€œ*ā€ –debug’, Rasa server starts’. The same error ā€œFailed to load modelā€ as was discussed earlier. However the model gets extracted later.

In my web server Webchat tries to GET http://localhost:5005/socket.io/… but there is ERR_CONNECTION_REFUSED.

If I curl localhost:5005, I get ā€œHello from RASAā€.

Credentials.yml (socketio) should be configured fine, as I have this working in the other computer.

Any suggestions what to try next?

Hello @Kejender,

can you start rasa with debug option post the logs from rasa here so we can check with more details what’s happening?

Ok here it is:

2020-04-21 07:45:03,802 [DEBUG]  Available web server routes: 
/conversations/<conversation_id>/messages          POST                           add_message
/conversations/<conversation_id>/tracker/events    POST                           append_events
/webhooks/rasa                                     GET                            custom_webhook_RasaChatInput.health
/webhooks/rasa/webhook                             POST                           custom_webhook_RasaChatInput.receive
/webhooks/rest                                     GET                            custom_webhook_RestInput.health
/webhooks/rest/webhook                             POST                           custom_webhook_RestInput.receive
/model/test/intents                                POST                           evaluate_intents
/model/test/stories                                POST                           evaluate_stories
/conversations/<conversation_id>/execute           POST                           execute_action
/domain                                            GET                            get_domain
/socket.io                                         POST                           handle_request
/                                                  GET                            hello
/model                                             PUT                            load_model
/model/parse                                       POST                           parse
/conversations/<conversation_id>/predict           POST                           predict
/conversations/<conversation_id>/tracker/events    PUT                            replace_events
/conversations/<conversation_id>/story             GET                            retrieve_story
/conversations/<conversation_id>/tracker           GET                            retrieve_tracker
/webhooks/socketio                                 GET                            socketio_webhook.health
/status                                            GET                            status
/model/predict                                     POST                           tracker_predict
/model/train                                       POST                           train
/conversations/<conversation_id>/trigger_intent    POST                           trigger_intent
/model                                             DELETE                         unload_model
/version                                           GET                            version
2020-04-21 07:45:03,804 [INFO ]  Starting Rasa server on http://localhost:5005
2020-04-21 07:45:03,804 [DEBUG]  Using the default number of Sanic workers (1).
2020-04-21 07:45:03,806 [INFO ]  Enabling coroutine debugging. Loop id 94055192.
2020-04-21 07:45:04,154 [DEBUG]  Extracted model to '/tmp/tmparlo_dm9'.
2020-04-21 07:45:04,486 [DEBUG]  Loading the model ...
2020-04-21 07:45:05,578 [DEBUG]  Finished loading the model.
2020-04-21 07:45:05,579 [DEBUG]  Building tensorflow prediction graph...
2020-04-21 07:45:10,674 [DEBUG]  Finished building tensorflow prediction graph.
2020-04-21 07:45:10,680 [DEBUG]  Failed to load model for 'ResponseSelector'. Maybe you did not provide enough training data and no model was trained or the path '/tmp/tmparlo_dm9/nlu' doesn't exist?
2020-04-21 07:45:10,691 [DEBUG]  Connected to InMemoryTrackerStore.
2020-04-21 07:45:10,691 [DEBUG]  Connected to lock store 'InMemoryLockStore'.
2020-04-21 07:45:11,070 [DEBUG]  Extracted model to '/tmp/tmp8_f862mu'.
2020-04-21 07:45:11,074 [DEBUG]  Using yaml library: /usr/local/lib/python3.6/dist-packages/ruamel/yaml/__init__.py
2020-04-21 07:45:11,098 [DEBUG]  Loading the model ...
2020-04-21 07:45:11,364 [DEBUG]  Finished loading the model.
2020-04-21 07:45:11,367 [DEBUG]  Building tensorflow prediction graph...
2020-04-21 07:45:12,278 [DEBUG]  Finished building tensorflow prediction graph.
2020-04-21 07:45:12,283 [DEBUG]  Instantiated NLG to 'TemplatedNaturalLanguageGenerator'.