# euanka-rasa **Repository Path**: jackyAtUstc/euanka-rasa ## Basic Information - **Project Name**: euanka-rasa - **Description**: No description available - **Primary Language**: Python - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-14 - **Last Updated**: 2025-04-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # euanka-rasa ### 架构 #### 官方架构 官方介绍:https://rasa.com/docs/rasa/arch-overview ![Architecture-official](./.assets/architecture-official.png) ### 虚拟环境 安装 conda python 3.9.18 首先先安装miniconda,建议miniconda,因为免费使用,去miniconda获取指令下载 然后使用以下命令直接安装 python 3.9.18 ```shell conda create -n rasa python=3.9.18 ``` ``` # # To activate this environment, use # # $ conda activate rasa # # To deactivate an active environment, use # # $ conda deactivate ``` 使用 conda activate rasa 激活当前虚拟环境 ### 全量安装 ```shell pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ ``` ```shell rasa init ``` 下载spacy对应的模型,这里不用下载,当前代码文件夹就有 安装作为依赖 ```shell pip install zh_core_web_md-3.4.0-py3-none-any.whl ``` 备用命令,目前requirements.txt已经包含,不需要再执行,参考备用 ```shell wget https://github.com/explosion/spacy-models/releases/download/zh_core_web_md-3.4.0/zh_core_web_md-3.4.0-py3-none-any.whl pip install rasa==3.4.6 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ pip install spacy==3.4.4 -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ### 训练 训练 ```shell rasa train ``` 仅启动rasa nlu服务,指定使用的模型 ,在models下有训练好的 ```shell rasa run --enable-api -m models/20230325-165522-metallic-inertia.tar.gz ``` 测试 ```shell curl localhost:5005/model/parse -d '{"text":"hello"}' curl localhost:5005/model/parse -d '{"text":"今天深圳天气"}' ``` ### rasa 启动 语义 ```shell rasa run -vv --cors "*" ``` actions服务 ```shell rasa run actions ``` ### docker #### rasa rasa docker 镜像构建 ``` docker build -t yfq/rasa:0.1 . ``` 镜像运行,本地构建的包 ``` docker run yfq/rasa:0.1 ``` #### rasa-action 构建 ``` docker build . -f Dockerfile_action -t yfq/rasa-action:0.1 ``` 运行 ``` docker run yfq/rasa-action:0.1 ``` #### rasa 和 rasa-action 合并运行 官方参考操作:https://rasa.com/docs/rasa/docker/building-in-docker/ 创建一个docker网络,使得两个docker容器可以自己内部连接 ``` docker network create my-project ``` 启动 action-sdk: ``` docker run -d --net my-project --name action-server yfq/rasa-action:0.1 ``` 启动rasa ``` docker run -d -p 5005:5005 --net my-project yfq/rasa:0.1 ``` ### 测试 返回的是中文编码,确实存在暂时无法显示 ``` curl -XPOST localhost:5005/webhooks/rest/webhook -H "Content-Type: application/json" -d '{"message":"今天深圳天气"}' ```