我一直在尝试使用rasa_nlu
原生 botpress nlu 来代替。
这是我的代码。 数据/全局/钩子/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/
我使用 botpress 运行./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.
我该如何解决这个问题?