Я получаю сообщение об ошибке при отправке следующего почтового запроса на указанный код Nodejs.Я использую Dialogflow API здесь.
Ошибка:
Error: Input text not set.
at Http2CallStream.call.on (/home/user/coding/chatbot/node_modules/@grpc/grpc-js/build/src/client.js:96:45)
at Http2CallStream.emit (events.js:203:15)
at process.nextTick (/home/user/coding/chatbot/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
КОД:
app.post("/api/df_text_query", async (req, res) => {
const request = {
session: sessionPath,
queryInput: {
text: {
text: req.body.text,
languageCode: config.dialogFlowSessionLanguageCode
}
}
};
let responses = await sessionClient.detectIntent(request);
res.send(responses[0].queryResult);
});
POST-запрос:
{
"text":"HI"
}