<Rasa实战>第五章实例运行

1. 指令执行步骤

1).训练数据

rasa train

2).启动Rasa动作服务器

rasa run actions

3).启动Rasa服务器和客户端(在新建的命令行里)

rasa shell

3.1).(基于网页访问方式)启动Rasa服务器和客户端(在新建的命令行里)

启动Rasa服务器

rasa run --cors "*"

启动网页客户端

切换到目录 web_client 下,

cd web_client

然后执行:

python -m http.server

在网页浏览器中输入

http://localhost:8000/
或
http://127.0.0.1:8000/

2. 问题追踪

Q1:首次不能完全识别"今天上海天气怎么样"?

在这里插入图片描述

Fixed:

在这里插入图片描述

在这里插入图片描述

Q2: exception while running action ‘respond_chitchat’

在这里插入图片描述

2022-04-03 08:47:46 ERROR    rasa.core.processor  - Encountered an exception while running action 'respond_chitchat'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "/Users/liaowenfeng/opt/anaconda3/envs/py380_rasa/lib/python3.8/site-packages/rasa/core/actions/action.py", line 722, in run
    response = await self.action_endpoint.request(
  File "/Users/liaowenfeng/opt/anaconda3/envs/py380_rasa/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 173, in request
    raise ClientResponseError(
rasa.utils.endpoints.ClientResponseError: 404, Not Found, body='b'{"error":"No registered action found for name \'respond_chitchat\'.","action_name":"respond_chitchat"}''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/liaowenfeng/opt/anaconda3/envs/py380_rasa/lib/python3.8/site-packages/rasa/core/processor.py", line 868, in _run_action
    events = await action.run(
  File "/Users/liaowenfeng/opt/anaconda3/envs/py380_rasa/lib/python3.8/site-packages/rasa/core/actions/action.py", line 746, in run
    raise RasaException("Failed to execute custom action.") from e
rasa.shared.exceptions.RasaException: Failed to execute custom action.

Fixed:

这是因为:respond_chitchat没有实现,改成:utter_chitchat即可
在这里插入图片描述

Q3: 不能识别更多的意图时

在这里插入图片描述

FIXED:

在这里插入图片描述

Q4 询问天气时,返回results

在这里插入图片描述

Fixed

services/weather.py中需要设置SENIVERSE_KEY值,如:

KEY = os.getenv("SENIVERSE_KEY", "Sq0zIGw7UCR7Evo30")  # API key

在这里插入图片描述

Q5 运行rasa run actions时报警告: constrain_similarities is set to False.

在这里插入图片描述

fixed(暂时可忽略):
config.yml中添加"constrain_similarities: true"
在这里插入图片描述
深究下去,发现原来其初始值是False
在这里插入图片描述

Q6 运行rasa run actions时报警告: Misaligned entity annotation in message ‘今天天气如何’ with intent ‘weather’

fixed:
使用自定义分词组件可修复之,参考第9章的源码;

Q7 运行rasa shell时报警告:Slot auto-fill has been removed in 3.0 and replaced with a new explicit mechanism to set slots

rasa\shared\core\slot_mappings.py:213: UserWarning: Slot auto-fill has been removed in 3.0 and replaced with a new explicit mechanism to set slots. Please refer to https://rasa.com/docs/rasa/domain#slots to learn more.
rasa.shared.utils.io.raise_warning(

fixed(暂时可忽略):

官方说明:

3. 参考:

我正在「AI爱好者社区」服务器中聊天,来和我一起畅聊吧 ~ 点击加入:https://fanbook.mobi/3H6D5FVN

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值