为什么服装行动不起作用-Rasa Core

时间:2019-01-30 13:57:34

标签: nlp rasa-nlu rasa-core

 

Rasa Core版本0.13.0 Rasa Core SDK版本0.12.1

Python版本3.6

操作系统(Windows,OSX,...):Windows 10

问题rasa_core.processor - Encountered an exception while running action 'email_verification'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.

更多信息: 我运行python -m rasa_core_sdk.endpoint --actions actionspython -m rasa_core.run -d models/dialogue -u models/nlu --endpoints endpoints.yml <,但是当我运行第二部分然后运行train_online.py时,我得到: OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted: ('0.0.0.0', 5005)不能同时运行两者,我想同时运行两者的原因是,我读了一个github问题,我可能会通过自定义操作解决主要问题。

动作文件:

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import requests
from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet


class EmailVerification(Action):

    def name(self):
        return "email_verification"

    def run(self, dispatcher, tracker, domain):
        # type: # (Dispatcher, DialogueStateTracker, Domain) -> List[Event]

        user_email_address = tracker.get_slot('email')
        base_url = "http://apilayer.net/api/check?access_key=8c47e63ccc2e06553e4daba9eadd23d3&email={email}"
        url = base_url.format(**{'email': user_email_address})
        res = requests.get(url)
        emailVer = res.json()['format_valid']
        if emailVer == True:
            response = "Your email is valid, thank you."
        else:
            response = "Your email is Invalid, please retype."

        dispatcher.utter_message(response)
        return [SlotSet("email", user_email_address)]

端点文件的内容(如果已使用且相关):

action_endpoint:
  url: http://localhost:5055/webhook

#nlg:
#url: http://localhost:5056/nlg

nlu:
    url: http://localhost:5000

core_endpoint:
  url: http://localhost:5056

1 个答案:

答案 0 :(得分:0)

好像另一个进程正在占用端口5005。要么停止在端口5005上运行的另一个进程,要么在另一个端口上启动动作服务器,例如:

python -m rasa_core_sdk.endpoint --actions actions --port 9000

并在您的终结点文件中(似乎这是当前错误(5055而不是5005),请确保它与操作终结点使用的相同):

action_endpoint:
  url: http://localhost:9000/webhook
#other endpoints