Agent gives an empty response after migrating from version 7 to version 12


(Prasanna Ganeshu) #1

Hi @tmbo ,@akelad ,@juste,

Im getting empty response from the agent.This issue occured only after migrating from Version 7 to Version 12. Here is my code snippet ::

@app.route('/api/v1/<sender_id>/respond', methods=['GET', 'POST'])
def respond(self, request, sender_id):
    request.setHeader('Content-Type', 'application/json')
    request.setHeader('Access-Control-Allow-Origin', '*')
    request_params = request_parameters(request)
    print("=========Request PARam================: ",request_params)
    if 'query' in request_params:
    	message = request_params.pop('query')
    elif 'q' in request_params:
    	message = request_params.pop('q')
    	return json.dumps({"error": "Invalid parse parameter specified"})
        out = CollectingOutputChannel()
        print("***********", message, "====", out, "====", sender_id)
        response = self.agent.handle_message(message,output_channel=out, sender_id=sender_id)
        response = UserMessage(message, out, sender_id)
        print("==UserMessage==", response.__dict__)
        print("TRY: " , response)
        return json.dumps(response)
    except Exception as e:
        logger.error("Caught an exception during parse: {}".format(e), exc_info=1)
        return json.dumps({"error": "{}".format(e)})

Ive tried to test only the agent.handle_message(),its not giving any response.

from rasa_core.agent import Agent agent = Agent.load("./models/dialogue", interpreter="./models/nlu/default/weathernlu") resp = agent.handle_message(“hello”) print(resp) print(“OK”)

@juste please help me in resolving the issue…