0

我一直在尝试使用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.

我该如何解决这个问题?

4

1 回答 1

0

请尝试调用此端点。这应该给你这样的输出

{
  "available_projects": {
    "my_restaurant_search_bot" : {
      "status" : "ready",
      "available_models" : [
        <model_XXXXXX>,
        <model_XXXXXX>
      ]
    }
  }
}

每个键available_projects是一个项目名称。你可能应该只有一个。将此用于请求/parse。如果您可以共享 NLU 日志以进行进一步调试,这也将很有用。Rasa 论坛中的社区也可能会为您提供帮助。

于 2019-06-18T20:00:35.957 回答