为什么costum操作不工作 - 莎核心

问题描述 投票:1回答:1

莎Core版本:0.13.0莎核心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
nlp rasa-nlu rasa-core
1个回答
0
投票

好像另一个进程正在占用端口5005。要么你停止其他进程在端口5005上运行,或者你启动一个不同的端口,e.g上行动服务器:

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

并在端点文件(似乎这是目前错误(5055而不是5005),请确保它是相同的13759动作端点):

action_endpoint:
  url: http://localhost:9000/webhook
#other endpoints
© www.soinside.com 2019 - 2024. All rights reserved.