Botfront 是一个非常方便的 Rasa GUI 图形化管理后台。可以在网页里:
- 编辑所有的 Rasa 配置文件
- 执行训练
- 使用 web 聊天组件
非常适合没有 linux 服务器操作经验的用户。
整个安装配置过程参考
https://botfront.io/docs/installation/server-cluster
即可。
这里只是记录一下文档中没有提及的细节。
版本
botfront@1.0.5
目录结构
$ tree -a
.
├── .botfront
│   ├── botfront.yml
│   └── docker-compose-template.yml
├── actions
│   ├── Dockerfile
│   ├── Dockerfile.production
│   ├── __init__.py
│   ├── my_actions.py
│   └── requirements.txt
└── rasa
    ├── Dockerfile
    ├── __init__.py
    ├── ignore_sample_component.py
    ├── requirements.txt
    └── setup.py
3 directories, 12 files
botfront.yml
可以看懂 botfront 是基于 Rasa 2.X 版本。并不支持 Rasa 3.X。
images:
  default:
    botfront: 'botfront/botfront:v1.0.5'
    rasa: 'botfront/rasa-for-botfront:v2.3.3-bf.3'
    duckling: 'botfront/duckling:latest'
    mongo: 'mongo:latest'
    actions: 'rasa/rasa-sdk:2.1.2'
  current:
    botfront: 'botfront/botfront:v1.0.5'
    rasa: 'botfront/rasa-for-botfront:v2.3.3-bf.3'
    duckling: 'botfront/duckling:latest'
    mongo: 'mongo:latest'
    actions: 'rasa/rasa-sdk:2.1.2'
env:
  bf_project_id: bf
  bf_url: 'http://botfront:3000/graphql'
  root_url: 'http://localhost:8888'
  augmentation_factor: 50
  mongo_url: 'mongodb://mongo:27017/bf'
version: 1.0.5
需要将这里的 root_url 修改成服务器的外网 IP 地址。
然后通过 http://your_ip:8888 进行访问 botfront 管理后台。
error
查看错误日志:
botfront logs
pointsFetched' as it is null.
botfront-rasa      | 2023-07-09 07:09:18 DEBUG    rasa.utils.botfront  - Trying to fetch config from http://botfront:3000/graphql (retry #327)
botfront-rasa      | 2023-07-09 07:09:18 ERROR    sgqlc.endpoint.http  - GraphQL query failed with 1 errors
botfront-rasa      | 2023-07-09 07:09:18 DEBUG    rasa.utils.botfront  - Cannot destructure property 'endpoints' of 'endpointsFetched' as it is null.
botfront-rasa      | 2023-07-09 07:09:18 DEBUG    rasa.utils.botfront  - Trying to fetch config from http://botfront:3000/graphql (retry #328)
botfront-rasa      | 2023-07-09 07:09:18 ERROR    sgqlc.endpoint.http  - GraphQL query failed with 1 errors
botfront-rasa      | 2023-07-09 07:09:18 DEBUG    rasa.utils.botfront  - Cannot destructure property 'endpoints' of 'endpointsFetched' as it is null.
docker 容器
$ docker container ls
CONTAINER ID   IMAGE                      COMMAND                  CREATED         STATUS         PORTS                                                 NAMES
xxxxxxxxxxxx   botfront/botfront:v1.0.5   "/docker/entrypoint.…"   4 minutes ago   Up 4 minutes   0.0.0.0:8888->3000/tcp, :::8888->3000/tcp             botfront-app
xxxxxxxxxxxx   botfront-rasa              "/bin/bash -o pipefa…"   4 minutes ago   Up 4 minutes   0.0.0.0:5005->5005/tcp, :::5005->5005/tcp             botfront-rasa
xxxxxxxxxxxx   mongo:latest               "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes   0.0.0.0:27017->27017/tcp, :::27017->27017/tcp         botfront-mongo
xxxxxxxxxxxx   botfront/duckling:latest   "/bin/sh -c 'exec du…"   4 minutes ago   Up 4 minutes   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp             botfront-duckling
settings/credentials
注意,安装文档里提到的修改 settings/credentials base_url 指的是 botfront web 管理后台的修改,而不是服务器上的 rasa 配置文件目录。
训练模型
点击 botfront 网页后台右上角的 TRAIN 按钮即可。转圈即在 training。
这个训练过程跟在命令行里调用 rasa train 是一样的,会很耗时,大概 5 分钟左右,取决于 CPU 的计算能力。
请耐心等待 : )
训练完之后,就可以在 web 聊天组件里测试效果了。非常有成就感。
训练模型时的权限错误
Error: An unexpected error occurred during training. Error: [Errno 13] Permission denied: 'models/model-chitchat-xxxxxx.tar.gz'
我通过 chown 当前用户,还是不行,我不太了解 docker 用户权限机制,看来得了解一下。
先临时通过 chmod 777 来解决没有写入权限的问题。再次点击 TRAIN 按钮,就能正常地生成模型了。
ls models/
model-chitchat-xxxxxx.tar.gz
查看合集
关于作者 🌱
我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式