我一直在尝试使用rasa_nlu
代替本地botpress nlu。
这是我的代码。 data / global / hooks / 01_ras_nlu.js
const axios = require('axios')
const eventTypes = ['text'] // Process only ‘text’ events
async function rasaExtract() {
if (eventTypes.includes(event.type)) {
const { data } = await axios.post('http://localhost:5000/parse',{ q: event.preview }
)
if (data) {
/** TODO Here you will need to manipulate the format of these objects so that they use the same
format as Botpress NLU */
event.nlu = event.nlu || {}
event.nlu.intent = {};
if(data.intent.name)
event.nlu.intent.name = data.intent.name;
else
event.nlu.intent.name = 'none';
event.nlu.intent.confidence = 1.0;
// Disable Native NLU
event.setFlag(bp.IO.WellKnownFlags.SKIP_NATIVE_NLU, true)
}
}
}
return rasaExtract()
我重写了nlu.json文件 data / global / config / nlu.json
{
"$schema": "../../../assets/modules/nlu/config.schema.json",
"intentsDir": "./intents",
"entitiesDir": "./entities",
"modelsDir": "./models",
"provider": "rasa",
"debugModeEnabled": true,
"minimumConfidence": 0.3,
"maximumConfidence": 100,
"rasaEndpoint": "http://localhost:5000",
"rasaProject": "botpress",
"confidenceTreshold": 0.7,
"ducklingURL": "https://duckling.botpress.io",
"ducklingEnabled": true
}
我真的对“ rasaProject”:“ botpress”感到困惑,rasaProject的价值应该是什么?是model
文件夹吗?
我使用以下命令启动了rasa
python -m rasa_nlu.train --data data/Data.json --config config_spacy.json
python -m rasa_nlu.server --config config_spacy.json --path models/
然后我使用./bp
Created a new chat bot. and tried to communicate with chatbot, when i type `hi` in chat, i getting
response in `data` field in *data/global/hooks/01_ras_nlu.js* . But not getting any response from chat bot in chat.
我该如何解决?
答案 0 :(得分:0)
请尝试致电this endpoint。这应该给你这样的输出
{
"available_projects": {
"my_restaurant_search_bot" : {
"status" : "ready",
"available_models" : [
<model_XXXXXX>,
<model_XXXXXX>
]
}
}
}
available_projects
中的每个键都是项目名称。您可能应该只有一个。使用此请求发送到/parse
。如果可以共享NLU日志以进行进一步调试,这也将很有用。 Rasa forum中的社区也许也可以为您提供帮助。