使用Botkit部署Rasa_NLU Slack聊天机器人遇“未找到undefined项目”错误
Hey there! Let's work through this error you're seeing when trying to chat with your Rasa NLU bot via Slack (even though the bot shows as online). Based on the error message and your setup, here are the most actionable fixes to check out:
1. Verify Botkit's Rasa Project Name Configuration
The "undefined" project name means Botkit isn't getting a valid project identifier to send to your Rasa server. Double-check your Botkit integration code:
- If you're using the
botkit-rasapackage, make sure you explicitly set theprojectparameter in the initialization. For example:const rasa = require('botkit-rasa')({ rasa_uri: 'http://localhost:5005', // Match your local Rasa server URL project: 'default' // Use your actual Rasa project name—default is "default" if you didn't customize it }); - Avoid leaving this field empty or relying on an uninitialized variable that resolves to
undefined.
2. Confirm Rasa Server's Project Setup
Your Rasa server needs to be running with the same project name you specified in Botkit:
- If you trained your model with the default project, start Rasa with:
rasa run --enable-api --cors "*" - If you used a custom project name during training (e.g.,
rasa train --project my-slack-bot), start the server with that project flag:rasa run --enable-api --cors "*" --project my-slack-bot - Test the Rasa API directly to confirm the project is recognized: run
curl http://localhost:5005/model/parse?q=helloand check the response for aprojectfield—this should match what's in your Botkit config.
3. Check Environment Variables & Working Directory
Sometimes missing or misloaded environment variables cause this issue:
- If you're using an env var to set the project name (e.g.,
process.env.RASA_PROJECT), make sure you've exported it before starting Botkit:export RASA_PROJECT=default node your-botkit-script.js - Ensure Botkit is running from the correct working directory. If your config files are in a subfolder, double-check that path references aren't broken, leading to missing configuration values.
4. Validate botkit-rasa Version Compatibility
Older versions of botkit-rasa might use different parameter names (like project_name instead of project). Check your installed version with:
npm list botkit-rasa
Then adjust your configuration to match the parameter names expected by that version.
Start with the first two checks—mismatched or missing project names are the most common cause of this error. Let me know if any of these steps get your bot chatting with Slack properly!
内容的提问来源于stack exchange,提问作者Vincent

