You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于Rasa构建聊天机器人:Ubuntu本地环境下对话数据获取问题

获取本地Ubuntu Shell运行的Rasa机器人对话数据

Hey there! I’ve dealt with this exact situation before when testing Rasa bots locally, so let me share a few straightforward ways to grab your conversation data—no need to deploy to a full HTTP server setup.

方法1:直接读取Rasa默认SQLite数据库

When you run rasa shell locally, Rasa automatically stores all conversation events (user messages, bot responses, intent predictions, etc.) in a SQLite database file right in your working directory. Here’s how to access it:

  • First, confirm the database exists: Run ls -l in your bot’s root folder—you should see a file named rasa.db.
  • Install SQLite CLI (if you don’t have it):
    sudo apt update && sudo apt install sqlite3
    
  • Access the database and query events:
    sqlite3 rasa.db
    
    Once in the SQLite shell, run this query to see all conversation data:
    SELECT * FROM events;
    
  • Export to a readable format (like CSV):
    Exit the SQLite shell, then run this command to save events to a CSV file:
    sqlite3 -header -csv rasa.db "SELECT * FROM events;" > conversation_data.csv
    

方法2:配置文件型事件日志

You can set up Rasa to write all conversation events directly to a JSON log file. Just add this to your config.yml:

event_broker:
  type: file
  path: ./conversation_events.log
  format: json

Restart your bot with rasa shell, and every time a conversation happens, the events will be appended to conversation_events.log in JSON format. You can parse this file with tools like jq (install with sudo apt install jq) to filter or format the data:

jq '.text' conversation_events.log  # Extract only user/bot messages

方法3:启用本地API服务(匹配文档场景)

If you want to use the exact workflow mentioned in the Rasa docs, you can run the API server alongside the shell:

  1. Open a new terminal window, navigate to your bot’s folder, and start the API:
    rasa run --enable-api
    
  2. In your original terminal, run the shell connected to the local API:
    rasa shell --endpoint http://localhost:5005
    

Now you can use the standard conversation tracker endpoints to fetch data—just send requests to http://localhost:5005 using tools like curl or Postman.

内容的提问来源于stack exchange,提问作者Vincent

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:14:26